supertux icon indicating copy to clipboard operation
supertux copied to clipboard

Dispensers scripting is broken!

Open Rusty-Box opened this issue 1 year ago • 7 comments

Example script: Dispenser.deactivate();

When you run the deactivate script for dispensers and they are not loaded in the level (i.e. being close to them) when that script runs they will ignore the script and remain activated. However, if they are loaded in during the time the script runs it will work but unload them and load them in again (i.e. going far enough away and come back), the dispenser is activated again.

I have the theory that it acts this way because Dispenser might be coded as badguys, as moving sprites such as Platform objects never unload so never run into that issue with scripting

Rusty-Box avatar Mar 18 '24 22:03 Rusty-Box

Dispensers would have to ignore the badguy off-screen checks.

Vankata453 avatar Mar 18 '24 23:03 Vankata453

@Vankata453 Also, can we have an option in the editor to set them off by default?

Rusty-Box avatar Mar 18 '24 23:03 Rusty-Box

Off-screen deactivation improves performance because off-screen objects don't have to be updated. Disabling this doesn't seem like a good idea.

mrkubax10 avatar Mar 20 '24 21:03 mrkubax10

Off-screen deactivation improves performance because off-screen objects don't have to be updated. Disabling this doesn't seem like a good idea.

No non-enemy objects are disabled when off-screen, so why should dispensers? Also keeping in mind it breaks their functionality.

Vankata453 avatar Mar 20 '24 21:03 Vankata453

Ah alright, then yeah Dispensers shouldn't be disabled too.

mrkubax10 avatar Mar 20 '24 21:03 mrkubax10

So how does anyone propose this being fixed?

weluvgoatz avatar Mar 29 '24 03:03 weluvgoatz

Dispensers should remember what state they are in. If you turn them on/off via scripting, it should remember that so that when it unloads and loads back in it won't just change back to default. Shouldn't be that hard to do, then again I ain't a coder so that's that. Though it would be rather nice to see this fixed asap somehow, please.

Rusty-Box avatar May 16 '24 09:05 Rusty-Box