diff --git a/code/datums/components/evolutionary_leap.dm b/code/datums/components/evolutionary_leap.dm index 3a47dbbdcf0..c9176f4b39f 100644 --- a/code/datums/components/evolutionary_leap.dm +++ b/code/datums/components/evolutionary_leap.dm @@ -23,9 +23,9 @@ RegisterSignal(SSticker, COMSIG_TICKER_ROUND_STARTING, PROC_REF(comp_on_round_start)) return - //if the round has already taken long enough, just leap right away. + //if the round has already taken long enough, evolve in three seconds. if((world.time - SSticker.round_start_time) > evolve_mark) - leap(silent = TRUE) + addtimer(CALLBACK(src, PROC_REF(leap)), 3 SECONDS, TIMER_DELETE_ME) return setup_timer() @@ -49,12 +49,11 @@ var/mark = evolve_mark - sum timer_id = addtimer(CALLBACK(src, PROC_REF(leap), FALSE), mark, TIMER_STOPPABLE) -/datum/component/evolutionary_leap/proc/leap(silent) +/datum/component/evolutionary_leap/proc/leap() var/mob/living/old_mob = parent if (old_mob.stat == DEAD) return var/mob/living/new_mob = evolve_path var/new_mob_name = initial(new_mob.name) - if(!silent) - old_mob.visible_message(span_warning("[old_mob] evolves into \a [new_mob_name]!")) + old_mob.visible_message(span_warning("[old_mob] evolves into \a [new_mob_name]!")) old_mob.change_mob_type(evolve_path, old_mob.loc, new_name = new_mob_name, delete_old_mob = TRUE) diff --git a/code/modules/clothing/belts/polymorph_belt.dm b/code/modules/clothing/belts/polymorph_belt.dm index 07740888a9a..4177a24b28b 100644 --- a/code/modules/clothing/belts/polymorph_belt.dm +++ b/code/modules/clothing/belts/polymorph_belt.dm @@ -115,6 +115,7 @@ spell_requirements = NONE possible_shapes = list(/mob/living/basic/cockroach) can_be_shared = FALSE + shapechange_type = /datum/status_effect/shapechange_mob/from_spell/polymorph_belt /// Amount of time it takes us to transform back or forth var/channel_time = 3 SECONDS @@ -172,3 +173,22 @@ var/mob/living/will_become = transform_type desc = "Assume your [initial(will_become.name)] form!" build_all_button_icons(update_flags = UPDATE_BUTTON_NAME) + +/// Subtype of the polymorph status effect which tracks arbitrary mob transformation +/datum/status_effect/shapechange_mob/from_spell/polymorph_belt + +/datum/status_effect/shapechange_mob/from_spell/polymorph_belt/on_apply() + . = ..() + RegisterSignal(owner, COMSIG_MOB_CHANGED_TYPE, PROC_REF(on_type_change)) + +/datum/status_effect/shapechange_mob/from_spell/polymorph_belt/on_pre_type_change(mob/living/source) + return // Stub out base effect because we don't want to cancel if they transform + +/// If our mob transforms (via aging usually) then move the status effect across to the new mob +/datum/status_effect/shapechange_mob/from_spell/polymorph_belt/proc/on_type_change(mob/living/source, mob/living/new_mob) + SIGNAL_HANDLER + var/caster = caster_mob // Will be unset when the mob is unshifted + var/datum/action/cooldown/spell/shapeshift/transform_action = source_weakref?.resolve() + transform_action.possible_shapes |= new_mob.type + restore_caster() + new_mob.apply_status_effect(type, caster, transform_action) diff --git a/code/modules/spells/spell_types/shapeshift/_shapeshift.dm b/code/modules/spells/spell_types/shapeshift/_shapeshift.dm index 205b6f49f80..06b04198e6b 100644 --- a/code/modules/spells/spell_types/shapeshift/_shapeshift.dm +++ b/code/modules/spells/spell_types/shapeshift/_shapeshift.dm @@ -29,6 +29,9 @@ /// This should be implemented even if there is only one choice. var/list/atom/possible_shapes + /// The shapechange status effect to apply to our mob, it should be a subtype of this if you change it + var/shapechange_type = /datum/status_effect/shapechange_mob/from_spell + /datum/action/cooldown/spell/shapeshift/Remove(mob/remove_from) unshift_owner() return ..() @@ -146,7 +149,7 @@ /// Actually does the shapeshift, for the caster. /datum/action/cooldown/spell/shapeshift/proc/do_shapeshift(mob/living/caster) var/mob/living/new_shape = create_shapeshift_mob(caster.loc) - var/datum/status_effect/shapechange_mob/shapechange = new_shape.apply_status_effect(/datum/status_effect/shapechange_mob/from_spell, caster, src) + var/datum/status_effect/shapechange_mob/shapechange = new_shape.apply_status_effect(shapechange_type, caster, src) if(!shapechange) // We failed to shift, maybe because we were already shapeshifted? // Whatver the case, this shouldn't happen, so throw a stack trace. @@ -169,7 +172,7 @@ /// Actually does the un-shapeshift, from the caster. (Caster is a shapeshifted mob.) /datum/action/cooldown/spell/shapeshift/proc/do_unshapeshift(mob/living/caster) - var/datum/status_effect/shapechange_mob/shapechange = caster.has_status_effect(/datum/status_effect/shapechange_mob/from_spell) + var/datum/status_effect/shapechange_mob/shapechange = caster.has_status_effect(shapechange_type) if(!shapechange) // We made it to do_unshapeshift without having a shapeshift status effect, this shouldn't happen. to_chat(caster, span_warning("You can't un-shapeshift from this form!")) @@ -181,7 +184,7 @@ pre_shift_requirements = null var/mob/living/unshapeshifted_mob = shapechange.caster_mob - caster.remove_status_effect(/datum/status_effect/shapechange_mob/from_spell) + caster.remove_status_effect(shapechange_type) return unshapeshifted_mob /// Helper proc that instantiates the mob we shapeshift into.