mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-30 01:02:57 +01:00
d5931c5ffe
https://www.youtube.com/watch?v=ZpUYjpKg9KY As per title. The goal is to add health to most objects in the game and thus allow them to be dynamically destructible, while also avoiding shitcode like each structure having its own snowflake health update proc. --------- Signed-off-by: Matt Atlas <mattiathebest2000@hotmail.it> Co-authored-by: Matt Atlas <liermattia@gmail.com> Co-authored-by: SleepyGemmy <99297919+SleepyGemmy@users.noreply.github.com>
81 lines
2.1 KiB
Plaintext
81 lines
2.1 KiB
Plaintext
/obj/structure/hadii_statue
|
|
name = "president Hadii statue"
|
|
desc = "A statue of the current president of the People's Republic of Adhomai, Njadrasanukii Hadii."
|
|
icon = 'icons/obj/hadii_statue.dmi'
|
|
icon_state = "bronze"
|
|
density = TRUE
|
|
anchored = TRUE
|
|
layer = ABOVE_HUMAN_LAYER
|
|
maxhealth = OBJECT_HEALTH_MEDIUM
|
|
var/toppled = FALSE
|
|
var/outside = FALSE
|
|
var/already_toppled = FALSE
|
|
var/toppling_sound = 'sound/effects/metalhit.ogg'
|
|
|
|
/obj/structure/hadii_statue/stone
|
|
icon_state = "stone"
|
|
toppling_sound = 'sound/effects/meteorimpact.ogg'
|
|
|
|
/obj/structure/hadii_statue/Initialize()
|
|
. = ..()
|
|
if(already_toppled)
|
|
topple()
|
|
|
|
/obj/structure/hadii_statue/update_icon()
|
|
ClearOverlays()
|
|
if(toppled)
|
|
icon_state = "[initial(icon_state)]_toppled"
|
|
return
|
|
if(outside)
|
|
AddOverlays("snow")
|
|
|
|
/obj/structure/hadii_statue/ex_act(severity)
|
|
switch(severity)
|
|
if(1.0)
|
|
qdel(src)
|
|
else
|
|
topple()
|
|
|
|
/obj/structure/hadii_statue/proc/topple()
|
|
if(toppled)
|
|
return
|
|
visible_message(SPAN_WARNING("\The [src] topples down!"))
|
|
playsound(src, toppling_sound, 75, 1)
|
|
toppled = TRUE
|
|
update_icon()
|
|
|
|
/obj/structure/hadii_statue/attackby(obj/item/attacking_item, mob/user)
|
|
if(toppled)
|
|
return
|
|
user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN)
|
|
user.do_attack_animation(src)
|
|
if(attacking_item.force <= 15)
|
|
visible_message(SPAN_WARNING("\The [attacking_item] bounces off \the [src]!"))
|
|
return
|
|
visible_message(SPAN_WARNING("\The [user] strikes \the [src] with \the [attacking_item]!"))
|
|
do_integrity_check(attacking_item.force)
|
|
|
|
/obj/structure/hadii_statue/proc/do_integrity_check(damage)
|
|
if(toppled)
|
|
return
|
|
if(damage)
|
|
health -= damage
|
|
if(health <= 0)
|
|
topple()
|
|
|
|
/obj/structure/hadii_statue/bullet_act(obj/projectile/hitting_projectile, def_zone, piercing_hit)
|
|
if(toppled)
|
|
return BULLET_ACT_BLOCK
|
|
if(!hitting_projectile)
|
|
return BULLET_ACT_BLOCK
|
|
if(!hitting_projectile.damage)
|
|
visible_message(SPAN_WARNING("\The [hitting_projectile] bounces off \the [src]!"))
|
|
return BULLET_ACT_BLOCK
|
|
|
|
. = ..()
|
|
if(. != BULLET_ACT_HIT)
|
|
return .
|
|
|
|
visible_message(SPAN_WARNING("\The [hitting_projectile] hits \the [src]!"))
|
|
do_integrity_check(hitting_projectile.damage)
|