Skip to content

Commit

Permalink
lisard ztretcher
Browse files Browse the repository at this point in the history
  • Loading branch information
MoonTheBird committed Nov 28, 2023
1 parent 30b6863 commit 38748f7
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 35 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -425,6 +425,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
#define TRAIT_FISH_CASE_COMPATIBILE "fish_case_compatibile"
/// Granted by prismwine
#define TRAIT_REFLECTIVE "reflective"
/// Granted by the Lizard Stretcher
#define TRAIT_STRETCHED "stretched"

/// Trait granted by [mob/living/silicon/ai]
/// Applied when the ai anchors itself
Expand Down
3 changes: 2 additions & 1 deletion code/_globalvars/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,8 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_HOLDABLE" = TRAIT_HOLDABLE,
"TRAIT_SCOOPABLE" = TRAIT_SCOOPABLE,
"TRAIT_ANXIOUS" = TRAIT_ANXIOUS,
"TRAIT_KISS_OF_DEATH" = TRAIT_KISS_OF_DEATH
"TRAIT_KISS_OF_DEATH" = TRAIT_KISS_OF_DEATH,
"TRAIT_STRETCHED" = TRAIT_STRETCHED

),
/obj/item/bodypart = list(
Expand Down
34 changes: 9 additions & 25 deletions code/datums/elements/squish.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#define SHORT 5/7
#define TALL 7/5
#define VERYSHORT 1/10
#define VERYTALL 10/1

/**
# squish.dm
Expand All @@ -13,45 +11,31 @@
/datum/element/squish
element_flags = ELEMENT_DETACH

/datum/element/squish/Attach(datum/target, duration=20 SECONDS, reverse=FALSE, very=FALSE, permanent=FALSE)
/datum/element/squish/Attach(datum/target, duration=20 SECONDS, reverse=FALSE, permanent=FALSE)
. = ..()
if(!iscarbon(target))
return ELEMENT_INCOMPATIBLE

var/mob/living/carbon/C = target
var/was_lying = C.body_position == LYING_DOWN
if(!permanent)
addtimer(CALLBACK(src, PROC_REF(Detach), C, was_lying, reverse, very), duration)
if(!very)
if(reverse)
C.transform = C.transform.Scale(SHORT, TALL)
else
C.transform = C.transform.Scale(TALL, SHORT)
addtimer(CALLBACK(src, PROC_REF(Detach), C, was_lying, reverse), duration)
if(reverse)
C.transform = C.transform.Scale(SHORT, TALL)
else
if(reverse)
C.transform = C.transform.Scale(VERYSHORT, VERYTALL)
else
C.transform = C.transform.Scale(VERYTALL, VERYSHORT)
C.transform = C.transform.Scale(TALL, SHORT)

/datum/element/squish/Detach(mob/living/carbon/C, was_lying, reverse, very)
/datum/element/squish/Detach(mob/living/carbon/C, was_lying, reverse)
. = ..()
if(istype(C))
var/is_lying = C.body_position == LYING_DOWN

if(reverse)
is_lying = !is_lying
if(!very)
if(was_lying == is_lying)
C.transform = C.transform.Scale(SHORT, TALL)
else
C.transform = C.transform.Scale(TALL, SHORT)
if(was_lying == is_lying)
C.transform = C.transform.Scale(SHORT, TALL)
else
if(was_lying == is_lying)
C.transform = C.transform.Scale(VERYSHORT, VERYTALL)
else
C.transform = C.transform.Scale(VERYTALL, VERYSHORT)
C.transform = C.transform.Scale(TALL, SHORT)

#undef SHORT
#undef TALL
#undef VERYSHORT
#undef VERYTALL
29 changes: 20 additions & 9 deletions code/game/machinery/lizard_stretcher.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,30 +3,38 @@
desc = "A device designed to stretch out Sarathi. Why? That's a good question."
icon = 'icons/obj/machines/lizard_stretcher.dmi'
icon_state = "lizstretchoff"
layer = BELOW_OBJ_LAYER
max_integrity = 200
integrity_failure = 0.33
armor = list("melee" = 20, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 0, "rad" = 0, "fire" = 50, "acid" = 70)
//circuit = /obj/item/circuitboard/machine/lizstretcher
var/active = 0

//obj/machinery/lizstretcher/examine(mob/user)
/obj/machinery/lizstretcher/examine(mob/user)
. = ..()
if(occupant)
. += "<span class='notice'>There's someone inside!</span>"
else
. += "<span class='notice'>It's currently off.</span>"

/obj/machinery/sleeper/Initialize(mapload)
. = ..()
occupant_typecache = GLOB.typecache_living

/obj/machinery/lizstretcher/open_machine()
if(occupant)
occupant.AddElement(/datum/element/squish, 0 SECONDS, TRUE, TRUE)
ADD_TRAIT(occupant, TRAIT_STRETCHED, "lizstretcher")
occupant.forceMove(get_turf(src))
if(isliving(occupant))
var/mob/living/carbon/C = occupant
C.AddElement(/datum/element/squish, 0 SECONDS, TRUE, TRUE, TRUE)
occupant = null

/obj/machinery/lizstretcher/MouseDrop_T(mob/target, mob/user)
if(HAS_TRAIT(user, TRAIT_UI_BLOCKED) || !Adjacent(user) || !user.Adjacent(target) || !user.IsAdvancedToolUser() || !islizard(target))
return
if(HAS_TRAIT(target, TRAIT_STRETCHED))
to_chat(target, "<span class='warning'>You've already been stretched, and don't plan on being stretched further!</span>")
if(user != target)
to_chat(user, "<span class='warning'>[target] refuses to go back in there!</span>")
return

close_machine(target)

Expand All @@ -36,7 +44,10 @@
var/mob/living/mob_occupant = occupant
if(mob_occupant && mob_occupant.stat != DEAD)
to_chat(occupant, "<span class='notice'><b>You begin to be stretched by the stretcher!</b></span>")

if(do_after(user, 10, target = src))
to_chat(occupant, "<span class='notice'><b>You emerge from the stretcher, much taller.</b></span>")
open_machine()
active = TRUE
icon_state = "lizstretchon"
if(do_after(user, 30, target = src))
to_chat(occupant, "<span class='notice'><b>You emerge from the stretcher, much taller.</b></span>")
open_machine()
active = FALSE
icon_state = "lizstretchoff"

0 comments on commit 38748f7

Please sign in to comment.