Carpet

Carpet

2M Downloads

[Bug] [Scarpet] explosionNoBlockDamage isn't respected when script explodes on player disconnect on single player

hibiii opened this issue ยท 4 comments

commented

This is a mouthful and an edge-case, I know. I'm making a script where a thing requires the player to at least exist (otherwise it should explode) and so I figured it would be a good idea to make it go ka-blew-it when the player disconnects (stops existing in the server).

Reproducing on 1.4.35/21w18a:

  1. Run /carpet setDefault explosionNoBlockDamage true in singleplayer.
  2. Create a script that implements explosion on player disconnect such as: __on_player_disconnects(player, reason) -> { create_explosion(pos(player)) }
  3. Load said script
  4. Close the world and open it again
  5. Wonder why there's a crater
commented

Its sadly the design - when server closes, it sets all the rules to the default - mostly preparing to load another world (for singleplayer). Scripts, even with apps closed - technically could run some code after its all closed. I have plans to attach all the carpet objects to the server, rather than having them defined statically and just reset from world to world, but that's a major change and have no reason to perform during snapshots. I can try to make sure all the carpet code abandons ship when vanilla server is properly gone from the game.

commented

I can't tell if the ending was sarcastic or not, but I understand structural design flaws. I mean, it's not a major problem for me because the only worlds I keep explosionNoBlockDamage turned on are creative worlds and I tend to close my pentagr- I mean, I clean up after myself with stuff that requires the player to exist, but it took me by surprise when the explosion made a crater when I was testing explosion on disconnect. If you want to take a look in any case, I'm pushing to Hibiii/Shenanigans btw.

commented

Did you also run /carpet explosionNoBlockDamage true in addition to /carpet setDefault explosionNoBlockDamage true when reproducing this?

commented

Yes, from my experience setting defaults also sets the rule, but I did set the rule too just in case