mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-31 09:00:25 +01:00
Adds an universal object health system. (#21266)
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>
This commit is contained in:
co-authored by
Matt Atlas
SleepyGemmy
parent
1d2871729f
commit
d5931c5ffe
@@ -16,6 +16,9 @@
|
||||
icon_state = "filingcabinet"
|
||||
density = 1
|
||||
anchored = 1
|
||||
maxhealth = OBJECT_HEALTH_VERY_LOW
|
||||
armor = list(MELEE = ARMOR_MELEE_SMALL, BULLET = ARMOR_BALLISTIC_MINOR)
|
||||
|
||||
var/static/list/accepted_items = list(
|
||||
/obj/item/paper,
|
||||
/obj/item/folder,
|
||||
@@ -46,14 +49,12 @@
|
||||
/obj/structure/filingcabinet/filingcabinet //not changing the path to avoid unecessary map issues, but please don't name stuff like this in the future -Pete
|
||||
icon_state = "tallcabinet"
|
||||
|
||||
|
||||
/obj/structure/filingcabinet/Initialize()
|
||||
. = ..()
|
||||
for(var/obj/item/I in loc)
|
||||
if(is_type_in_list(I, accepted_items))
|
||||
I.forceMove(src)
|
||||
|
||||
|
||||
/obj/structure/filingcabinet/attackby(obj/item/attacking_item, mob/user)
|
||||
if(is_type_in_list(attacking_item, accepted_items))
|
||||
to_chat(user, SPAN_NOTICE("You put [attacking_item] in [src]."))
|
||||
@@ -70,6 +71,15 @@
|
||||
else
|
||||
to_chat(user, SPAN_NOTICE("You can't put [attacking_item] in [src]!"))
|
||||
|
||||
/obj/structure/filingcabinet/on_death(damage, damage_flags, damage_type, armor_penetration, obj/weapon)
|
||||
for(var/obj/item/thing in src)
|
||||
if(prob(25))
|
||||
if(istype(thing, /obj/item/paper))
|
||||
if(prob(50))
|
||||
var/obj/item/paper/paper = thing
|
||||
paper.crumple()
|
||||
thing.forceMove(get_turf(src))
|
||||
. = ..()
|
||||
|
||||
/obj/structure/filingcabinet/attack_hand(mob/user as mob)
|
||||
if(contents.len <= 0)
|
||||
@@ -83,8 +93,6 @@
|
||||
dat += "</table></center>"
|
||||
user << browse("<html><head><title>[name]</title></head><body>[dat]</body></html>", "window=filingcabinet;size=350x300")
|
||||
|
||||
return
|
||||
|
||||
/obj/structure/filingcabinet/Topic(href, href_list)
|
||||
if(href_list["retrieve"])
|
||||
usr << browse("", "window=filingcabinet") // Close the menu)
|
||||
|
||||
@@ -188,15 +188,7 @@
|
||||
user.show_message(SPAN_WARNING("\The [src] is already crumpled."))
|
||||
return
|
||||
//crumple dat paper
|
||||
info = stars(info,85)
|
||||
user.visible_message("\The [user] crumples \the [src] into a ball!", "You crumple \the [src] into a ball.")
|
||||
playsound(src, 'sound/items/bureaucracy/papercrumple.ogg', 50, 1)
|
||||
if(istype(src, /obj/item/paper/stickynotes))
|
||||
icon_state = "stickynote_scrap"
|
||||
else
|
||||
icon_state = "scrap"
|
||||
throw_range = 4 //you can now make epic paper ball hoops into the disposals (kinda dumb that you could only throw crumpled paper 1 tile) -wezzy
|
||||
crumpled = TRUE
|
||||
crumple(user)
|
||||
return
|
||||
|
||||
if (user.a_intent == I_GRAB && !crumpled && can_fold)
|
||||
@@ -244,6 +236,17 @@
|
||||
playsound(src.loc, 'sound/items/bikehorn.ogg', 50, 1)
|
||||
src.add_fingerprint(user)
|
||||
|
||||
/**
|
||||
* Turns a paper into a crumpled ball. Only prints a message and makes a sound if user is present.
|
||||
*/
|
||||
/obj/item/paper/proc/crumple(mob/user)
|
||||
info = stars(info,85)
|
||||
if(user)
|
||||
user.visible_message("\The [user] crumples \the [src] into a ball!", "You crumple \the [src] into a ball.")
|
||||
playsound(src, 'sound/items/bureaucracy/papercrumple.ogg', 50, 1)
|
||||
icon_state = "scrap"
|
||||
throw_range = 4
|
||||
|
||||
/obj/item/paper/attack_ai(var/mob/living/silicon/ai/user)
|
||||
show_content(user)
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
icon_state = "papershredder0"
|
||||
density = 1
|
||||
anchored = 1
|
||||
maxhealth = OBJECT_HEALTH_LOW
|
||||
var/max_paper = 10
|
||||
var/paperamount = 0
|
||||
var/list/shred_amounts = list(
|
||||
|
||||
@@ -7,6 +7,9 @@
|
||||
idle_power_usage = 30
|
||||
active_power_usage = 200
|
||||
power_channel = AREA_USAGE_EQUIP
|
||||
maxhealth = OBJECT_HEALTH_VERY_LOW
|
||||
armor = list(MELEE = ARMOR_MELEE_SMALL, BULLET = ARMOR_BALLISTIC_MINOR)
|
||||
|
||||
/// Item to copy.
|
||||
var/obj/item/copy_item
|
||||
/// How much toner is left.
|
||||
@@ -132,7 +135,7 @@
|
||||
attacking_item.play_tool_sound(get_turf(src), 50)
|
||||
anchored = !anchored
|
||||
to_chat(user, SPAN_NOTICE("You [anchored ? "wrench" : "unwrench"] \the [src]."))
|
||||
return
|
||||
return ..()
|
||||
|
||||
/proc/copy_type(var/obj/machinery/target, var/c_item, var/toner, var/do_print = TRUE, var/mob/user) // helper proc to reduce ctrl+c ctrl+v
|
||||
if (istype(c_item, /obj/item/paper))
|
||||
|
||||
Reference in New Issue
Block a user