Replace get_objects_inside_radius
calls with get_connected_players()
where possible #6325
Labels
No Label
1. kind/balancing
1. kind/breaking
1. kind/bug
1. kind/construction
1. kind/documentation
1. kind/enhancement
1. kind/griefing
1. kind/invalid
1. kind/meme
1. kind/node limit
1. kind/other
1. kind/protocol
2. prio/controversial
2. prio/critical
2. prio/elevated
2. prio/good first issue
2. prio/interesting
2. prio/low
3. source/art
3. source/client
3. source/engine
3. source/ingame
3. source/integration
3. source/lag
3. source/license
3. source/mod upstream
3. source/unknown
3. source/website
4. step/approved
4. step/at work
4. step/blocked
4. step/discussion
4. step/help wanted
4. step/needs confirmation
4. step/partially fixed
4. step/question
4. step/ready to deploy
4. step/ready to QA test
4. step/want approval
5. result/cannot reproduce
5. result/duplicate
5. result/fixed
5. result/maybe
5. result/wontfix
ugh/petz
ugh/QA main
ugh/QA NOK
ugh/QA OK
No Milestone
No project
No Assignees
3 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: your-land/bugtracker#6325
Loading…
Reference in New Issue
No description provided.
Delete Branch "%!s(<nil>)"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
vs
here's a set of files which contain both a
get_objects_in_area/get_objects_inside_radius
can and also anis_player
call:EDIT: removed reference to yl_xdecor
mobs_balrog fix
f67f0c0868
spawnit fix
48b0181383
yl_commons /thankyou_nearby fixed
868ee8674c
waypoint_announce fixed "upstream"
c4665b2eb6
PR to mobs_redo:
https://codeberg.org/tenplus1/mobs_redo/pulls/15
mobs_banshee
0586750ab6
nether: i could PR the upstream, but we can't use upstream because we don't want the new biome(s)?
scorpion:
4d7b881c75
yl_church
4bc05001b0
yl_events
527a2c4f1b
yl_nether
75451aa15b
yl_nether_mobs
7748115fdc
Wouldn't it make sense to cache people's position per step in lua and then have LuaJit optimize it?
Also, we should probably gather and document antipatterns, for other modmakers to go through theirs and avoid or remove them.
no, getting the list of active players through the lua API is cheap. copying the relevant players (most of them) to a lua data structure probably is cheaper than copying a lua data structure.
also, players can be disconnected in the middle of one mod processing. every mod that disconnects players would have to invalidate the cache or risk problems.
In the loop, should it be pairs() or ipairs() when iterating over get_connected_players?
Hmm... For some reason I assumed that pairs() is faster, but there are luajit benchmarks that say ipairs() is faster or even just indexing...
For this case it should not matter too much though...
I actually noticed now that flux is doing it the indexing way :p
UPD: changed original post to use flux's version X)
mobs_redo fixed upstream:
822e78fd32
ipairs is faster than pairs, but pairs works on "hash-like" tables, while ipairs does not. using explicit indices is faster than ipairs, and with luajit/lua 5.1, their behaviors are essentially identical. however, the performance difference between the two is negligible unless you've got tight loops iterating over huge tables. i used to prefer ipairs over explicit indexing because i thought it was more legible, but i've switched to preferring explicit indexing for no particular reason.
results: