/obj/structure/girder icon = 'icons/obj/structures/girder.dmi' icon_state = "girder" anchored = TRUE density = TRUE plane = TURF_PLANE w_class = WEIGHT_CLASS_HUGE integrity = 200 integrity_max = 200 depth_level = 24 depth_projected = TRUE var/state = 0 var/current_damage = 0 var/cover = 50 //how much cover the girder provides against projectiles. var/reinforcing = 0 var/material_color = 1 material_parts = MATERIAL_DEFAULT_ABSTRACTED material_primary = "base" /// what we're made out of var/datum/prototype/material/material_structure = /datum/prototype/material/steel /// what our reinforcement is made out of var/datum/prototype/material/material_reinforcing /obj/structure/girder/Initialize(mapload, material, reinforcement) if(!isnull(material)) material_structure = material if(!isnull(reinforcement)) material_reinforcing = reinforcement . = ..() update_appearance() /obj/structure/girder/update_material_multi(list/parts) if(isnull(material_reinforcing)) if(isnull(material_structure)) name = initial(name) set_multiplied_integrity(1) else name = "[material_structure.display_name] girder" set_multiplied_integrity(material_structure.relative_integrity) else if(isnull(material_structure)) name = initial(name) set_multiplied_integrity(1) else name = "[material_reinforcing.display_name]-reinforced [material_structure.display_name] girder" // ()'s to coerce them into instances, and not text strings. set_multiplied_integrity(SSmaterials.dynamic_calculate_relative_integrity(list( (material_structure) = 1, (material_reinforcing) = 0.5, ))) // todo: refactor if(material_color) color = material_structure.icon_colour /obj/structure/girder/material_init_parts() material_structure = RSmaterials.fetch(material_structure) material_reinforcing = RSmaterials.fetch(material_reinforcing) register_material(material_structure, TRUE) register_material(material_reinforcing, FALSE) /obj/structure/girder/material_set_part(part, datum/prototype/material/material) var/datum/prototype/material/old switch(part) if("base") old = material_structure material_structure = material if("reinf") old = material_reinforcing material_reinforcing = material if(material != old) unregister_material(old, FALSE) register_material(material, FALSE) /obj/structure/girder/material_get_part(part) switch(part) if("reinf") return material_reinforcing if("base") return material_structure /obj/structure/girder/material_get_parts() return list( "base" = material_structure, "reinf" = material_reinforcing, ) /obj/structure/girder/material_set_part(part, datum/prototype/material/material) var/datum/prototype/material/old switch(part) if("base") old = material_structure material_structure = material if("reinf") old = material_reinforcing material_reinforcing = material else CRASH("invalid part") unregister_material(old, part == "base") register_material(material, part == "base") /obj/structure/girder/update_icon_state() if(anchored) icon_state = initial(icon_state) else icon_state = "displaced" return ..() /obj/structure/girder/displaced icon_state = "displaced" anchored = 0 cover = 25 /obj/structure/girder/displaced/Initialize(mapload, material_key) . = ..() displace() /obj/structure/girder/proc/displace() name = "displaced [material_structure.display_name] [initial(name)]" icon_state = "displaced" anchored = 0 cover = 25 /obj/structure/girder/proc/reset_girder() name = "[material_structure.display_name] [initial(name)]" anchored = 1 cover = initial(cover) state = 0 icon_state = initial(icon_state) reinforcing = 0 /obj/structure/girder/attackby(obj/item/I, mob/user, list/params, clickchain_flags, damage_multiplier) if(I.is_wrench() && state == 0) if(anchored && !material_reinforcing) playsound(src, I.tool_sound, 100, 1) to_chat(user, "Now disassembling the girder...") if(do_after(user,(2 SECONDS * round(integrity/100)) * I.tool_speed)) if(!src) return to_chat(user, "You dissasembled the girder!") deconstruct(ATOM_DECONSTRUCT_DISASSEMBLED) else if(!anchored) playsound(src, I.tool_sound, 100, 1) to_chat(user, "Now securing the girder...") if(do_after(user, 40 * I.tool_speed, src)) to_chat(user, "You secured the girder!") reset_girder() else if(istype(I, /obj/item/pickaxe/plasmacutter)) to_chat(user, "Now slicing apart the girder...") if(do_after(user,30 * I.tool_speed)) if(!src) return to_chat(user, "You slice apart the girder!") deconstruct(ATOM_DECONSTRUCT_DISASSEMBLED) else if(istype(I, /obj/item/pickaxe/diamonddrill)) to_chat(user, "You drill through the girder!") deconstruct(ATOM_DECONSTRUCT_DESTROYED) else if(I.is_screwdriver()) if(state == 2) playsound(src, I.tool_sound, 100, 1) to_chat(user, "Now unsecuring support struts...") if(do_after(user,40 * I.tool_speed)) if(!src) return to_chat(user, "You unsecured the support struts!") state = 1 else if(anchored && !material_reinforcing) playsound(src, I.tool_sound, 100, 1) reinforcing = !reinforcing to_chat(user, "\The [src] can now be [reinforcing? "reinforced" : "constructed"]!") else if(I.is_wirecutter() && state == 1) playsound(src, I.tool_sound, 100, 1) to_chat(user, "Now removing support struts...") if(do_after(user,40 * I.tool_speed)) if(!src) return to_chat(user, "You removed the support struts!") material_reinforcing.place_dismantled_product(get_turf(src), 2) set_material_part("reinf", null) reset_girder() else if(I.is_crowbar() && state == 0 && anchored) playsound(src, I.tool_sound, 100, 1) to_chat(user, "Now dislodging the girder...") if(do_after(user, 40 * I.tool_speed)) if(!src) return to_chat(user, "You dislodged the girder!") displace() else if(istype(I, /obj/item/stack/material)) if(reinforcing && !material_reinforcing) if(!reinforce_with_material(I, user)) return ..() else if(!construct_wall(I, user)) return ..() else return ..() /obj/structure/girder/proc/construct_wall(obj/item/stack/material/S, mob/user) var/amount_to_use = material_reinforcing ? 1 : 2 if(S.get_amount() < amount_to_use) to_chat(user, "There isn't enough material here to construct a wall.") return 0 var/datum/prototype/material/M = S.material if(!istype(M)) return 0 var/wall_fake add_hiddenprint(usr) to_chat(user, "You begin adding the plating...") if(!do_after(user,40) || !S.use(amount_to_use)) return 1 //once we've gotten this far don't call parent attackby() if(anchored) to_chat(user, "You added the plating!") else to_chat(user, "You create a false wall! Push on it to open or close the passage.") wall_fake = 1 var/turf/Tsrc = get_turf(src) Tsrc.PlaceOnTop(/turf/simulated/wall) var/turf/simulated/wall/T = get_turf(src) T.set_materials(M, material_reinforcing, material_structure) if(wall_fake) T.can_open = 1 T.add_hiddenprint(usr) qdel(src) return 1 /obj/structure/girder/proc/reinforce_with_material(obj/item/stack/material/S, mob/user) //if the verb is removed this can be renamed. if(!isnull(material_reinforcing)) to_chat(user, "\The [src] is already reinforced.") return 0 if(S.get_amount() < 1) to_chat(user, "There isn't enough material here to reinforce the girder.") return 0 var/datum/prototype/material/M = S.material to_chat(user, "Now reinforcing...") if (!do_after(user,40) || !S.use(1)) return 1 //don't call parent attackby() past this point to_chat(user, "You added reinforcement!") set_material_part("reinf", M) return 1 /obj/structure/girder/drop_products(method, atom/where) . = ..() material_structure.place_dismantled_product(where, 2) if(material_reinforcing) material_reinforcing.place_dismantled_product(where, 1) /obj/structure/girder/rcd_values(mob/living/user, obj/item/rcd/the_rcd, passed_mode) var/turf/simulated/T = get_turf(src) if(!istype(T) || T.density) return FALSE switch(passed_mode) if(RCD_FLOORWALL) // Finishing a wall costs two sheets. var/cost = RCD_SHEETS_PER_MATTER_UNIT * 2 // Rwalls cost three to finish. if(the_rcd.make_rwalls) cost += RCD_SHEETS_PER_MATTER_UNIT * 1 return list( RCD_VALUE_MODE = RCD_FLOORWALL, RCD_VALUE_DELAY = 2 SECONDS, RCD_VALUE_COST = cost ) if(RCD_DECONSTRUCT) return list( RCD_VALUE_MODE = RCD_DECONSTRUCT, RCD_VALUE_DELAY = 2 SECONDS, RCD_VALUE_COST = RCD_SHEETS_PER_MATTER_UNIT * 5 ) return FALSE /obj/structure/girder/rcd_act(mob/living/user, obj/item/rcd/the_rcd, passed_mode) var/turf/simulated/T = get_turf(src) if(!istype(T) || T.density) // Should stop future bugs of people bringing girders to centcom and RCDing them, or somehow putting a girder on a durasteel wall and deconning it. return FALSE switch(passed_mode) if(RCD_FLOORWALL) to_chat(user, SPAN_NOTICE("You finish a wall.")) // This is mostly the same as using on a floor. The girder's material is preserved, however. T.PlaceOnTop(/turf/simulated/wall) var/turf/simulated/wall/new_T = get_turf(src) // Ref to the wall we just built. // Apparently set_material(...) for walls requires refs to the material singletons and not strings. // This is different from how other material objects with their own set_material(...) do it, but whatever. var/datum/prototype/material/M = get_material_by_name(the_rcd.material_to_use) new_T.set_materials(M, the_rcd.make_rwalls ? material_reinforcing || M : material_reinforcing, material_structure) new_T.add_hiddenprint(user) qdel(src) return TRUE if(RCD_DECONSTRUCT) to_chat(user, SPAN_NOTICE("You deconstruct \the [src].")) qdel(src) return TRUE /obj/structure/girder/cult name = "column" icon= 'icons/obj/cult.dmi' icon_state= "cultgirder" cover = 70 material_color = 0 material_structure = /datum/prototype/material/cult /obj/structure/girder/cult/update_icon_state() . = ..() if(anchored) icon_state = "cultgirder" else icon_state = "displaced" /obj/structure/girder/cult/drop_products(method, atom/where) . = ..() new /obj/effect/decal/remains/human(where) /obj/structure/girder/cult/attackby(obj/item/W as obj, mob/user as mob) if(W.is_wrench()) playsound(src, W.tool_sound, 100, 1) to_chat(user, "Now disassembling the girder...") if(do_after(user,40 * W.tool_speed)) to_chat(user, "You dissasembled the girder!") deconstruct(ATOM_DECONSTRUCT_DISASSEMBLED) else if(istype(W, /obj/item/pickaxe/plasmacutter)) to_chat(user, "Now slicing apart the girder...") if(do_after(user,30 * W.tool_speed)) to_chat(user, "You slice apart the girder!") deconstruct(ATOM_DECONSTRUCT_DISASSEMBLED) else if(istype(W, /obj/item/pickaxe/diamonddrill)) to_chat(user, "You drill through the girder!") new /obj/effect/decal/remains/human(get_turf(src)) deconstruct(ATOM_DECONSTRUCT_DISASSEMBLED) /obj/structure/girder/resin name = "soft girder" icon_state = "girder_resin" cover = 60 material_structure = /datum/prototype/material/resin