mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-08-23 05:07:51 +01:00
better gargoyle code
This commit is contained in:
@@ -17,6 +17,10 @@
|
||||
var/stored_examine
|
||||
var/identifier = "statue"
|
||||
var/material = "stone"
|
||||
var/adjective = "hardens"
|
||||
var/list/tail_lower_dirs = list(SOUTH, EAST, WEST)
|
||||
var/image/tail_image
|
||||
var/tail_alt = TAIL_UPPER_LAYER
|
||||
|
||||
/obj/structure/gargoyle/Initialize(mapload, var/mob/living/carbon/human/H)
|
||||
. = ..()
|
||||
@@ -25,54 +29,64 @@
|
||||
if (!istype(H) || !isturf(H.loc))
|
||||
return
|
||||
var/datum/component/gargoyle/comp = H.GetComponent(/datum/component/gargoyle)
|
||||
var/tint = rgb(255,255,255)
|
||||
var/tint = "#FFFFFF"
|
||||
if (comp)
|
||||
comp.cooldown = world.time + (15 SECONDS)
|
||||
comp.statue = src
|
||||
comp.transformed = TRUE
|
||||
comp.paused = FALSE
|
||||
identifier = comp.identifier
|
||||
material = comp.material
|
||||
tint = comp.tint
|
||||
identifier = length(comp.identifier) > 0 ? comp.identifier : initial(identifier)
|
||||
material = length(comp.material) > 0 ? comp.material : initial(material)
|
||||
tint = length(comp.tint) > 0 ? comp.tint : initial(tint)
|
||||
adjective = length(comp.adjective) > 0 ? comp.adjective : initial(adjective)
|
||||
if (copytext_char(adjective, -1) != "s")
|
||||
adjective += "s"
|
||||
gargoyle = H
|
||||
|
||||
if (H.tail_style?.clip_mask_state)
|
||||
tail_lower_dirs.Cut()
|
||||
else if (H.tail_style)
|
||||
tail_lower_dirs = H.tail_style.lower_layer_dirs.Copy()
|
||||
tail_alt = H.tail_alt ? TAIL_UPPER_LAYER_ALT : TAIL_UPPER_LAYER
|
||||
|
||||
max_integrity = H.getMaxHealth() + 100
|
||||
obj_integrity = H.health + 100
|
||||
original_int = obj_integrity
|
||||
name = "[identifier] of [H.name]"
|
||||
desc = "A very lifelike [identifier]."
|
||||
desc = "A very lifelike [identifier] made of [material]."
|
||||
stored_examine = H.examine()
|
||||
description_fluff = H.get_description_fluff()
|
||||
|
||||
if (H.buckled)
|
||||
H.buckled.unbuckle_mob(H, TRUE)
|
||||
icon = H.icon
|
||||
copy_overlays(H)
|
||||
//icon = H.icon
|
||||
//copy_overlays(H)
|
||||
|
||||
//calculate our tints
|
||||
var/list/RGB = rgb2num(tint)
|
||||
|
||||
var/list/RGB = list( hex2num( "[tint[2]][tint[3]]" ),
|
||||
hex2num( "[tint[4]][tint[5]]" ),
|
||||
hex2num( "[tint[6]][tint[7]]" )
|
||||
)
|
||||
var/colorr = rgb(RGB[1]*0.299, RGB[2]*0.299, RGB[3]*0.299)
|
||||
var/colorg = rgb(RGB[1]*0.587, RGB[2]*0.587, RGB[3]*0.587)
|
||||
var/colorb = rgb(RGB[1]*0.114, RGB[2]*0.114, RGB[3]*0.114)
|
||||
|
||||
var/colora = rgb( RGB[1]*0.299,
|
||||
RGB[2]*0.299,
|
||||
RGB[3]*0.299
|
||||
)
|
||||
|
||||
var/colorb = rgb( RGB[1]*0.587,
|
||||
RGB[2]*0.587,
|
||||
RGB[3]*0.587
|
||||
)
|
||||
|
||||
var/colorc = rgb( RGB[1]*0.114,
|
||||
RGB[2]*0.114,
|
||||
RGB[3]*0.114
|
||||
)
|
||||
|
||||
color = list( colora, colorb , colorc, rgb(0,0,0))
|
||||
var/tint_color = list(colorr, colorg, colorb, "#000000")
|
||||
|
||||
var/list/body_layers = HUMAN_BODY_LAYERS
|
||||
var/list/other_layers = HUMAN_OTHER_LAYERS
|
||||
for (var/i = 1; i <= length(H.overlays_standing); i++)
|
||||
if (i in other_layers)
|
||||
continue
|
||||
if (istype(H.overlays_standing[i], /image) && (i in body_layers))
|
||||
var/image/old_image = H.overlays_standing[i]
|
||||
var/image/new_image = image(old_image)
|
||||
if (i == TAIL_LOWER_LAYER || i == TAIL_UPPER_LAYER || i == TAIL_UPPER_LAYER_ALT)
|
||||
tail_image = new_image
|
||||
new_image.color = tint_color
|
||||
new_image.layer = old_image.layer
|
||||
add_overlay(new_image)
|
||||
else
|
||||
if (!isnull(H.overlays_standing[i]))
|
||||
add_overlay(H.overlays_standing[i])
|
||||
|
||||
initial_sleep = H.sleeping
|
||||
initial_blind = H.eye_blind
|
||||
@@ -92,7 +106,7 @@
|
||||
flapping = H.flapping
|
||||
H.toggle_tail(FALSE, FALSE)
|
||||
H.toggle_wing(FALSE, FALSE)
|
||||
H.visible_message("<span class='warning'>[H]'s skin rapidly turns to [material]!</span>", "<span class='warning'>Your skin abruptly [comp.adjective] as you turn to [material]!</span>")
|
||||
H.visible_message("<span class='warning'>[H]'s skin rapidly [adjective] as they turn to [material]!</span>", "<span class='warning'>Your skin abruptly [adjective] as you turn to [material]!</span>")
|
||||
H.forceMove(src)
|
||||
H.SetBlinded(0)
|
||||
H.SetSleeping(0)
|
||||
@@ -122,7 +136,7 @@
|
||||
. += stored_examine
|
||||
return
|
||||
|
||||
/obj/structure/gargoyle/proc/unpetrify()
|
||||
/obj/structure/gargoyle/proc/unpetrify(var/deal_damage = TRUE)
|
||||
if (!gargoyle)
|
||||
return
|
||||
var/datum/component/gargoyle/comp = gargoyle.GetComponent(/datum/component/gargoyle)
|
||||
@@ -130,16 +144,17 @@
|
||||
comp.cooldown = world.time + (15 SECONDS)
|
||||
comp.statue = null
|
||||
comp.transformed = FALSE
|
||||
gargoyle.forceMove(loc)
|
||||
gargoyle.transform = transform
|
||||
gargoyle.pixel_x = pixel_x
|
||||
gargoyle.pixel_y = pixel_y
|
||||
gargoyle.is_shifted = initial_is_shifted
|
||||
gargoyle.dir = dir
|
||||
gargoyle.lying = initial_lying
|
||||
gargoyle.lying_prev = initial_lying_prev
|
||||
gargoyle.toggle_tail(wagging, FALSE)
|
||||
gargoyle.toggle_wing(flapping, FALSE)
|
||||
if (gargoyle.loc == src)
|
||||
gargoyle.forceMove(loc)
|
||||
gargoyle.transform = transform
|
||||
gargoyle.pixel_x = pixel_x
|
||||
gargoyle.pixel_y = pixel_y
|
||||
gargoyle.is_shifted = initial_is_shifted
|
||||
gargoyle.dir = dir
|
||||
gargoyle.lying = initial_lying
|
||||
gargoyle.lying_prev = initial_lying_prev
|
||||
gargoyle.toggle_tail(wagging, FALSE)
|
||||
gargoyle.toggle_wing(flapping, FALSE)
|
||||
gargoyle.sdisabilities &= ~MUTE //why is there no ADD_TRAIT etc here that's actually ussssed
|
||||
gargoyle.status_flags &= ~GODMODE
|
||||
gargoyle.SetBlinded(initial_blind)
|
||||
@@ -148,11 +163,12 @@
|
||||
gargoyle.canmove = 1
|
||||
gargoyle.update_canmove()
|
||||
var/hurtmessage = ""
|
||||
if (obj_integrity < original_int)
|
||||
var/f = (original_int - obj_integrity) / 10
|
||||
for (var/x in 1 to 10)
|
||||
gargoyle.adjustBruteLoss(f)
|
||||
hurtmessage = " <b>You feel your body take the damage that was dealt while being [material]!</b>"
|
||||
if (deal_damage)
|
||||
if (obj_integrity < original_int)
|
||||
var/f = (original_int - obj_integrity) / 10
|
||||
for (var/x in 1 to 10)
|
||||
gargoyle.adjustBruteLoss(f)
|
||||
hurtmessage = " <b>You feel your body take the damage that was dealt while being [material]!</b>"
|
||||
gargoyle.updatehealth()
|
||||
alpha = 0
|
||||
gargoyle.visible_message("<span class='warning'>[gargoyle]'s skin rapidly reverts, returning them to normal!</span>", "<span class='warning'>Your skin reverts, freeing your movement once more![hurtmessage]</span>")
|
||||
@@ -197,4 +213,11 @@
|
||||
playsound(src, W.hitsound, 50, 1)
|
||||
damage(W.force)
|
||||
else
|
||||
return ..()
|
||||
return ..()
|
||||
|
||||
/obj/structure/gargoyle/set_dir(var/new_dir)
|
||||
. = ..()
|
||||
if(. && tail_image)
|
||||
cut_overlay(tail_image)
|
||||
tail_image.layer = (dir in tail_lower_dirs) ? TAIL_LOWER_LAYER : tail_alt
|
||||
add_overlay(tail_image)
|
||||
|
||||
Reference in New Issue
Block a user