/obj/structure/barricade/plasteel name = "plasteel barricade" desc = "A very sturdy barricade made out of plasteel panels, the pinnacle of strongpoints." icon_state = "plasteel_closed_0" health = 800 maxhealth = 800 force_level_absorption = 20 stack_type = /obj/item/stack/material/plasteel build_amt = 8 stack_amount = 8 destroyed_stack_amount = 4 barricade_hitsound = 'sound/effects/metalhit.ogg' barricade_type = "plasteel" density = 0 closed = TRUE can_wire = TRUE /// Look at __game.dm for barricade defines var/build_state = BARRICADE_BSTATE_SECURED /// Delay to apply tools to prevent spamming var/tool_cooldown = 0 /// Standard busy check var/busy = 0 var/linked = 0 var/recentlyflipped = FALSE var/hasconnectionoverlay = TRUE var/linkable = TRUE /obj/structure/barricade/plasteel/update_icon() ..() if(linked) for(var/direction in GLOB.cardinals) for(var/obj/structure/barricade/plasteel/cade in get_step(src, direction)) if(((dir & (NORTH|SOUTH) && get_dir(src, cade) & (EAST|WEST)) || (dir & (EAST|WEST) && get_dir(src, cade) & (NORTH|SOUTH))) && dir == cade.dir && cade.linked && cade.closed == src.closed && hasconnectionoverlay) if(closed) overlays += image('icons/obj/barricades.dmi', icon_state = "[src.barricade_type]_closed_connection_[get_dir(src, cade)]") else overlays += image('icons/obj/barricades.dmi', icon_state = "[src.barricade_type]_connection_[get_dir(src, cade)]") continue /obj/structure/barricade/plasteel/handle_barrier_chance(mob/living/M) if(!closed) // Closed = gate down for plasteel for some reason return ..() else return 0 /obj/structure/barricade/plasteel/mechanics_hints(mob/user, distance, is_adjacent) . += ..() . += "Use this with an empty active hand to toggle it closed or open." . += "Multiple plasteel barricades aligned in a row can be linked together by using a crowbar on adjacent ones sequentially." // Duplicated in /obj/structure/barricade/metal. If you change one, also change the other. /obj/structure/barricade/plasteel/assembly_hints(mob/user, distance, is_adjacent) . += ..() . += "Damage (up to a point) can be repaired with a welding torch." switch(build_state) if(BARRICADE_BSTATE_MOVABLE) . += "The barricade is ready to have its anchor bolts tightened." if(BARRICADE_BSTATE_UNSECURED) . += "The protection panel is ready to be screwed into place." // Duplicated in /obj/structure/barricade/metal. If you change one, also change the other. /obj/structure/barricade/plasteel/disassembly_hints(mob/user, distance, is_adjacent) . += ..() switch(build_state) if(BARRICADE_BSTATE_SECURED) . += "The protection panel is still tighly screwed in place." if(BARRICADE_BSTATE_UNSECURED) . += "The protection panel has been removed, you can see the anchor bolts." if(BARRICADE_BSTATE_MOVABLE) . += "The protection panel has been removed and the anchor bolts loosened. It's ready to be pried apart." /obj/structure/barricade/plasteel/weld_cade(obj/item/W, mob/user) busy = TRUE ..() busy = FALSE /obj/structure/barricade/plasteel/attackby(obj/item/attacking_item, mob/user) if(attacking_item.tool_behaviour == TOOL_WELDER) if(busy || tool_cooldown > world.time) return tool_cooldown = world.time + 10 var/obj/item/weldingtool/WT = attacking_item if(damage_state == BARRICADE_DMG_HEAVY) to_chat(user, SPAN_WARNING("[src] has sustained too much structural damage to be repaired.")) return if(health == maxhealth) to_chat(user, SPAN_WARNING("[src] doesn't need repairs.")) return weld_cade(WT, user) return switch(build_state) if(2) //Fully constructed step. Use screwdriver to remove the protection panels to reveal the bolts if(attacking_item.tool_behaviour == TOOL_SCREWDRIVER) if(busy || tool_cooldown > world.time) return tool_cooldown = world.time + 10 for(var/obj/structure/barricade/B in loc) if(B != src && B.dir == dir) to_chat(user, SPAN_WARNING("There's already a barricade here.")) return if(!attacking_item.use_tool(src, user, 10, volume = 50)) return user.visible_message(SPAN_NOTICE("[user] removes [src]'s protection panel."), SPAN_NOTICE("You remove [src]'s protection panels, exposing the anchor bolts.")) build_state = BARRICADE_BSTATE_UNSECURED return if(attacking_item.tool_behaviour == TOOL_CROWBAR) playsound(src.loc, 'sound/items/crowbar_pry.ogg', 25, 1) if(linked) user.visible_message(SPAN_NOTICE("[user] removes the linking on [src]."), SPAN_NOTICE("You remove the linking on [src].")) else if(linkable) user.visible_message(SPAN_NOTICE("[user] sets up [src] for linking."), SPAN_NOTICE("You set up [src] for linking.")) else to_chat(user, SPAN_WARNING("The [src] has no linking points.")) return linked = !linked for(var/direction in GLOB.cardinals) for(var/obj/structure/barricade/plasteel/cade in get_step(src, direction)) cade.update_icon() update_icon() if(1) //Protection panel removed step. Screwdriver to put the panel back, wrench to unsecure the anchor bolts if(attacking_item.tool_behaviour == TOOL_SCREWDRIVER) if(busy || tool_cooldown > world.time) return tool_cooldown = world.time + 10 if(!attacking_item.use_tool(src, user, 10, volume = 50)) return user.visible_message(SPAN_NOTICE("[user] set [src]'s protection panel back."), SPAN_NOTICE("You set [src]'s protection panel back.")) build_state = BARRICADE_BSTATE_SECURED return if(attacking_item.tool_behaviour == TOOL_WRENCH) if(busy || tool_cooldown > world.time) return if(!attacking_item.use_tool(src, user, 10, volume = 50)) return user.visible_message(SPAN_NOTICE("[user] loosens [src]'s anchor bolts."), SPAN_NOTICE("You loosen [src]'s anchor bolts.")) anchored = FALSE build_state = BARRICADE_BSTATE_MOVABLE update_icon() //unanchored changes layer return if(0) //Anchor bolts loosened step. Apply crowbar to unseat the panel and take apart the whole thing. Apply wrench to rescure anchor bolts if(attacking_item.tool_behaviour == TOOL_WRENCH) if(busy || tool_cooldown > world.time) return tool_cooldown = world.time + 10 var/turf/T = loc if(!(istype(T)) || istype(T, /turf/space)) to_chat(user, SPAN_WARNING("[src] must be secured on a proper surface!")) return if(!attacking_item.use_tool(src, user, 10, volume = 50)) return user.visible_message(SPAN_NOTICE("[user] secures [src]'s anchor bolts."), SPAN_NOTICE("You secure [src]'s anchor bolts.")) anchored = TRUE build_state = BARRICADE_BSTATE_UNSECURED update_icon() //unanchored changes layer return if(attacking_item.tool_behaviour == TOOL_CROWBAR) if(busy || tool_cooldown > world.time) return tool_cooldown = world.time + 10 user.visible_message(SPAN_NOTICE("[user] starts unseating [src]'s panels."), SPAN_NOTICE("You start unseating [src]'s panels.")) playsound(src.loc, 'sound/items/crowbar_pry.ogg', 25, 1) busy = 1 if(attacking_item.use_tool(src, user, 8 SECONDS, volume = 50)) busy = 0 user.visible_message(SPAN_NOTICE("[user] takes [src]'s panels apart."), SPAN_NOTICE("You take [src]'s panels apart.")) playsound(loc, 'sound/items/Deconstruct.ogg', 25, 1) barricade_deconstruct(TRUE) //Note : Handles deconstruction too ! else busy = 0 return . = ..() /obj/structure/barricade/plasteel/attack_hand(mob/user as mob) // For preventing cyborgs from flipping barricades remotely. if(get_dist(src, user) > 1) return FALSE if(closed) if(recentlyflipped) to_chat(user, SPAN_NOTICE("\The [src] has been flipped too recently!")) return user.visible_message(SPAN_NOTICE("[user] flips [src] open."), SPAN_NOTICE("You flip [src] open.")) open(src) recentlyflipped = TRUE addtimer(CALLBACK(src, PROC_REF(remove_cooldown)), 1 SECOND) else if(recentlyflipped) to_chat(user, SPAN_NOTICE("\The [src] has been flipped too recently!")) return user.visible_message(SPAN_NOTICE("[user] flips [src] closed."), SPAN_NOTICE("You flip [src] closed.")) close(src) recentlyflipped = TRUE addtimer(CALLBACK(src, PROC_REF(remove_cooldown)), 1 SECOND) /obj/structure/barricade/plasteel/proc/remove_cooldown() recentlyflipped = !recentlyflipped /obj/structure/barricade/plasteel/proc/open(var/obj/structure/barricade/plasteel/origin) if(!closed) return playsound(src.loc, 'sound/items/wrench.ogg', 25, 1) closed = 0 density = 1 if(linked) for(var/direction in GLOB.cardinals) for(var/obj/structure/barricade/plasteel/cade in get_step(src, direction)) if(((dir & (NORTH|SOUTH) && get_dir(src, cade) & (EAST|WEST)) || (dir & (EAST|WEST) && get_dir(src, cade) & (NORTH|SOUTH))) && dir == cade.dir && cade != origin && cade.linked) cade.open(src) update_icon() /obj/structure/barricade/plasteel/proc/close(var/obj/structure/barricade/plasteel/origin) if(closed) return playsound(src.loc, 'sound/items/wrench.ogg', 25, 1) closed = 1 density = 0 if(linked) for(var/direction in GLOB.cardinals) for(var/obj/structure/barricade/plasteel/cade in get_step(src, direction)) if(((dir & (NORTH|SOUTH) && get_dir(src, cade) & (EAST|WEST)) || (dir & (EAST|WEST) && get_dir(src, cade) & (NORTH|SOUTH))) && dir == cade.dir && cade != origin && cade.linked) cade.close(src) update_icon() /obj/structure/barricade/plasteel/wired/New() can_wire = FALSE is_wired = TRUE climbable = FALSE update_icon() . = ..()