diff --git a/code/game/objects/items/weapons/handcuffs.dm b/code/game/objects/items/weapons/handcuffs.dm index 446c59c5341..47a1bfc9e97 100644 --- a/code/game/objects/items/weapons/handcuffs.dm +++ b/code/game/objects/items/weapons/handcuffs.dm @@ -211,7 +211,7 @@ if(istype(I, /obj/item/stack/rods)) var/obj/item/stack/rods/R = I if (R.use(1)) - var/obj/item/material/wirerod/W = new(get_turf(user)) + var/obj/item/material/wirerod/W = new(get_turf(user), MATERIAL_STEEL, color) user.put_in_hands(W) to_chat(user, SPAN_NOTICE("You wrap \the [src] around the top of the rod.")) qdel(src) diff --git a/code/game/objects/items/weapons/improvised_components.dm b/code/game/objects/items/weapons/improvised_components.dm index 50ab1c935fb..de7d2ad9716 100644 --- a/code/game/objects/items/weapons/improvised_components.dm +++ b/code/game/objects/items/weapons/improvised_components.dm @@ -51,6 +51,18 @@ attack_verb = list("hit", "bludgeoned", "whacked", "bonked") force_divisor = 0.1 thrown_force_divisor = 0.1 + applies_material_colour = FALSE + var/forward_cable_color = COLOR_RED + +/obj/item/material/wirerod/Initialize(mapload, var/material_key, var/cable_color) + . = ..() + if(!cable_color) + cable_color = COLOR_RED + forward_cable_color = cable_color + var/image/I = image(icon, null, "wiredrod_cable") + I.appearance_flags = RESET_COLOR + I.color = cable_color + add_overlay(I) /obj/item/material/wirerod/attackby(var/obj/item/I, mob/user as mob) ..() @@ -58,10 +70,13 @@ if(istype(I, /obj/item/material/shard) || istype(I, /obj/item/material/spearhead)) var/obj/item/material/tmp_shard = I finished = new /obj/item/material/twohanded/spear(get_turf(user), tmp_shard.material.name) - to_chat(user, "You fasten \the [I] to the top of the rod with the cable.") + to_chat(user, SPAN_NOTICE("You fasten \the [I] to the top of the rod with the cable.")) else if(I.iswirecutter()) - finished = new /obj/item/melee/baton/cattleprod(get_turf(user)) - to_chat(user, "You fasten the wirecutters to the top of the rod with the cable, prongs outward.") + finished = new /obj/item/melee/baton/cattleprod(get_turf(user), forward_cable_color) + to_chat(user, SPAN_NOTICE("You fasten the wirecutters to the top of the rod with the cable, prongs outward.")) + else if(istype(I, /obj/item/material/wirerod)) + finished = new /obj/item/trap/tripwire(get_turf(user), forward_cable_color) + to_chat(user, SPAN_NOTICE("You attach the two wired rods together, spooling the cable between them.")) if(finished) user.drop_from_inventory(src,finished) user.drop_from_inventory(I,finished) @@ -91,7 +106,7 @@ if(istype(I, /obj/item/material/spearhead)) var/obj/item/material/spearhead/tip = I finished = new /obj/item/material/twohanded/pike(get_turf(user), tip.material.name) - to_chat(user, "You attach \the [I] to the top of \the [src].") + to_chat(user, SPAN_NOTICE("You attach \the [I] to the top of \the [src].")) if(finished) user.drop_from_inventory(src,finished) user.drop_from_inventory(I,finished) @@ -168,7 +183,7 @@ complete = new /obj/item/clothing/head/lavender_crown(get_turf(user)) if(complete != null) - to_chat(user, "You attach the " + S.seed.seed_name + " to the circlet and create a beautiful flower crown.") + to_chat(user, SPAN_NOTICE("You attach the " + S.seed.seed_name + " to the circlet and create a beautiful flower crown.")) user.drop_from_inventory(W) user.drop_from_inventory(src) qdel(W) diff --git a/code/game/objects/items/weapons/material/material_weapons.dm b/code/game/objects/items/weapons/material/material_weapons.dm index b85055ad098..2262c5b787d 100644 --- a/code/game/objects/items/weapons/material/material_weapons.dm +++ b/code/game/objects/items/weapons/material/material_weapons.dm @@ -21,8 +21,8 @@ var/material/material var/drops_debris = 1 -/obj/item/material/New(var/newloc, var/material_key) - ..(newloc) +/obj/item/material/Initialize(var/newloc, var/material_key) + . = ..() if(!material_key) material_key = default_material set_material(material_key) diff --git a/code/game/objects/items/weapons/stunbaton.dm b/code/game/objects/items/weapons/stunbaton.dm index bc1b5631f4c..5bafb0ce386 100644 --- a/code/game/objects/items/weapons/stunbaton.dm +++ b/code/game/objects/items/weapons/stunbaton.dm @@ -247,6 +247,14 @@ baton_color = "#FFDF00" sheathed = 0 +/obj/item/melee/baton/cattleprod/Initialize(mapload, var/cable_color) + . = ..() + var/image/I = image(icon, null, "stunprod_cable") + if(!cable_color) + cable_color = COLOR_RED + I.color = cable_color + add_overlay(I) + /obj/item/melee/baton/stunrod name = "stunrod" desc = "A more-than-lethal weapon used to deal with high threat situations." diff --git a/code/game/objects/items/weapons/traps.dm b/code/game/objects/items/weapons/traps.dm index cecf65ce47c..3447c406b12 100644 --- a/code/game/objects/items/weapons/traps.dm +++ b/code/game/objects/items/weapons/traps.dm @@ -4,7 +4,7 @@ throw_speed = 2 throw_range = 1 gender = PLURAL - icon = 'icons/obj/items.dmi' + icon = 'icons/obj/contained_items/weapons/traps.dmi' var/icon_base = "beartrap" icon_state = "beartrap0" randpixel = 0 @@ -17,6 +17,10 @@ var/time_to_escape = 60 var/activated_armor_penetration = 0 +/obj/item/trap/Initialize() + . = ..() + update_icon() + /obj/item/trap/proc/can_use(mob/user) return (user.IsAdvancedToolUser() && !issilicon(user) && !user.stat && !user.restrained()) @@ -62,34 +66,22 @@ anchored = FALSE /obj/item/trap/attack_hand(mob/user) - if(buckled && can_use(user)) - user.visible_message( - SPAN_NOTICE("\The [user] begins freeing \the [buckled] from \the [src]..."), - SPAN_NOTICE("You carefully begin to free \the [buckled] from \the [src]...") - ) - if(do_after(user, time_to_escape)) - user.visible_message( - SPAN_NOTICE("\The user frees \the [buckled] from \the [src]."), - SPAN_NOTICE("You free \the [buckled] from \the [src].") - ) - unbuckle() - anchored = FALSE - else if(deployed && can_use(user)) - user.visible_message( - SPAN_NOTICE("\The [user] starts to disarm \the [src]..."), - SPAN_NOTICE("You begin disarming \the [src]..."), - SPAN_WARNING("You hear a latch click followed by the slow creaking of a spring.") - ) - if(do_after(user, 6 SECONDS)) - user.visible_message( - SPAN_NOTICE("\The [user] disarms \the [src]!"), - SPAN_NOTICE("You disarm \the [src]!") - ) - deployed = FALSE - anchored = FALSE - update_icon() - else - ..() + if(can_use(user)) + if(buckled) + user_unbuckle(user) + return + else if(deployed) + disarm_trap(user) + return + ..() + +/obj/item/trap/proc/disarm_trap(var/mob/user) + user.visible_message(SPAN_NOTICE("\The [user] starts to disarm \the [src]..."), SPAN_NOTICE("You begin disarming \the [src]..."), SPAN_WARNING("You hear a latch click followed by the slow creaking of a spring.")) + if(do_after(user, 6 SECONDS)) + user.visible_message(SPAN_NOTICE("\The [user] disarms \the [src]!"), SPAN_NOTICE("You disarm \the [src]!")) + deployed = FALSE + anchored = FALSE + update_icon() /obj/item/trap/proc/attack_mob(mob/living/L) var/target_zone @@ -102,6 +94,8 @@ if(!success) return FALSE + L.visible_message(SPAN_DANGER("\The [L] steps on \the [src]!"), FONT_LARGE(SPAN_DANGER("You step on \the [src]!")), SPAN_WARNING("You hear a loud metallic snap!")) + var/did_trap = TRUE if(ishuman(L)) var/mob/living/carbon/human/H = L @@ -124,6 +118,10 @@ bear.anger += 15//traps make bears really angry bear.instant_aggro() + if(!buckled) + anchored = FALSE + deployed = FALSE + /obj/item/trap/Crossed(atom/movable/AM) if(ishuman(AM)) var/mob/living/carbon/human/H = AM @@ -131,15 +129,7 @@ return if(deployed && isliving(AM)) var/mob/living/L = AM - L.visible_message( - SPAN_DANGER("\The [L] steps on \the [src]!"), - FONT_LARGE(SPAN_DANGER("You step on \the [src]!")), - SPAN_WARNING("You hear a loud metallic snap!") - ) attack_mob(L) - if(!buckled) - anchored = FALSE - deployed = FALSE update_icon() shake_animation() @@ -153,13 +143,9 @@ /obj/item/trap/animal name = "small trap" - throw_speed = 2 - throw_range = 1 - gender = PLURAL - icon = 'icons/obj/items.dmi' + desc = "A small mechanical trap that's used to catch small animals like rats, lizards, and chicks." icon_base = "small" icon_state = "small0" - desc = "A small mechanical trap that's used to catch small animals like rats, lizards, and chicks." throwforce = 2 force = 1 w_class = ITEMSIZE_SMALL @@ -190,7 +176,6 @@ to_chat(user, "\The [src] is already full!") /obj/item/trap/animal/update_icon() - icon = initial(icon) icon_state = "[icon_base][deployed]" /obj/item/trap/animal/examine(mob/user) @@ -629,8 +614,8 @@ /obj/item/large_trap_foundation name = "large trap foundation" desc = "A metal foundation for large trap, it is missing metals rods to hold the prey." + icon = 'icons/obj/contained_items/weapons/traps.dmi' icon_state = "large_foundation" - icon = 'icons/obj/items.dmi' throwforce = 4 force = 5 w_class = ITEMSIZE_HUGE @@ -656,3 +641,52 @@ return else ..() + + +/obj/item/trap/tripwire + name = "tripwire trap" + desc = "A piece of cable coil strung between two metal rods. Low-tech, but reliable." + icon_base = "tripwire" + color = COLOR_RED + layer = UNDERDOOR // so you can't cover it with items + +/obj/item/trap/tripwire/Initialize(mapload, var/new_cable_color) + . = ..() + if(!new_cable_color) + new_cable_color = COLOR_RED + color = new_cable_color + +/obj/item/trap/tripwire/update_icon() + underlays = null + icon_state = "[icon_base][deployed]" + var/image/I = image(icon, null, "[icon_state]_base") + I.appearance_flags = RESET_COLOR + underlays = list(I) + +/obj/item/trap/tripwire/deploy(mob/user) + user.visible_message(SPAN_WARNING("\The [user] starts to deploy \the [src]."), SPAN_WARNING("You begin deploying \the [src]!")) + if(do_after(user, 5 SECONDS)) + user.visible_message(SPAN_WARNING("\The [user] deploys \the [src]."), SPAN_WARNING("You deploy \the [src]!")) + deployed = TRUE + update_icon() + return TRUE + return FALSE + +/obj/item/trap/tripwire/disarm_trap(var/mob/user) + user.visible_message(SPAN_NOTICE("\The [user] starts to take \the [src] down..."), SPAN_NOTICE("You begin taking \the [src] down..."), SPAN_WARNING("You hear a latch click followed by the slow creaking of a spring.")) + if(do_after(user, 6 SECONDS)) + deployed = FALSE + anchored = FALSE + update_icon() + +/obj/item/trap/tripwire/attack_mob(mob/living/L) + if(!ishuman(L)) + return + + var/mob/living/carbon/human/H = L + if(!H.organs_by_name[BP_L_LEG] && !H.organs_by_name[BP_R_LEG]) // tripwires are triggered by shin, so if you don't have legs, assume you fly or crawl + return + + if(!L.lying && (L.m_intent == M_RUN) || prob(5)) + L.visible_message(SPAN_DANGER("\The [L] trips over \the [src]!"), FONT_LARGE(SPAN_DANGER("You trip over \the [src]!"))) + L.Weaken(3) \ No newline at end of file diff --git a/html/changelogs/geeves-tripwire_trap.yml b/html/changelogs/geeves-tripwire_trap.yml new file mode 100644 index 00000000000..80f6d0d95e8 --- /dev/null +++ b/html/changelogs/geeves-tripwire_trap.yml @@ -0,0 +1,7 @@ +author: Geeves + +delete-after: True + +changes: + - rscadd: "Wired rods and makeshift stun batons now use the color of cable coil you used to make them." + - rscadd: "You can now create a tripwire trap by combining two wired rods with eachother. The color of the wire will be of the wired rod you click on to make it." \ No newline at end of file diff --git a/icons/obj/contained_items/weapons/traps.dmi b/icons/obj/contained_items/weapons/traps.dmi new file mode 100644 index 00000000000..419e269788d Binary files /dev/null and b/icons/obj/contained_items/weapons/traps.dmi differ diff --git a/icons/obj/items.dmi b/icons/obj/items.dmi index 1c72fc10871..43b8854e54e 100644 Binary files a/icons/obj/items.dmi and b/icons/obj/items.dmi differ diff --git a/icons/obj/weapons.dmi b/icons/obj/weapons.dmi index 68b6d577c8c..cec9b341fad 100644 Binary files a/icons/obj/weapons.dmi and b/icons/obj/weapons.dmi differ