After death, player respawns without any inventory. (Possible to configure to remove only weapons.)
DEPRECATED: The mod "Hardcore Start" took over the features of this mod.
Tweaks
Mod category: Tweaks
Small changes concerning balance, gameplay, or graphics.
Rather than clearing the player's inventory on respawn (detecting the event yourself), you could make use of the free play scenario's remote call system and change the respawn_items to be nothing.
I can see how this would help with compatibility.
However, I'm not an expert Factorio API and I have no idea how to get to the freeplay scenario data. Google isn't particularly helpful. I'm gonna try some more but I cannot promise anything.
Arguably your current method is "more" compatible with other scenarios as it forces respawning with nothing regardless of scenario, but if other mods do similar things, it would be cleaner in freeplay to use get_respawn_items, remove the gun/ammo, and then set_respawn_items with the result (which would default to empty).
OK, I've tried that but there is a problem. Inventory set by "remote.call("freeplay", "set_respawn_items", respawn_items_here)" is stored in the save file. It means that even after disabling my mod there still is no respawn inventory. This is not really what I'm going for.
In the end, after rewriting the code and merging this mod with "Hardcore Start", I've ended using this method. Still not perfect, turning the mod off is a while procedure.