Ah yeah, I wondered if it would be multiplayer safe or not. I'm agreed that I think it currently isn't. Using global variables outside of global
is the issue I think.
My suggestions:
- Use on_nth_tick
instead of on_tick
.
- Consider conditionally hooking onto on_tick
/on_nth_tick
inside of on_entity_damaged
and dropping the hook once spiders_to_watch
. That way no code is being run when all spidertrons have full health.
- Replace spiders_to_watch
with global.spiders_to_watch
(or a more descriptive name like spidertrons_needing_heal
) and initialise it properly at the start of setup()
.
"System to repair damaged entities" not sure what you mean here.
I'm not planning to implement this myself, but if you can get it working as discussed then I'd be very happy add it in. I'd recommend for your own sake that you use GitHub, but doing it over google drive is perfectly easy for me (I can paste it in locally and it shows the complete diff).