Jump to content

Corpse Disintigration Fix


Recommended Posts

The general purpose of this mod, is to prevent corpses from blowing themselves up, before the player has a chance to loot them.


This is done by altering the spawn location of corpses to prevent them from stacking on top of one another, or on top of other blocks that can't support additional blocks on top of them (like small stones).


Depending on the circumstances, this may cause corpses to show up in some odd locations, but the algorithm will always pick the closest (in terms of latitude and longitude) available spot relative to where the zombie died.


After installing the mod, you can adjust some of the corpse positioning behavior by editing the new "CorpseDisintigrationFixConfig" block in blocks.xml. The configuration properties are:


MAX_SEARCH_RADIUS - The maximum horizontal distance (in blocks) that a corpse is allowed to appear from the location where the zombie died. Decrease to improve performance, increase if you need corpses to pile up farther away.


MAX_HEIGHT - The highest point in the game world that a corpse can be positioned at (this should not generally be changed).


MIN_HEIGHT - The lowest point in the game world that a corpse can be positioned at (this should not generally be changed).


CACHE_PERSISTANCE - This mod caches the blocks it scans while positioning corpses to improve performance. This number is the amount of time, in game 'ticks', that the cache is allowed to persist, before it is cleared. Increase to improve performance, at the expense of corpse placement accuracy when blocks are frequently added/removed/changed.


DEBUG_MODE - Set to true if you want any errors encountered in this mods code to force the game console to open. If set to false, the error will be silently logged to avoid breaking game immersion.


SPAWN_ON_SPIKES - Set to true if you want corpses to be allowed to spawn on top of blocks that deal damage over time to anything on top of them (log spikes, barbed wire, wooden spikes etc). Bear in mind that if these blocks are destroyed from attrition of zombies running into them, the corpse on top of them will fall and be destroyed.


The following video is a performance test that I decided to record as a simple demo. Note that this mod's code is not called until the game tries to position corpses, the rather notable lag before that point, is from the vanilla game (and it has me sorely tempted to crack out a profiler, but that's a mod for another time).




I designed this mod with compatibility in mind, but as I'm still enjoying the vanilla game, I haven't done much testing with other mods. In general, it should be compatible with mods that add new zombie types, as long as they still inherit from the EntityZombie base class, that all vanilla zombies inherit from. It should also work with mods that add new types of blocks, as all of the block scanning logic is based on general properties, nothing was referenced by name or ID.


Note that this is an SDX mod, so it will need to be installed with one of the available SDX tools.


Github repo for the mod is here: https://github.com/ghost314/Corpse-Disintigration-Fix


Use the 'release' tab to grab the latest stable version.


The terms of use for this mod are based on the Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/ or send a letter to Creative Commons, PO Box 1866, Mountain View, CA 94042, USA.



You are free to:

Share — copy and redistribute the material in any medium or format

Adapt — remix, transform, and build upon the material for any purpose, even commercially.


Under the following terms:

Attribution — You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.


No additional restrictions — You may not apply legal terms or technological measures that legally restrict others from doing anything the license permits.

Link to comment
Share on other sites

  • 1 month later...

I've never tried running a server on this game, so I'm not entirely sure. My method for playing with the mod has been to run the SDX tool, and set the 'mods' folder to point to the parent folder of the place where I cloned the github repo. I then use the SDX tool to build the game with my mod, and run.


I'm very new to modding, so I'm not sure if there's an easier way for me to package the mod for others to use. Maybe a more veteran modder can chime in.

Link to comment
Share on other sites


This topic is now archived and is closed to further replies.

  • Create New...