mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
* I like wood 😩 * Makes them faster to remove * 😩 * I hate molti Co-authored-by: Molti <108117184+Moltijoe@users.noreply.github.com> --------- Co-authored-by: Molti <108117184+Moltijoe@users.noreply.github.com>
218 lines
6.5 KiB
Plaintext
218 lines
6.5 KiB
Plaintext
#define SINGLE "single"
|
|
#define VERTICAL "vertical"
|
|
#define HORIZONTAL "horizontal"
|
|
|
|
#define METAL 1
|
|
#define WOOD 2
|
|
#define SAND 3
|
|
|
|
//Barricades/cover
|
|
|
|
/obj/structure/barricade
|
|
name = "chest high wall"
|
|
desc = "Looks like this would make good cover."
|
|
anchored = TRUE
|
|
density = TRUE
|
|
max_integrity = 100
|
|
layer = ABOVE_WINDOW_LAYER // Barricades should probably be over windows especially if you can put them on windows
|
|
var/proj_pass_rate = 50 //How many projectiles will pass the cover. Lower means stronger cover
|
|
var/bar_material = METAL
|
|
|
|
/obj/structure/barricade/deconstruct(disassembled = TRUE)
|
|
if(!(flags_1 & NODECONSTRUCT_1))
|
|
make_debris()
|
|
qdel(src)
|
|
|
|
/obj/structure/barricade/proc/make_debris()
|
|
return
|
|
|
|
/obj/structure/barricade/attackby(obj/item/I, mob/user, params)
|
|
if(I.tool_behaviour == TOOL_WELDER && user.a_intent != INTENT_HARM && bar_material == METAL)
|
|
if(obj_integrity < max_integrity)
|
|
if(!I.tool_start_check(user, amount=0))
|
|
return
|
|
|
|
to_chat(user, span_notice("You begin repairing [src]..."))
|
|
if(I.use_tool(src, user, 40, volume=40))
|
|
obj_integrity = clamp(obj_integrity + 20, 0, max_integrity)
|
|
else
|
|
return ..()
|
|
|
|
/obj/structure/barricade/CanAllowThrough(atom/movable/mover, turf/target)//So bullets will fly over and stuff.
|
|
. = ..()
|
|
if(locate(/obj/structure/barricade) in get_turf(mover))
|
|
return TRUE
|
|
else if(istype(mover, /obj/item/projectile))
|
|
if(!anchored)
|
|
return TRUE
|
|
var/obj/item/projectile/proj = mover
|
|
if(proj.firer && Adjacent(proj.firer))
|
|
return TRUE
|
|
if(prob(proj_pass_rate))
|
|
return TRUE
|
|
return FALSE
|
|
|
|
|
|
|
|
/////BARRICADE TYPES///////
|
|
|
|
/obj/structure/barricade/wooden
|
|
name = "wooden barricade"
|
|
desc = "This space is blocked off by a wooden barricade."
|
|
icon = 'icons/obj/structures.dmi'
|
|
icon_state = "woodenbarricade"
|
|
bar_material = WOOD
|
|
var/drop_amount = 3
|
|
|
|
/obj/structure/barricade/wooden/attackby(obj/item/I, mob/user)
|
|
if(istype(I,/obj/item/stack/sheet/mineral/wood))
|
|
var/obj/item/stack/sheet/mineral/wood/W = I
|
|
if(W.amount < 5)
|
|
to_chat(user, span_warning("You need at least five wooden planks to make a wall!"))
|
|
return
|
|
else
|
|
to_chat(user, span_notice("You start adding [I] to [src]..."))
|
|
if(do_after(user, 5 SECONDS, src))
|
|
W.use(5)
|
|
new /turf/closed/wall/mineral/wood/nonmetal(get_turf(src))
|
|
qdel(src)
|
|
return
|
|
else if(I.tool_behaviour == TOOL_CROWBAR && user.a_intent != INTENT_HARM)
|
|
user.visible_message("[user.name] starts prying [src.name] apart.", \
|
|
span_notice("You start prying the barricade apart"))
|
|
if(I.use_tool(src, user, 190, volume=50))
|
|
to_chat(user, span_notice("You disassemble the barricade."))
|
|
new /obj/item/stack/sheet/mineral/wood(user.loc, 5)
|
|
qdel(src)
|
|
else
|
|
return ..()
|
|
|
|
|
|
/obj/structure/barricade/wooden/crude
|
|
name = "crude plank barricade"
|
|
desc = "This space is blocked off by a crude assortment of planks."
|
|
icon_state = "woodenbarricade-old"
|
|
drop_amount = 1
|
|
max_integrity = 50
|
|
proj_pass_rate = 65
|
|
|
|
/obj/structure/barricade/wooden/crude/attackby(obj/item/I, mob/user) // Make it so you cant turn crude planks into walls
|
|
if(I.tool_behaviour == TOOL_CROWBAR && user.a_intent != INTENT_HARM)
|
|
user.visible_message("[user.name] starts prying [src.name] apart.", \
|
|
span_notice("You start prying the barricade apart"))
|
|
if(I.use_tool(src, user, 10 SECONDS, volume=50))
|
|
to_chat(user, span_notice("You disassemble the barricade."))
|
|
new /obj/item/stack/sheet/mineral/wood(user.loc, 5)
|
|
qdel(src)
|
|
|
|
/obj/structure/barricade/wooden/crude/snow
|
|
desc = "This space is blocked off by a crude assortment of planks. It seems to be covered in a layer of snow."
|
|
icon_state = "woodenbarricade-snow-old"
|
|
max_integrity = 75
|
|
|
|
/obj/structure/barricade/wooden/make_debris()
|
|
new /obj/item/stack/sheet/mineral/wood(get_turf(src), drop_amount)
|
|
|
|
|
|
/obj/structure/barricade/sandbags
|
|
name = "sandbags"
|
|
desc = "Bags of sand. Self explanatory."
|
|
icon = 'icons/obj/smooth_structures/sandbags.dmi'
|
|
icon_state = "sandbags"
|
|
max_integrity = 280
|
|
proj_pass_rate = 20
|
|
pass_flags = LETPASSTHROW
|
|
bar_material = SAND
|
|
climbable = TRUE
|
|
smooth = SMOOTH_TRUE
|
|
canSmoothWith = list(/obj/structure/barricade/sandbags, /turf/closed/wall, /turf/closed/wall/r_wall, /obj/structure/falsewall, /obj/structure/falsewall/reinforced, /turf/closed/wall/rust, /turf/closed/wall/r_wall/rust, /obj/structure/barricade/security)
|
|
|
|
/obj/structure/barricade/security
|
|
name = "security barrier"
|
|
desc = "A deployable barrier. Provides good cover in fire fights."
|
|
icon = 'icons/obj/objects.dmi'
|
|
icon_state = "barrier0"
|
|
density = FALSE
|
|
anchored = FALSE
|
|
max_integrity = 180
|
|
proj_pass_rate = 20
|
|
armor = list(MELEE = 10, BULLET = 50, LASER = 50, ENERGY = 50, BOMB = 10, BIO = 100, RAD = 100, FIRE = 10, ACID = 0)
|
|
|
|
var/deploy_time = 40
|
|
var/deploy_message = TRUE
|
|
|
|
|
|
/obj/structure/barricade/security/Initialize()
|
|
. = ..()
|
|
addtimer(CALLBACK(src, .proc/deploy), deploy_time)
|
|
|
|
/obj/structure/barricade/security/proc/deploy()
|
|
icon_state = "barrier1"
|
|
density = TRUE
|
|
anchored = TRUE
|
|
if(deploy_message)
|
|
visible_message(span_warning("[src] deploys!"))
|
|
|
|
|
|
/obj/item/grenade/barrier
|
|
name = "barrier grenade"
|
|
desc = "Instant cover."
|
|
icon = 'icons/obj/grenade.dmi'
|
|
icon_state = "flashbang"
|
|
item_state = "flashbang"
|
|
actions_types = list(/datum/action/item_action/toggle_barrier_spread)
|
|
var/mode = SINGLE
|
|
|
|
/obj/item/grenade/barrier/examine(mob/user)
|
|
. = ..()
|
|
. += span_notice("Alt-click to toggle modes.")
|
|
|
|
/obj/item/grenade/barrier/AltClick(mob/living/carbon/user)
|
|
if(!istype(user) || !user.canUseTopic(src, BE_CLOSE))
|
|
return
|
|
toggle_mode(user)
|
|
|
|
/obj/item/grenade/barrier/proc/toggle_mode(mob/user)
|
|
switch(mode)
|
|
if(SINGLE)
|
|
mode = VERTICAL
|
|
if(VERTICAL)
|
|
mode = HORIZONTAL
|
|
if(HORIZONTAL)
|
|
mode = SINGLE
|
|
|
|
to_chat(user, "[src] is now in [mode] mode.")
|
|
|
|
/obj/item/grenade/barrier/prime()
|
|
new /obj/structure/barricade/security(get_turf(src.loc))
|
|
switch(mode)
|
|
if(VERTICAL)
|
|
var/target_turf = get_step(src, NORTH)
|
|
if(!(is_blocked_turf(target_turf)))
|
|
new /obj/structure/barricade/security(target_turf)
|
|
|
|
var/target_turf2 = get_step(src, SOUTH)
|
|
if(!(is_blocked_turf(target_turf2)))
|
|
new /obj/structure/barricade/security(target_turf2)
|
|
if(HORIZONTAL)
|
|
var/target_turf = get_step(src, EAST)
|
|
if(!(is_blocked_turf(target_turf)))
|
|
new /obj/structure/barricade/security(target_turf)
|
|
|
|
var/target_turf2 = get_step(src, WEST)
|
|
if(!(is_blocked_turf(target_turf2)))
|
|
new /obj/structure/barricade/security(target_turf2)
|
|
qdel(src)
|
|
|
|
/obj/item/grenade/barrier/ui_action_click(mob/user)
|
|
toggle_mode(user)
|
|
|
|
|
|
#undef SINGLE
|
|
#undef VERTICAL
|
|
#undef HORIZONTAL
|
|
|
|
#undef METAL
|
|
#undef WOOD
|
|
#undef SAND
|