Files
Bubberstation/code/game/objects/structures/signs.dm
phil235 5f835bfc26 Obj damaging system, acid damage, and fire damage refactor (WIP) (#20793)
Please refer to #20867 and #20870 for a easier view of the changes. Those two PRs show all meaningful changes (hopefully) and doesn't show the files changed with just 3 lines changed.

This PR does three things:

    It makes all children of /obj/ use the same damage system.
    Previously to make your new machine/structure be destroyable you needed to give it a var/health, and its own version of many damage related proc such as bullet_act(), take_damage(), attacked_by(), attack_animal(), attack_hulk(), ex_act(), etc... But now, all /obj/ use the same version of those procs at the /obj/ level in code/game/obj_defense.dm. All these obj share the same necessary vars: obj_integrity (health), max_integrity, integrity_failure (optional, below that health level failure happens), and the armor list var which was previously only for items, as well as the resistance_flags bitfield. When you want your new object to be destroyable, you only have to give it a value for those vars and maybe override one proc if you want a special behavior but that's it. This reorganization removes a lot of copypasta (most bullet_act() version for each obj were nearly identical). Two new elements are added to the armor list var: fire and acid armor values.
    How much damage an obj take depends on the armor value for each damage category. But some objects are INDESTRUCTIBLE and simply never take any damage no matter the type.
    The armor categories are:
    -melee(punches, item attacks, xeno/animal/hulk attacks, blob attacks, thrown weapons)
    -bullet
    -laser
    -energy (used by projectiles like ionrifle, taser, and also by EMPs)
    -bio (unused for this, only here because clothes use them when worn)
    -rad (same)
    -bomb (self-explanatory)
    -fire (for fire damage, not for heat damage though)
    -acid
    For machines and structures, when their health reaches zero the object is not just deleted but gets somewhat forcedeconstructed (the proc used is shared with the actual deconstruction system) which can drops things. To not frustrates players most of these objects drop most of the elements necessary to rebuild them (think window dropping shards). Machines drop a machine frame and all components for example (but the frame can then be itself smashed to pieces).
    For clothes, when they are damaged, they get a "damaged" overlay, which can also be seen when worn, similar to the "bloody" overlay.

    It refactors acid. See #20537.
    Some objects are ACID_PROOF and take no damage from acid, while others take varying amounts
    of damage depending on their acid armor value. Some objects are even UNACIDABLE, no acid effect can even land on them. Acid on objects can be washed off using water.

    It changes some aspect of damage from fires.
    All /obj/ can now take fire damage and be flammable, instead of just items. And instead of having just FLAMMABLE objs that become ON_FIRE as soon as some fire touch them (paper), we now have objects that are non flammable but do take damage from fire and become ashes if their health reaches zero (only for items). The damage taken varies depending on the obj's fire armor value and total health. There's also still obj and items that are FIRE_PROOF (although some might still be melted by lava if they're not LAVA_PROOF).
    When a mob is on fire, its clothes now take fire damage and can turn to ashes. Similarly, when a mob takes melee damages, its clothes gets damaged a bit and can turn to shreds. You can repair clothes with cloth that is produceable by botany's biogenerator.

    It also does many minor things:
        Clicking a structure/machine with an item on help intent never results in an attack (so you don't destroy a structure while trying to figure out which tool to use).
        I moved a lot of objects away from /obj/effect, it should only be used for visual effects, decals and stuff, not for things you can hit and destroy.
        I tweaked a bit how clothes shredding from bombs work.
        I made a machine or structure un/anchorable with the wrench, I don't remember which object...
        Since I changed the meaning of the FIRE_PROOF bitflag to actually mean fire immune, I'm buffing the slime extract that you apply on items to make them fire proof. well now they're really 100% fire proof!
        animals with environment_smash = 1 no longer one-hit destroy tables and stuff, we give them a decent obj_damage value so they can destroy most obj relatively fast depending on the animal.
        Probably a million things I forgot.

If you want to know how the damage system works all you need is the three obj vars "obj_integrity", "max_integrity", "integrity_failure", as well as the armor list var and the resistance_flags bitfield, and read the file obj_defense.dm
2016-10-10 11:14:59 +13:00

269 lines
9.8 KiB
Plaintext

/obj/structure/sign
icon = 'icons/obj/decals.dmi'
anchored = 1
opacity = 0
density = 0
layer = SIGN_LAYER
obj_integrity = 100
max_integrity = 100
armor = list(melee = 50, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 50, acid = 50)
/obj/structure/sign/basic
name = "blank sign"
desc = "How can signs be real if our eyes aren't real?"
icon_state = "backing"
/obj/structure/sign/play_attack_sound(damage_amount, damage_type = BRUTE, damage_flag = 0)
switch(damage_type)
if(BRUTE)
if(damage_amount)
playsound(src.loc, 'sound/weapons/slash.ogg', 80, 1)
else
playsound(loc, 'sound/weapons/tap.ogg', 50, 1)
if(BURN)
playsound(loc, 'sound/items/welder.ogg', 80, 1)
/obj/structure/sign/attackby(obj/item/O, mob/user, params)
if(istype(O, /obj/item/weapon/wrench))
user.visible_message("<span class='notice'>[user] starts removing [src]...</span>", \
"<span class='notice'>You start unfastening [src].</span>")
playsound(src, 'sound/items/Ratchet.ogg', 50, 1)
if(!do_after(user, 30/O.toolspeed, target = src))
return
playsound(src, 'sound/items/Deconstruct.ogg', 50, 1)
user.visible_message("<span class='notice'>[user] unfastens [src].</span>", \
"<span class='notice'>You unfasten [src].</span>")
var/obj/item/sign_backing/SB = new (get_turf(user))
SB.icon_state = icon_state
SB.sign_path = type
qdel(src)
else if(istype(O, /obj/item/weapon/pen))
var/list/sign_types = list("Secure Area", "Biohazard", "High Voltage", "Radiation", "Hard Vacuum Ahead", "Disposal: Leads To Space", "Danger: Fire", "No Smoking", "Medbay", "Science", "Chemistry", \
"Hydroponics", "Xenobiology")
var/obj/structure/sign/sign_type
switch(input(user, "Select a sign type.", "Sign Customization") as null|anything in sign_types)
if("Blank")
sign_type = /obj/structure/sign/basic
if("Secure Area")
sign_type = /obj/structure/sign/securearea
if("Biohazard")
sign_type = /obj/structure/sign/biohazard
if("High Voltage")
sign_type = /obj/structure/sign/electricshock
if("Radiation")
sign_type = /obj/structure/sign/radiation
if("Hard Vacuum Ahead")
sign_type = /obj/structure/sign/vacuum
if("Disposal: Leads To Space")
sign_type = /obj/structure/sign/deathsposal
if("Danger: Fire")
sign_type = /obj/structure/sign/fire
if("No Smoking")
sign_type = /obj/structure/sign/nosmoking_1
if("Medbay")
sign_type = /obj/structure/sign/bluecross_2
if("Science")
sign_type = /obj/structure/sign/science
if("Chemistry")
sign_type = /obj/structure/sign/chemistry
if("Hydroponics")
sign_type = /obj/structure/sign/botany
if("Xenobiology")
sign_type = /obj/structure/sign/xenobio
//Make sure user is adjacent still
if(!Adjacent(user))
return
if(!sign_type)
return
//It's import to clone the pixel layout information
//Otherwise signs revert to being on the turf and
//move jarringly
var/obj/structure/sign/newsign = new sign_type(get_turf(src))
newsign.pixel_x = pixel_x
newsign.pixel_y = pixel_y
qdel(src)
else
return ..()
/obj/item/sign_backing
name = "sign backing"
desc = "A sign with adhesive backing."
icon = 'icons/obj/decals.dmi'
icon_state = "backing"
w_class = 3
resistance_flags = FLAMMABLE
var/sign_path = /obj/structure/sign/basic //the type of sign that will be created when placed on a turf
/obj/item/sign_backing/afterattack(atom/target, mob/user, proximity)
if(isturf(target) && proximity)
var/turf/T = target
user.visible_message("<span class='notice'>[user] fastens [src] to [T].</span>", \
"<span class='notice'>You attach a blank sign to [T].</span>")
playsound(T, 'sound/items/Deconstruct.ogg', 50, 1)
new sign_path(T)
user.drop_item()
qdel(src)
else
return ..()
/obj/structure/sign/map
name = "station map"
desc = "A framed picture of the station."
obj_integrity = 500
max_integrity = 500
/obj/structure/sign/map/left
icon_state = "map-left"
/obj/structure/sign/map/left/dream
icon_state = "map-left-DS"
desc = "A framed picture of the station.\nClockwise from the top, you see Engineering(<b>yellow</b>), Arrivals(<b>blue and white</b>), Atmospherics(<b>yellow</b>), Security(<b>red</b>), \
Cargo(<b>brown</b>), Science(<b>purple</b>), Escape(<b>red and white</b>), and Medbay(<b>blue</b>).\nIn the center of the station, you see the Bridge(<b>dark blue</b>).\n\
Around those, you see Hallways/Entrances(<b>light grey</b>), Public Areas(<b>grey</b>), and Maintenance(<b>dark grey</b>)."
/obj/structure/sign/map/right
icon_state = "map-right"
/obj/structure/sign/map/right/dream
icon_state = "map-right-DS"
desc = "A framed picture of the station.\nClockwise from the top, you see Engineering(<b>yellow</b>), Arrivals(<b>blue and white</b>), Atmospherics(<b>yellow</b>), Security(<b>red</b>), \
Cargo(<b>brown</b>), Science(<b>purple</b>), Escape(<b>red and white</b>), and Medbay(<b>blue</b>).\nIn the center of the station, you see the Bridge(<b>dark blue</b>).\n\
Around those, you see Hallways/Entrances(<b>light grey</b>), Public Areas(<b>grey</b>), and Maintenance(<b>dark grey</b>)."
/obj/structure/sign/securearea
name = "\improper SECURE AREA"
desc = "A warning sign which reads 'SECURE AREA'."
icon_state = "securearea"
/obj/structure/sign/biohazard
name = "\improper BIOHAZARD"
desc = "A warning sign which reads 'BIOHAZARD'"
icon_state = "bio"
/obj/structure/sign/electricshock
name = "\improper HIGH VOLTAGE"
desc = "A warning sign which reads 'HIGH VOLTAGE'"
icon_state = "shock"
/obj/structure/sign/examroom
name = "\improper EXAM ROOM"
desc = "A guidance sign which reads 'EXAM ROOM'"
icon_state = "examroom"
/obj/structure/sign/vacuum
name = "\improper HARD VACUUM AHEAD"
desc = "A warning sign which reads 'HARD VACUUM AHEAD'"
icon_state = "space"
/obj/structure/sign/deathsposal
name = "\improper DISPOSAL: LEADS TO SPACE"
desc = "A warning sign which reads 'DISPOSAL: LEADS TO SPACE'"
icon_state = "deathsposal"
/obj/structure/sign/pods
name = "\improper ESCAPE PODS"
desc = "A warning sign which reads 'ESCAPE PODS'"
icon_state = "pods"
/obj/structure/sign/fire
name = "\improper DANGER: FIRE"
desc = "A warning sign which reads 'DANGER: FIRE'"
icon_state = "fire"
/obj/structure/sign/nosmoking_1
name = "\improper NO SMOKING"
desc = "A warning sign which reads 'NO SMOKING'"
icon_state = "nosmoking"
/obj/structure/sign/nosmoking_2
name = "\improper NO SMOKING"
desc = "A warning sign which reads 'NO SMOKING'"
icon_state = "nosmoking2"
/obj/structure/sign/radiation
name = "HAZARDOUS RADIATION"
desc = "A warning sign alerting the user of potential radiation hazards."
icon_state = "radiation"
/obj/structure/sign/bluecross
name = "medbay"
desc = "The Intergalactic symbol of Medical institutions. You'll probably get help here."
icon_state = "bluecross"
/obj/structure/sign/bluecross_2
name = "medbay"
desc = "The Intergalactic symbol of Medical institutions. You'll probably get help here."
icon_state = "bluecross2"
/obj/structure/sign/goldenplaque
name = "The Most Robust Men Award for Robustness"
desc = "To be Robust is not an action or a way of life, but a mental state. Only those with the force of Will strong enough to act during a crisis, saving friend from foe, are truly Robust. Stay Robust my friends."
icon_state = "goldenplaque"
/obj/structure/sign/kiddieplaque
name = "AI developers plaque"
desc = "Next to the extremely long list of names and job titles, there is a drawing of a little child. The child appears to be retarded. Beneath the image, someone has scratched the word \"PACKETS\""
icon_state = "kiddieplaque"
/obj/structure/sign/atmosplaque
name = "\improper FEA Atmospherics Division plaque"
desc = "This plaque commemorates the fall of the Atmos FEA division. For all the charred, dizzy, and brittle men who have died in its hands."
icon_state = "atmosplaque"
/obj/structure/sign/nanotrasen
name = "\improper NanoTrasen Logo "
desc = "A sign with the Nanotrasen Logo on it. Glory to Nanotrasen!"
icon_state = "nanotrasen"
/obj/structure/sign/science //These 3 have multiple types, just var-edit the icon_state to whatever one you want on the map
name = "\improper SCIENCE"
desc = "A sign labelling an area where research and science is performed."
icon_state = "science1"
/obj/structure/sign/chemistry
name = "\improper CHEMISTRY"
desc = "A sign labelling an area containing chemical equipment."
icon_state = "chemistry1"
/obj/structure/sign/botany
name = "\improper HYDROPONICS"
desc = "A sign labelling an area as a place where plants are grown."
icon_state = "hydro1"
/obj/structure/sign/xenobio
name = "\improper XENOBIOLOGY"
desc = "A sign labelling an area as a place where xenobiological entities are researched."
icon_state = "xenobio"
/obj/structure/sign/directions/science
name = "science department"
desc = "A direction sign, pointing out which way the Science department is."
icon_state = "direction_sci"
/obj/structure/sign/directions/engineering
name = "engineering department"
desc = "A direction sign, pointing out which way the Engineering department is."
icon_state = "direction_eng"
/obj/structure/sign/directions/security
name = "security department"
desc = "A direction sign, pointing out which way the Security department is."
icon_state = "direction_sec"
/obj/structure/sign/directions/medical
name = "medical bay"
desc = "A direction sign, pointing out which way the Medical Bay is."
icon_state = "direction_med"
/obj/structure/sign/directions/evac
name = "escape arm"
desc = "A direction sign, pointing out which way the escape shuttle dock is."
icon_state = "direction_evac"