Skip to content

Commit

Permalink
[MIRROR] Turf to use_tool
Browse files Browse the repository at this point in the history
  • Loading branch information
emmanuelbassil authored and SierraHelper committed Jan 22, 2024
1 parent 39c4145 commit 65d4dca
Show file tree
Hide file tree
Showing 11 changed files with 259 additions and 247 deletions.
18 changes: 9 additions & 9 deletions code/game/gamemodes/cult/cultify/de-cultify.dm
Original file line number Diff line number Diff line change
@@ -1,29 +1,29 @@
/turf/unsimulated/wall/cult/attackby(obj/item/I, mob/user)
/turf/unsimulated/wall/cult/use_tool(obj/item/I, mob/living/user, list/click_params)
if(istype(I, /obj/item/nullrod))
user.visible_message(SPAN_NOTICE("\The [user] touches \the [src] with \the [I], and it shifts."), SPAN_NOTICE("You touch \the [src] with \the [I], and it shifts."))
ChangeTurf(/turf/unsimulated/wall)
return
..()
return TRUE
return ..()

/turf/simulated/wall/cult/attackby(obj/item/I, mob/user)
/turf/simulated/wall/cult/use_tool(obj/item/I, mob/living/user, list/click_params)
if (istype(I, /obj/item/nullrod))
user.visible_message(
SPAN_NOTICE("\The [user] touches \the [src] with \the [I], and it shifts."),
SPAN_NOTICE("You touch \the [src] with \the [I], and it shifts.")
)
decultify_wall()
return
..()
return TRUE
return ..()

/turf/simulated/floor/cult/attackby(obj/item/I, mob/user)
/turf/simulated/floor/cult/use_tool(obj/item/I, mob/living/user, list/click_params)
if (istype(I, /obj/item/nullrod))
user.visible_message(
SPAN_NOTICE("\The [user] touches \the [src] with \the [I], and it shifts."),
SPAN_NOTICE("You touch \the [src] with \the [I], and it shifts.")
)
decultify_floor()
return
..()
return TRUE
return ..()

/turf/proc/decultify_wall()
var/turf/simulated/wall/cult/wall = src
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/floorlayer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@
if(!T)
if(!TakeNewStack())
return 0
w_turf.attackby(T , src)
w_turf.use_tool(T , src)
return 1

/obj/machinery/floorlayer/proc/TakeTile(obj/item/stack/tile/tile)
Expand Down
4 changes: 2 additions & 2 deletions code/game/turfs/simulated.dm
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,11 @@
/turf/simulated/proc/can_build_cable(mob/user)
return 0

/turf/simulated/attackby(obj/item/thing, mob/user)
/turf/simulated/use_tool(obj/item/thing, mob/living/user, list/click_params)
if(isCoil(thing) && can_build_cable(user))
var/obj/item/stack/cable_coil/coil = thing
coil.PlaceCableOnTurf(src, user)
return
return TRUE
return ..()

/turf/simulated/Initialize()
Expand Down
157 changes: 82 additions & 75 deletions code/game/turfs/simulated/floor_attackby.dm
Original file line number Diff line number Diff line change
@@ -1,28 +1,22 @@
/turf/simulated/floor/attackby(obj/item/C, mob/user)

/turf/simulated/floor/use_tool(obj/item/C, mob/living/user, list/click_params)
var/area/A = get_area(src)
if (!A.can_modify_area())
visible_message("\The [src] cannot be dismantled or modified in any way!")
return

if(!C || !user)
return 0
return TRUE

if(isCoil(C) || (flooring && istype(C, /obj/item/stack/material/rods)))
return ..(C, user)

if(!(isScrewdriver(C) && flooring && (flooring.flags & TURF_REMOVE_SCREWDRIVER)) && try_graffiti(user, C))
return
return TRUE

if(flooring)
if(isCrowbar(C))
if(user.a_intent != I_HELP)
return
if(broken || burnt)
to_chat(user, SPAN_NOTICE("You remove the broken [flooring.descriptor]."))
make_plating()
else if(flooring.flags & TURF_IS_FRAGILE)
to_chat(user, SPAN_DANGER("You forcefully pry off the [flooring.descriptor], destroying them in the process."))
to_chat(user, SPAN_DANGER("You forcefully pry off \the [flooring.descriptor], destroying them in the process."))
make_plating()
else if(flooring.flags & TURF_REMOVE_CROWBAR)
if (flooring.remove_timer)
Expand All @@ -38,17 +32,19 @@
)
make_plating(TRUE)
playsound(src, 'sound/items/Crowbar.ogg', 80, 1)
return
return TRUE
else
to_chat(user, SPAN_NOTICE("You lever off the [flooring.descriptor]."))
to_chat(user, SPAN_NOTICE("You lever off \the [flooring.descriptor]."))
make_plating(TRUE)
else
return
return ..()

playsound(src, 'sound/items/Crowbar.ogg', 80, 1)
return
return TRUE

else if(isScrewdriver(C) && (flooring.flags & TURF_REMOVE_SCREWDRIVER))
if(broken || burnt)
return
return ..()
if (flooring.remove_timer)
user.visible_message(
SPAN_NOTICE("\The [user] begins unscrewing \the [flooring.descriptor] with \the [C]!"),
Expand All @@ -62,12 +58,13 @@
)
make_plating(TRUE)
playsound(src, 'sound/items/Screwdriver.ogg', 80, 1)
return
return TRUE
else
to_chat(user, SPAN_NOTICE("You unscrew and remove the [flooring.descriptor]."))
to_chat(user, SPAN_NOTICE("You unscrew and remove \the [flooring.descriptor]."))
make_plating(TRUE)
playsound(src, 'sound/items/Screwdriver.ogg', 80, 1)
return
return TRUE

else if(isWrench(C) && (flooring.flags & TURF_REMOVE_WRENCH))
if (flooring.remove_timer)
user.visible_message(
Expand All @@ -82,35 +79,43 @@
)
make_plating(TRUE)
playsound(src, 'sound/items/Ratchet.ogg', 80, 1)
return
return TRUE
else
to_chat(user, SPAN_NOTICE("You unwrench and remove the [flooring.descriptor]."))
to_chat(user, SPAN_NOTICE("You unwrench and remove \the [flooring.descriptor]."))
make_plating(TRUE)
playsound(src, 'sound/items/Ratchet.ogg', 80, 1)
return
return TRUE

else if(istype(C, /obj/item/shovel) && (flooring.flags & TURF_REMOVE_SHOVEL))
to_chat(user, SPAN_NOTICE("You shovel off the [flooring.descriptor]."))
to_chat(user, SPAN_NOTICE("You shovel off \the [flooring.descriptor]."))
make_plating(1)
playsound(src, 'sound/items/Deconstruct.ogg', 80, 1)
return
return TRUE

else if(isCoil(C))
to_chat(user, SPAN_WARNING("You must remove the [flooring.descriptor] first."))
return
else
to_chat(user, SPAN_WARNING("You must remove \the [flooring.descriptor] first."))
return TRUE

else
if(istype(C, /obj/item/stack))
if(broken || burnt)
to_chat(user, SPAN_WARNING("This section is too damaged to support anything. Use a welder to fix the damage."))
return
return TRUE
//first check, catwalk? Else let flooring do its thing
if(locate(/obj/structure/catwalk, src))
return
return ..()

if (istype(C, /obj/item/stack/material/rods))
var/obj/item/stack/material/rods/R = C
if (R.use(2))
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
new /obj/structure/catwalk(src)
return
if (!R.can_use(2))
USE_FEEDBACK_STACK_NOT_ENOUGH(R, 2, "to build the catwalk.")
return TRUE

R.use(2)
playsound(src, 'sound/weapons/Genhit.ogg', 50, 1)
new /obj/structure/catwalk(src)
return TRUE

var/obj/item/stack/S = C
var/singleton/flooring/use_flooring
var/list/singletons = GET_SINGLETON_SUBTYPE_MAP(/singleton/flooring)
Expand All @@ -122,70 +127,72 @@
use_flooring = F
break
if(!use_flooring)
return
// Do we have enough?
return TRUE

if(use_flooring.build_cost && S.get_amount() < use_flooring.build_cost)
to_chat(user, SPAN_WARNING("You require at least [use_flooring.build_cost] [S.name] to complete the [use_flooring.descriptor]."))
return
// Stay still and focus...
to_chat(user, SPAN_WARNING("You require at least [use_flooring.build_cost] [S.name] to complete \the [use_flooring.descriptor]."))
return TRUE

if(use_flooring.build_time && !do_after(user, use_flooring.build_time, src, DO_REPAIR_CONSTRUCT))
return
return TRUE
if(flooring || !S || !user || !use_flooring)
return
return TRUE
if(S.use(use_flooring.build_cost))
set_flooring(use_flooring)
playsound(src, 'sound/items/Deconstruct.ogg', 80, 1)
return
return TRUE

// Repairs and Deconstruction.
else if(isCrowbar(C))
if(broken || burnt)
playsound(src, 'sound/items/Crowbar.ogg', 80, 1)
visible_message(SPAN_NOTICE("[user] has begun prying off the damaged plating."))
var/turf/T = GetBelow(src)
if(T)
T.visible_message(SPAN_WARNING("The ceiling above looks as if it's being pried off."))
if(do_after(user, (C.toolspeed * 10) SECONDS, src, DO_REPAIR_CONSTRUCT))
if(!istype(src, /turf/simulated/floor))
return
if(!broken && !burnt || !(is_plating()))
return
visible_message(SPAN_WARNING("[user] has pried off the damaged plating."))
new /obj/item/stack/tile/floor(src)
src.ReplaceWithLattice()
playsound(src, 'sound/items/Deconstruct.ogg', 80, 1)
if(T)
T.visible_message(SPAN_DANGER("The ceiling above has been pried off!"))
else
return
return
else if (isCrowbar(C) && (broken || burnt))
playsound(src, 'sound/items/Crowbar.ogg', 80, 1)
visible_message(SPAN_NOTICE("\The [user] has begun prying off the damaged plating."))
var/turf/T = GetBelow(src)
if(T)
T.visible_message(SPAN_WARNING("The ceiling above looks as if it's being pried off."))
if (!do_after(user, (C.toolspeed * 10) SECONDS, src, DO_REPAIR_CONSTRUCT))
return TRUE
if (!istype(src, /turf/simulated/floor))
return TRUE
if (!broken && !burnt || !(is_plating()))
return TRUE
visible_message(SPAN_WARNING("\The [user] has pried off the damaged plating."))
new /obj/item/stack/tile/floor(src)
ReplaceWithLattice()
playsound(src, 'sound/items/Deconstruct.ogg', 80, 1)
if(T)
T.visible_message(SPAN_DANGER("The ceiling above has been pried off!"))
return TRUE

else if(isWelder(C))
var/obj/item/weldingtool/welder = C
if(welder.can_use(2, user) && (is_plating()))
if(broken || burnt)
if(welder.remove_fuel(2, user))
to_chat(user, SPAN_NOTICE("You fix some dents on the broken plating."))
playsound(src, 'sound/items/Welder.ogg', 80, 1)
icon_state = "plating"
burnt = null
broken = null
return
welder.remove_fuel(2, user)
to_chat(user, SPAN_NOTICE("You fix some dents on the broken plating."))
playsound(src, 'sound/items/Welder.ogg', 80, 1)
icon_state = "plating"
burnt = null
broken = null
return TRUE
else
if(welder.remove_fuel(2, user))
welder.remove_fuel(2, user)
playsound(src, 'sound/items/Welder.ogg', 80, 1)
visible_message(SPAN_NOTICE("\The [user] has started melting the plating's reinforcements!"))
if(do_after(user, (C.toolspeed * 5) SECONDS, src, DO_REPAIR_CONSTRUCT) && welder.isOn() && welder_melt())
visible_message(SPAN_WARNING("\The [user] has melted the plating's reinforcements! It should be possible to pry it off."))
playsound(src, 'sound/items/Welder.ogg', 80, 1)
visible_message(SPAN_NOTICE("[user] has started melting the plating's reinforcements!"))
if(do_after(user, (C.toolspeed * 5) SECONDS, src, DO_REPAIR_CONSTRUCT) && welder.isOn() && welder_melt())
visible_message(SPAN_WARNING("[user] has melted the plating's reinforcements! It should be possible to pry it off."))
playsound(src, 'sound/items/Welder.ogg', 80, 1)
return
return TRUE

else if(istype(C, /obj/item/gun/energy/plasmacutter) && (is_plating()) && !broken && !burnt)
var/obj/item/gun/energy/plasmacutter/cutter = C
if(!cutter.slice(user))
return ..()
playsound(src, 'sound/items/Welder.ogg', 80, 1)
visible_message(SPAN_NOTICE("[user] has started slicing through the plating's reinforcements!"))
visible_message(SPAN_NOTICE("\The [user] has started slicing through the plating's reinforcements!"))
if(do_after(user, (C.toolspeed * 3) SECONDS, src, DO_PUBLIC_UNIQUE) && welder_melt())
visible_message(SPAN_WARNING("[user] has sliced through the plating's reinforcements! It should be possible to pry it off."))
playsound(src, 'sound/items/Welder.ogg', 80, 1)
return TRUE

return ..()

Expand Down
6 changes: 3 additions & 3 deletions code/game/turfs/simulated/floor_static.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
initial_flooring = null
footstep_type = /singleton/footsteps/plating

/turf/simulated/floor/fixed/attackby(obj/item/C, mob/user)
/turf/simulated/floor/fixed/use_tool(obj/item/C, mob/living/user, list/click_params)
if(istype(C, /obj/item/stack) && !isCoil(C))
return
return ..()
Expand All @@ -28,10 +28,10 @@
icon = 'icons/turf/flooring/alium.dmi'
icon_state = "jaggy"

/turf/simulated/floor/fixed/alium/attackby(obj/item/C, mob/user)
/turf/simulated/floor/fixed/alium/use_tool(obj/item/C, mob/living/user, list/click_params)
if(isCrowbar(C))
to_chat(user, SPAN_NOTICE("There aren't any openings big enough to pry it away..."))
return
return TRUE
return ..()

/turf/simulated/floor/fixed/alium/New()
Expand Down
Loading

0 comments on commit 65d4dca

Please sign in to comment.