forgottenserver icon indicating copy to clipboard operation
forgottenserver copied to clipboard

Another type of search for Game.getSpectators

Open MillhioreBT opened this issue 3 years ago • 8 comments

Pull Request Prelude

  • [x] I have followed [proper The Forgotten Server code styling][code].
  • [x] I have read and understood the [contribution guidelines][cont] before making this PR.
  • [x] I am aware that this PR may be closed if the above-mentioned criteria are not fulfilled.

Changes Proposed

New type of search for the method Game.getSpectators Types:

  • GROUND_FLOOR: This represents what was previously false, we search all viewers on the same level Z.
  • UNDERGROUND_FLOOR: This represents what was true before, we look for all the spectators in all the Z levels.
  • SURFACE_GROUND: This is a new type of search, we search all spectators from level 0 to 7 only.

Issues addressed: #3322

MillhioreBT avatar Sep 29 '21 17:09 MillhioreBT

Suggestions:

UNDERGROUND_FLOOR -> ALL_FLOORS SURFACE_GROUND -> SURFACE_FLOORS GROUND_FLOOR -> SAME_FLOOR

Diego-OT avatar Sep 29 '21 19:09 Diego-OT

UNDERGROUND_FLOOR is misleading as it's only looking at two floors above and below while underground, not all of them. I don't have a better name, though.

kornholi avatar Sep 29 '21 22:09 kornholi

Some alternatives for UNDERGROUND_FLOOR

EXTENDED_FLOORS QUINTUPLE_FLOORS MULTI_FLOOR 5_FLOOR_SEARCH NEARBY_FLOORS

All of the above in arbitrary anyway. Why can't we change it to be user defined instead of hardcoded? range_z,

Xikini avatar Oct 01 '21 06:10 Xikini

Some alternatives for UNDERGROUND_FLOOR

EXTENDED_FLOORS QUINTUPLE_FLOORS MULTI_FLOOR 5_FLOOR_SEARCH NEARBY_FLOORS

All of the above in arbitrary anyway. Why can't we change it to be user defined instead of hardcoded? range_z,

I've been thinking about it, already @yamaken93 suggested it too, it's not a bad idea so I'll think about it, I would also like to be able to define the Z range manually, I was just trying to keep the cache in the viewers, but I think because of how they go things, that cache will probably be removed later as apparently it is useless

MillhioreBT avatar Oct 01 '21 22:10 MillhioreBT

Dont forget getSpectators in

data/lib/compat/compat.lua
data/actions/scripts/other/die.lua

EDIT I liked MULTI_FLOOR, SURFACE_FLOOR, SAME_FLOOR

ramon-bernardo avatar Oct 11 '21 21:10 ramon-bernardo

SUB_SURFACE would work for the third param and I think its pretty clear and concise in what it does, especially with the other options being like Dspeichert said:

SAME_FLOOR - that one is easy ABOVE_GROUND - because it's not just ground floor, it's all above it (floors 0-7)

Anyway it goes, if it gets changed with new params, We can just update the wiki to make sure its clear for what is each params intended use

Alternatively, we could just include a min and max for the z, like the x and y already has, with the minimum being the lowest floor to search, and max being the top floor to search, minimum defaulting to the current floor, and maximum defaulting to highest floor in map or same floor as well.

Codinablack avatar Mar 04 '22 18:03 Codinablack

I think a raw api which allows you set from position and to position is good and versatile.

yamaken93 avatar Mar 22 '22 18:03 yamaken93

I think a raw api which allows you set from position and to position is good and versatile.

I second this. Trying to imagine every scenario will just lead to duplication and confusion.

ranisalt avatar Mar 22 '22 19:03 ranisalt