Adds event/shenanigans vareditable shapeshifter mechanic (#6902)

This commit is contained in:
Verkister
2023-09-03 18:48:48 +03:00
committed by GitHub
parent 540b86c4f4
commit 8557df23f5
3 changed files with 60 additions and 6 deletions

View File

@@ -302,6 +302,10 @@
if((direct & (direct - 1)) && mob.loc == n)
my_mob.setMoveCooldown(total_delay * SQRT_2) //CHOMPEDIT
if(!isliving(my_mob)) //CHOMPAdd
moving = 0
return
// If we have a grab
var/list/grablist = my_mob.ret_grab()
if(LAZYLEN(grablist))

View File

@@ -98,6 +98,9 @@
var/datum/ai_holder/our_AI = ourmob.ai_holder
our_AI.set_stance(STANCE_IDLE)
M.tf_mob_holder = null
var/ourmob_ckey //CHOMPEdit Start
if(ourmob.ckey)
ourmob_ckey = ourmob.ckey
ourmob.ckey = M.ckey
var/turf/get_dat_turf = get_turf(target)
ourmob.loc = get_dat_turf
@@ -118,7 +121,13 @@
continue
M.drop_from_inventory(W)
qdel(target)
if(M.tf_form == ourmob)
if(ourmob_ckey)
M.ckey = ourmob_ckey
ourmob.tf_form = M
M.forceMove(ourmob)
else
qdel(target) //CHOMPEdit End
return
else
if(M.stat == DEAD) //We can let it undo the TF, because the person will be dead, but otherwise things get weird.
@@ -186,6 +195,9 @@
var/datum/ai_holder/our_AI = ourmob.ai_holder
our_AI.set_stance(STANCE_IDLE)
tf_mob_holder = null
var/ourmob_ckey //CHOMPEdit Start
if(ourmob.ckey)
ourmob_ckey = ourmob.ckey
ourmob.ckey = ckey
var/turf/get_dat_turf = get_turf(src)
ourmob.loc = get_dat_turf
@@ -207,7 +219,13 @@
continue
src.drop_from_inventory(W)
qdel(src)
if(tf_form == ourmob)
if(ourmob_ckey)
src.ckey = ourmob_ckey
ourmob.tf_form = src
src.forceMove(ourmob)
else
qdel(src) //CHOMPEdit End
/mob/living/proc/handle_tf_holder()
@@ -309,6 +327,9 @@
var/datum/ai_holder/our_AI = ourmob.ai_holder
our_AI.set_stance(STANCE_IDLE)
M.tf_mob_holder = null
var/ourmob_ckey //CHOMPEdit Start
if(ourmob.ckey)
ourmob_ckey = ourmob.ckey
ourmob.ckey = M.ckey
var/turf/get_dat_turf = get_turf(target)
ourmob.loc = get_dat_turf
@@ -330,7 +351,13 @@
continue
M.drop_from_inventory(W)
qdel(target)
if(M.tf_form == ourmob)
if(ourmob_ckey)
M.ckey = ourmob_ckey
ourmob.tf_form = M
M.forceMove(ourmob)
else
qdel(target) //CHOMPEdit End
firer.visible_message("<span class='notice'>\The [shot_from] boops pleasantly.</span>")
return
else

View File

@@ -12,6 +12,7 @@
var/death_sound_override = null
var/virtual_reality_mob = FALSE // gross boolean for keeping VR mobs in VR
var/datum/looping_sound/mob/on_fire/firesoundloop
var/mob/living/tf_form // Shapeshifter shenanigans
// var/datum/looping_sound/mob/stunned/stunnedloop
/* // Not sure if needed, screams aren't a carbon thing rn.
var/scream_sound = null
@@ -92,7 +93,7 @@ Maybe later, gotta figure out a way to click yourself when in a locker etc.
// For some reason upstream made a general revert proc but not a general transform proc, so here it is.
// Requires a /mob/living type path for transformation. Returns the new mob on success, null in all other cases.
// Just handles mob TF right now, but maybe we'll want to do something similar for items in the future.
/mob/living/proc/transform_into_mob(mob/living/new_form, pref_override = FALSE, revert = FALSE)
/mob/living/proc/transform_into_mob(mob/living/new_form, pref_override = FALSE, revert = FALSE, shapeshifting = FALSE)
if(!src.mind)
return
if(!src.allow_spontaneous_tf && !pref_override)
@@ -106,9 +107,19 @@ Maybe later, gotta figure out a way to click yourself when in a locker etc.
else
if(src.stat == DEAD)
return
if(!ispath(new_form, /mob/living))
if(!ispath(new_form, /mob/living) && !ismob(new_form))
return
var/mob/living/new_mob = new new_form(get_turf(src))
var/mob/living/new_mob
var/new_mob_ckey
if(shapeshifting && src.tf_form)
new_mob = src.tf_form
new_mob.verbs |= /mob/living/proc/shapeshift_form
new_mob.tf_form = src
new_mob.forceMove(src.loc)
if(new_mob.ckey)
new_mob_ckey = new_mob.ckey
else
new_mob = new new_form(get_turf(src))
new_mob.faction = src.faction
if(new_mob && isliving(new_mob))
@@ -144,6 +155,8 @@ Maybe later, gotta figure out a way to click yourself when in a locker etc.
new_mob.vore_organs += B
new_mob.ckey = src.ckey
if(new_mob_ckey)
src.ckey = new_mob_ckey
if(src.ai_holder && new_mob.ai_holder)
var/datum/ai_holder/old_AI = src.ai_holder
old_AI.set_stance(STANCE_SLEEP)
@@ -154,3 +167,13 @@ Maybe later, gotta figure out a way to click yourself when in a locker etc.
src.forceMove(new_mob)
new_mob.tf_mob_holder = src
return new_mob
/mob/living/proc/shapeshift_form()
set name = "Shapeshift Form"
set category = "Abilities"
set desc = "Shape shift between set mob forms. (Requires a spawned mob to be varedited into the user's tf_form var as mob reference.)"
if(!istype(tf_form))
to_chat(src, "<span class='notice'>No shapeshift form set. (Requires a spawned mob to be varedited into the user's tf_form var as mob reference.)</span>")
return
else
transform_into_mob(tf_form, TRUE, TRUE, TRUE)