mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-01-29 02:21:44 +00:00
## About The Pull Request This takes all the gib related procs: - `gib()` - `spawn_gibs()` - `spill_organs()` - `spread_bodyparts()` And adds heavy documentation that communicates what the procs are used for and how the different bitflags affect them. The difference is noticeable: `gib(TRUE, FALSE, FALSE, null)` vs `gib(DROP_ORGANS|DROP_BODYPARTS)` The code is now much more legible which is important considering it's used in a lot of places! Another robust change, is that we had several places in the code where there were double negatives like so: ``` /mob/living/carbon/spill_organs(no_brain, no_organs, no_bodyparts) if(!no_bodyparts) // DOUBLE NEGATIVES ARE BAD M'KAY?!? // do stuff here ``` This is a mindfuck to untangle. I inverted a lot of these parts so we don't lose our sanity. Last thing that was changed was a big `if()` loop in the `spill_organ()` proc. This was refactored to just be a simple `for` loop with `continue` statements where we needed to skip enabled bitflags. It's now shorter and cleaner than before. The only slight gameplay change this affects is that gibbing a mob now guarantees to drop all items unless the `DROP_ITEMS` bitflag is deliberately omitted. Some places like admin gib self, we don't want this to happen. ## Why It's Good For The Game Gib code is very old. (~15 years) People kept adding more arguments to the procs when it should have been a bitflag initially. By doing it this way, there is more flexibility and readability when it comes to adding new code in the future. ## Changelog 🆑 refactor: Refactor gib code to be more robust. qol: Gibbing a mob will result in all items being dropped instead of getting deleted. There are a few exceptions (like admin gib self) where this will not take place. /🆑
33 lines
870 B
Plaintext
33 lines
870 B
Plaintext
#define BSA_CHANCE_TO_BREAK_TILE_TO_PLATING 80
|
|
#define BSA_MAX_DAMAGE 99
|
|
#define BSA_PARALYZE_TIME (40 SECONDS)
|
|
#define BSA_STUTTER_TIME (40 SECONDS)
|
|
|
|
/// Fires the BSA at the target
|
|
/datum/smite/bsa
|
|
name = "Bluespace Artillery Device"
|
|
|
|
/datum/smite/bsa/effect(client/user, mob/living/target)
|
|
. = ..()
|
|
|
|
explosion(target.loc, explosion_cause = src)
|
|
|
|
var/turf/open/floor/target_turf = get_turf(target)
|
|
if (istype(target_turf))
|
|
if (prob(BSA_CHANCE_TO_BREAK_TILE_TO_PLATING))
|
|
target_turf.break_tile_to_plating()
|
|
else
|
|
target_turf.break_tile()
|
|
|
|
if (target.health <= 1)
|
|
target.gib(DROP_BODYPARTS)
|
|
else
|
|
target.adjustBruteLoss(min(BSA_MAX_DAMAGE, target.health - 1))
|
|
target.Paralyze(BSA_PARALYZE_TIME)
|
|
target.set_stutter(BSA_STUTTER_TIME)
|
|
|
|
#undef BSA_CHANCE_TO_BREAK_TILE_TO_PLATING
|
|
#undef BSA_MAX_DAMAGE
|
|
#undef BSA_PARALYZE_TIME
|
|
#undef BSA_STUTTER_TIME
|