Merge branch 'master' into dullahan-2-electric-boogaloo

This commit is contained in:
timothyteakettle
2022-08-11 14:43:48 +01:00
138 changed files with 2006 additions and 306 deletions
+47
View File
@@ -0,0 +1,47 @@
/**
* A simple component that spawns a mob of the same type and transfers itself to it when parent dies.
* For more complex behaviors, use the COMSIG_ON_MULTIPLE_LIVES_RESPAWN comsig.
*/
/datum/component/multiple_lives
can_transfer = TRUE
dupe_mode = COMPONENT_DUPE_UNIQUE_PASSARGS
/// The number of respawns the living mob has left.
var/lives_left
/datum/component/multiple_lives/Initialize(lives_left)
if(!isliving(parent))
return COMPONENT_INCOMPATIBLE
src.lives_left = lives_left
/datum/component/multiple_lives/RegisterWithParent()
RegisterSignal(parent, COMSIG_MOB_DEATH, .proc/respawn)
RegisterSignal(parent, COMSIG_PARENT_EXAMINE, .proc/on_examine)
/datum/component/multiple_lives/UnregisterFromParent()
UnregisterSignal(parent, list(COMSIG_MOB_DEATH, COMSIG_PARENT_EXAMINE))
/datum/component/multiple_lives/proc/respawn(mob/living/source, gibbed)
SIGNAL_HANDLER
if(source.suiciding) //Freed from this mortail coil.
qdel(src)
return
var/mob/living/respawned_mob = new source.type (source.drop_location())
source.mind?.transfer_to(respawned_mob)
lives_left--
if(lives_left <= 0)
qdel(src)
source.TransferComponents(respawned_mob)
SEND_SIGNAL(source, COMSIG_ON_MULTIPLE_LIVES_RESPAWN, respawned_mob, gibbed, lives_left)
/datum/component/multiple_lives/proc/on_examine(mob/living/source, mob/user, list/examine_list)
SIGNAL_HANDLER
if(isobserver(user) || source == user)
examine_list += "[source.p_theyve(TRUE)] [lives_left] extra lives left."
/datum/component/multiple_lives/InheritComponent(datum/component/multiple_lives/new_comp , lives_left)
src.lives_left += new_comp ? new_comp.lives_left : lives_left
/datum/component/multiple_lives/PostTransfer()
if(!isliving(parent))
return COMPONENT_INCOMPATIBLE
+5 -3
View File
@@ -82,12 +82,14 @@
var/move_delay = 2
var/last_move = 0
/datum/component/twitch_plays/simple_movement/auto/Initialize(...)
/datum/component/twitch_plays/simple_movement/auto/Initialize(move_delay)
if(!ismovable(parent))
return COMPONENT_INCOMPATIBLE
. = ..()
if(. & COMPONENT_INCOMPATIBLE)
return
if(!isnull(move_delay))
src.move_delay = move_delay
START_PROCESSING(SSfastprocess, src)
/datum/component/twitch_plays/simple_movement/auto/Destroy(force, silent)
@@ -95,10 +97,10 @@
return ..()
/datum/component/twitch_plays/simple_movement/auto/process()
if(world.time < (last_move + move_delay))
return
var/dir = fetch_data(null, TRUE)
if(!dir)
return
if(world.time < (last_move + move_delay))
return
last_move = world.time
step(parent, dir)