WheteThunger / MonumentAddons

Add entities, spawn points and more to monuments
https://umod.org/plugins/monument-addons
MIT License
5 stars 9 forks source link

Auto toggling of lanterns, fogger and spooker #31

Closed m-hynek closed 2 years ago

m-hynek commented 2 years ago

FogMachine (+Snow Machine) I had to use timer, or spawn fuel into inventory and set its consumption to 0 to for InvokeRepeating. Not sure what approach makes more sense. Before-last commit is with added fuel and InvokeRepeating(StartFogging, 0f, fogLength - 1f); Please advise if you can think of more elegant solution.

Lanterns

Spooker (SpookySpeaker)

WheteThunger commented 2 years ago

FogMachine / SnowMachine

Fuel option -- Not recommended, since it adds complexity and edge cases we have to worry about such as exhausting fuel, unnecessarily consuming fuel which calls hooks, and theoretical edge cases where the fuel could be obtained by players.

Plugin timers -- Not recommended since we also need to check in every iteration of the timer whether the entity is still valid, since it could be destroyed as part of the normal life cycle of the plugin (makill, accidental ent kill, or reloading the profile).

Flags only -- Not recommended, but for visibility, we could just toggle on Flags.Reserved8 (FogMachine.FogFieldOn), and optionally Flags.Reserved6 (FogMachine.Emitting) for a permanent animation. My concern is that no animation will seem off to players, and that a permanent animation will reduce FPS.

Invokes -- Recommended. However, since a lot of these could be spawned in a short amount of time, we should load balance with either InvokeRandomized, or InvokeRepeating with a random start offset (e.g., 0 to 5 seconds).

Lanterns

Looks good! Thanks for being thorough with identifying the different types of lamps and lanterns.

Spooky Speaker

Looks good! I agree with the decision to make it play indefinitely.

WheteThunger commented 2 years ago

Merged. Awesome work!