[MIRROR] cleanup the corpse file, cleanup stationstuck component, adds stationstuck to the reanimated skeleton (and zombie, why not) (#403)

* cleanup the corpse file, cleanup stationstuck component, adds stationstuck to the reanimated skeleton (and zombie, why not) (#52940)

all living spawners in corpse.dm are now in ghost_role_spawners. I hate having to search two different files to HOPEFULLY find which ghost role I need to edit.

Added a disclaimer about giving guidance or at least stationstuck component to stuff so this doesn't happen again

Cleaned up stationstuck. Man, I know I made this, but damn I did kind of a shit job

* cleanup the corpse file, cleanup stationstuck component, adds stationstuck to the reanimated skeleton (and zombie, why not)

Co-authored-by: tralezab <40974010+tralezab@users.noreply.github.com>
This commit is contained in:
SkyratBot
2020-08-19 04:46:47 +02:00
committed by GitHub
co-authored by tralezab
parent 49aad36da4
commit f424b7853e
4 changed files with 215 additions and 187 deletions
+38 -16
View File
@@ -1,38 +1,60 @@
#define PUNISHMENT_MURDER "murder"
#define PUNISHMENT_GIB "gib"
#define PUNISHMENT_TELEPORT "teleport"
//very similar to stationloving, but more made for mobs and not objects. used on derelict drones currently
/*
This component is similar to stationloving in that it is meant to keep something on the z-level
The difference is that stationloving is for objects and stationstuck is for mobs.
It has a punishment variable that is what happens to the parent when they leave the z-level. See punish() documentation
*/
/datum/component/stationstuck
dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS
var/murder = TRUE //teleports if not
var/punishment = PUNISHMENT_GIB //see defines above
var/stuck_zlevel
var/message = ""
/datum/component/stationstuck/Initialize(_murder = TRUE, _message = "")
/datum/component/stationstuck/Initialize(_punishment = PUNISHMENT_GIB, _message = "")
if(!isliving(parent))
return COMPONENT_INCOMPATIBLE
var/mob/living/L = parent
RegisterSignal(L, list(COMSIG_MOVABLE_Z_CHANGED), .proc/punish)
murder = _murder
punishment = _punishment
message = _message
stuck_zlevel = L.z
/datum/component/stationstuck/InheritComponent(datum/component/stationstuck/newc, original, _murder, _message)
/datum/component/stationstuck/InheritComponent(datum/component/stationstuck/newc, original, _punishment, _message)
if(newc)
murder = newc.murder
punishment = newc.punishment
message = newc.message
else
murder = _murder
punishment = _punishment
message = _message
/**
* Called when parent leaves the zlevel this is set to (aka whichever zlevel it was on when it was added)
* Sends a message, then does an effect depending on what the punishment was.
*
* Punishments:
* * PUNISHMENT_MURDER: kills parent
* * PUNISHMENT_GIB: gibs parent
* * PUNISHMENT_TELEPORT: finds a safe turf if possible, or a completely random one if not.
*/
/datum/component/stationstuck/proc/punish()
var/mob/living/L = parent
if(message)
var/span = murder ? "userdanger" : "danger"
var/span = punishment == PUNISHMENT_TELEPORT ? "danger" : "userdanger"
to_chat(L, "<span class='[span]'>[message]</span>")
if(murder)
L.gib()
return
var/targetturf = find_safe_turf(stuck_zlevel)
if(!targetturf)
targetturf = locate(world.maxx/2,world.maxy/2,stuck_zlevel)
L.forceMove(targetturf)
return targetturf
switch(punishment)
if(PUNISHMENT_MURDER)
L.death()
if(PUNISHMENT_GIB)
L.gib()
if(PUNISHMENT_TELEPORT)
var/targetturf = find_safe_turf(stuck_zlevel)
if(!targetturf)
targetturf = locate(world.maxx/2,world.maxy/2,stuck_zlevel)
L.forceMove(targetturf)