From 4b2e4eeca730f5d80c7fc83b986b21029df78be4 Mon Sep 17 00:00:00 2001 From: Anewbe Date: Sat, 23 Sep 2017 20:05:25 -0500 Subject: [PATCH] Improves catwalks and railings --- code/game/objects/items/stacks/rods.dm | 11 ++++++++- code/game/objects/structures/catwalk.dm | 25 ++++++++++++++++++++- code/game/objects/structures/railing.dm | 12 +++++++++- code/game/turfs/simulated/floor_attackby.dm | 24 ++++++++++---------- code/modules/mob/mob_movement.dm | 4 ++++ 5 files changed, 61 insertions(+), 15 deletions(-) diff --git a/code/game/objects/items/stacks/rods.dm b/code/game/objects/items/stacks/rods.dm index da6e436b27..ee21fc86a7 100644 --- a/code/game/objects/items/stacks/rods.dm +++ b/code/game/objects/items/stacks/rods.dm @@ -22,6 +22,14 @@ charge_costs = list(500) stacktype = /obj/item/stack/rods +/obj/item/stack/rods/New() + ..() + recipes = rods_recipes + +var/global/list/datum/stack_recipe/rods_recipes = list( \ + new/datum/stack_recipe("grille", /obj/structure/grille, 2, time = 10, one_per_turf = 1, on_floor = 1), + new/datum/stack_recipe("catwalk", /obj/structure/catwalk, 2, time = 80, one_per_turf = 1, on_floor = 1)) + /obj/item/stack/rods/attackby(obj/item/W as obj, mob/user as mob) if (istype(W, /obj/item/weapon/weldingtool)) var/obj/item/weapon/weldingtool/WT = W @@ -55,7 +63,7 @@ ..() - +/* /obj/item/stack/rods/attack_self(mob/user as mob) src.add_fingerprint(user) @@ -87,3 +95,4 @@ F.add_fingerprint(usr) use(2) return +*/ \ No newline at end of file diff --git a/code/game/objects/structures/catwalk.dm b/code/game/objects/structures/catwalk.dm index 25966efadb..0bf155dc49 100644 --- a/code/game/objects/structures/catwalk.dm +++ b/code/game/objects/structures/catwalk.dm @@ -6,9 +6,13 @@ name = "catwalk" desc = "Cats really don't like these things." density = 0 + var/health = 100 + var/maxhealth = 100 anchored = 1.0 /obj/structure/catwalk/initialize() + for(var/obj/structure/catwalk/O in range(1)) + O.update_icon() for(var/obj/structure/catwalk/C in get_turf(src)) if(C != src) warning("Duplicate [type] in [loc] ([x], [y], [z])") @@ -18,6 +22,7 @@ /obj/structure/catwalk/Destroy() var/turf/location = loc . = ..() + location.alpha = initial(location.alpha) for(var/obj/structure/catwalk/L in orange(location, 1)) L.update_icon() @@ -55,6 +60,8 @@ qdel(src) if(2.0) qdel(src) + if(3.0) + qdel(src) return /obj/structure/catwalk/attackby(obj/item/C as obj, mob/user as mob) @@ -67,6 +74,14 @@ new /obj/item/stack/rods(src.loc) new /obj/structure/lattice(src.loc) qdel(src) + if(istype(C, /obj/item/weapon/screwdriver)) + if(health < maxhealth) + to_chat(user, "You begin repairing \the [src.name] with \the [C.name].") + if(do_after(user, 20, src)) + health = maxhealth + else + take_damage(C.force) + user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) return ..() /obj/structure/catwalk/Crossed() @@ -79,4 +94,12 @@ return 1 if(target && target.z < src.z) return 0 - return 1 \ No newline at end of file + return 1 + +/obj/structure/catwalk/proc/take_damage(amount) + health -= amount + if(health <= 0) + visible_message("\The [src] breaks down!") + playsound(loc, 'sound/effects/grillehit.ogg', 50, 1) + new /obj/item/stack/rods(get_turf(src)) + Destroy() \ No newline at end of file diff --git a/code/game/objects/structures/railing.dm b/code/game/objects/structures/railing.dm index fc2807fede..98bae005f8 100644 --- a/code/game/objects/structures/railing.dm +++ b/code/game/objects/structures/railing.dm @@ -60,7 +60,7 @@ if(health <= 0) visible_message("\The [src] breaks down!") playsound(loc, 'sound/effects/grillehit.ogg', 50, 1) - new /obj/item/stack/rods(get_turf(usr)) + new /obj/item/stack/rods(get_turf(src)) qdel(src) /obj/structure/railing/proc/NeighborsCheck(var/UpdateNeighbors = 1) @@ -134,6 +134,9 @@ if(usr.incapacitated()) return 0 + if (!can_touch(usr) || ismouse(usr)) + return + if(anchored) to_chat(usr, "It is fastened to the floor therefore you can't rotate it!") return 0 @@ -150,6 +153,9 @@ if(usr.incapacitated()) return 0 + if (!can_touch(usr) || ismouse(usr)) + return + if(anchored) to_chat(usr, "It is fastened to the floor therefore you can't rotate it!") return 0 @@ -166,6 +172,9 @@ if(usr.incapacitated()) return 0 + if (!can_touch(usr) || ismouse(usr)) + return + if(anchored) to_chat(usr, "It is fastened to the floor therefore you can't flip it!") return 0 @@ -249,6 +258,7 @@ else playsound(loc, 'sound/effects/grillehit.ogg', 50, 1) take_damage(W.force) + user.setClickCooldown(DEFAULT_ATTACK_COOLDOWN) return ..() diff --git a/code/game/turfs/simulated/floor_attackby.dm b/code/game/turfs/simulated/floor_attackby.dm index 44446af94e..ef36121b12 100644 --- a/code/game/turfs/simulated/floor_attackby.dm +++ b/code/game/turfs/simulated/floor_attackby.dm @@ -6,13 +6,13 @@ if(flooring) if(istype(C, /obj/item/weapon/crowbar)) if(broken || burnt) - user << "You remove the broken [flooring.descriptor]." + to_chat(user, "You remove the broken [flooring.descriptor].") make_plating() else if(flooring.flags & TURF_IS_FRAGILE) - user << "You forcefully pry off the [flooring.descriptor], destroying them in the process." + to_chat(user, "You forcefully pry off the [flooring.descriptor], destroying them in the process.") make_plating() else if(flooring.flags & TURF_REMOVE_CROWBAR) - user << "You lever off the [flooring.descriptor]." + to_chat(user, "You lever off the [flooring.descriptor].") make_plating(1) else return @@ -21,35 +21,35 @@ else if(istype(C, /obj/item/weapon/screwdriver) && (flooring.flags & TURF_REMOVE_SCREWDRIVER)) if(broken || burnt) return - user << "You unscrew and remove the [flooring.descriptor]." + to_chat(user, "You unscrew and remove the [flooring.descriptor].") make_plating(1) playsound(src, C.usesound, 80, 1) return else if(istype(C, /obj/item/weapon/wrench) && (flooring.flags & TURF_REMOVE_WRENCH)) - user << "You unwrench and remove the [flooring.descriptor]." + to_chat(user, "You unwrench and remove the [flooring.descriptor].") make_plating(1) playsound(src, C.usesound, 80, 1) return else if(istype(C, /obj/item/weapon/shovel) && (flooring.flags & TURF_REMOVE_SHOVEL)) - user << "You shovel off the [flooring.descriptor]." + to_chat(user, "You shovel off the [flooring.descriptor].") make_plating(1) playsound(src, 'sound/items/Deconstruct.ogg', 80, 1) return else if(istype(C, /obj/item/stack/cable_coil)) - user << "You must remove the [flooring.descriptor] first." + to_chat(user, "You must remove the [flooring.descriptor] first.") return else if(istype(C, /obj/item/stack/cable_coil)) if(broken || burnt) - user << "This section is too damaged to support anything. Use a welder to fix the damage." + to_chat(user, "This section is too damaged to support anything. Use a welder to fix the damage.") return var/obj/item/stack/cable_coil/coil = C coil.turf_place(src, user) return else if(istype(C, /obj/item/stack)) if(broken || burnt) - user << "This section is too damaged to support anything. Use a welder to fix the damage." + to_chat(user, "This section is too damaged to support anything. Use a welder to fix the damage.") return var/obj/item/stack/S = C var/decl/flooring/use_flooring @@ -64,7 +64,7 @@ return // Do we have enough? if(use_flooring.build_cost && S.amount < use_flooring.build_cost) - user << "You require at least [use_flooring.build_cost] [S.name] to complete the [use_flooring.descriptor]." + to_chat(user, "You require at least [use_flooring.build_cost] [S.name] to complete the [use_flooring.descriptor].") return // Stay still and focus... if(use_flooring.build_time && !do_after(user, use_flooring.build_time)) @@ -81,10 +81,10 @@ if(welder.isOn() && (is_plating())) if(broken || burnt) if(welder.remove_fuel(0,user)) - user << "You fix some dents on the broken plating." + to_chat(user, "You fix some dents on the broken plating.") playsound(src, welder.usesound, 80, 1) icon_state = "plating" burnt = null broken = null else - user << "You need more welding fuel to complete this task." \ No newline at end of file + to_chat(user, "You need more welding fuel to complete this task.") \ No newline at end of file diff --git a/code/modules/mob/mob_movement.dm b/code/modules/mob/mob_movement.dm index 464baaa142..d1a336dbb6 100644 --- a/code/modules/mob/mob_movement.dm +++ b/code/modules/mob/mob_movement.dm @@ -501,6 +501,10 @@ if(!dense_object && (locate(/obj/structure/lattice) in oview(1, src))) dense_object++ + if(!dense_object && (locate(/obj/structure/catwalk) in oview(1, src))) + dense_object++ + + //Lastly attempt to locate any dense objects we could push off of //TODO: If we implement objects drifing in space this needs to really push them //Due to a few issues only anchored and dense objects will now work.