Skip to content

Commit

Permalink
Fixes some tool checks (#3813)
Browse files Browse the repository at this point in the history
# About the pull request
Converts some istype checks into tool trait checks

# Explain why it's good for the game
So stuff like maint jacks work properly.

# Changelog
:cl:
fix: The maintenance jack should work a little better at crowbarring
things.
/:cl:

---------

Co-authored-by: John Doe <[email protected]>
  • Loading branch information
Zonespace27 and johndoe2013 committed Jul 7, 2023
1 parent d8daff5 commit 297d2a9
Show file tree
Hide file tree
Showing 11 changed files with 15 additions and 17 deletions.
2 changes: 1 addition & 1 deletion code/game/machinery/autolathe.dm
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@
return

//Dismantle the frame.
if(istype(O, /obj/item/tool/crowbar))
if(HAS_TRAIT(O, TRAIT_TOOL_CROWBAR))
dismantle()
return

Expand Down
6 changes: 3 additions & 3 deletions code/game/machinery/computer/ai_core.dm
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
to_chat(user, SPAN_NOTICE(" You screw the circuit board into place."))
state = 2
icon_state = "2"
if(istype(P, /obj/item/tool/crowbar) && circuit)
if(HAS_TRAIT(P, TRAIT_TOOL_CROWBAR) && circuit)
playsound(loc, 'sound/items/Crowbar.ogg', 25, 1)
to_chat(user, SPAN_NOTICE(" You remove the circuit board."))
state = 1
Expand Down Expand Up @@ -121,15 +121,15 @@
to_chat(usr, "Added [mmi].")
icon_state = "3b"

if(istype(P, /obj/item/tool/crowbar) && brain)
if(HAS_TRAIT(P, TRAIT_TOOL_CROWBAR) && brain)
playsound(loc, 'sound/items/Crowbar.ogg', 25, 1)
to_chat(user, SPAN_NOTICE(" You remove the brain."))
brain.forceMove(loc)
brain = null
icon_state = "3"

if(4)
if(istype(P, /obj/item/tool/crowbar))
if(HAS_TRAIT(P, TRAIT_TOOL_CROWBAR))
playsound(loc, 'sound/items/Crowbar.ogg', 25, 1)
to_chat(user, SPAN_NOTICE(" You remove the glass panel."))
state = 3
Expand Down
4 changes: 2 additions & 2 deletions code/game/machinery/computer/buildandrepair.dm
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
to_chat(user, SPAN_NOTICE(" You screw the circuit board into place."))
src.state = 2
src.icon_state = "2"
if(istype(P, /obj/item/tool/crowbar) && circuit)
if(HAS_TRAIT(P, TRAIT_TOOL_CROWBAR) && circuit)
playsound(src.loc, 'sound/items/Crowbar.ogg', 25, 1)
to_chat(user, SPAN_NOTICE(" You remove the circuit board."))
src.state = 1
Expand Down Expand Up @@ -99,7 +99,7 @@
src.state = 4
src.icon_state = "4"
if(4)
if(istype(P, /obj/item/tool/crowbar))
if(HAS_TRAIT(P, TRAIT_TOOL_CROWBAR))
playsound(src.loc, 'sound/items/Crowbar.ogg', 25, 1)
to_chat(user, SPAN_NOTICE(" You remove the glass panel."))
src.state = 3
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/constructable_frame.dm
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@
A.amount = 5

if(CONSTRUCTION_STATE_FINISHED)
if(istype(P, /obj/item/tool/crowbar))
if(HAS_TRAIT(P, TRAIT_TOOL_CROWBAR))
if(!skillcheck(user, SKILL_ENGINEER, required_dismantle_skill))
to_chat(user, SPAN_WARNING("You are not trained to dismantle machines..."))
return
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/doors/windowdoor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@
return

//If it's emagged, crowbar can pry electronics out.
if (src.operating == -1 && istype(I, /obj/item/tool/crowbar))
if (src.operating == -1 && HAS_TRAIT(I, TRAIT_TOOL_CROWBAR))
playsound(src.loc, 'sound/items/Crowbar.ogg', 25, 1)
user.visible_message("[user] removes the electronics from the windoor.", "You start to remove electronics from the windoor.")
if (do_after(user, 40, INTERRUPT_ALL, BUSY_ICON_BUILD))
Expand Down
2 changes: 1 addition & 1 deletion code/game/machinery/telecomms/machine_interactions.dm
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@
stat &= ~BROKEN // the machine's not borked anymore!
else
to_chat(user, SPAN_WARNING("You need five coils of wire for this."))
if(istype(P, /obj/item/tool/crowbar))
if(HAS_TRAIT(P, TRAIT_TOOL_CROWBAR))
to_chat(user, "You begin prying out the circuit board other components...")
playsound(src.loc, 'sound/items/Crowbar.ogg', 25, 1)
if(do_after(user, 60 * user.get_skill_duration_multiplier(SKILL_ENGINEER), INTERRUPT_ALL|BEHAVIOR_IMMOBILE, BUSY_ICON_BUILD))
Expand Down
4 changes: 1 addition & 3 deletions code/game/objects/items/tools/maintenance_tools.dm
Original file line number Diff line number Diff line change
Expand Up @@ -557,8 +557,6 @@
if(attacked_door.locked) //Bolted
to_chat(user, SPAN_DANGER("You can't pry open [attacked_door] while it is bolted shut."))
return
if(!attacked_door.arePowerSystemsOn()) //Opens like normal if unpowered
return FALSE

if(requires_superstrength_pry)
if(!HAS_TRAIT(user, TRAIT_SUPER_STRONG)) //basically IS_PRY_CAPABLE_CROWBAR
Expand Down Expand Up @@ -645,7 +643,7 @@
resin_door.Open()
return

if(istype(attacked_obj, /turf/open/floor))
else if(istype(attacked_obj, /turf/open/floor))
var/turf/open/floor/flooring = attacked_obj

if(crowbar_mode && user.a_intent == INTENT_HELP) //Only pry flooring on help intent
Expand Down
4 changes: 2 additions & 2 deletions code/game/objects/structures/props.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
. = ..()
if(isxeno(user))
return
else if (ishuman(user) && istype(W, /obj/item/tool/wrench))
else if (ishuman(user) && HAS_TRAIT(W, TRAIT_TOOL_WRENCH))
on = !on
visible_message("You wrench the controls of \the [src]. The drill jumps to life." , "[user] wrenches the controls of \the [src]. The drill jumps to life.")

Expand Down Expand Up @@ -501,7 +501,7 @@
. = ..()
if(isxeno(user))
return
else if (ishuman(user) && istype(W, /obj/item/tool/crowbar))
else if (ishuman(user) && HAS_TRAIT(W, TRAIT_TOOL_CROWBAR))
on = !on
visible_message("You pry at the control valve on [src]. The machine shudders." , "[user] pries at the control valve on [src]. The entire machine shudders.")

Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/structures/watercloset.dm
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,7 @@
cistern_overlay.icon_state = "cistern[cistern]"

/obj/structure/toilet/attackby(obj/item/I, mob/living/user)
if(istype(I, /obj/item/tool/crowbar))
if(HAS_TRAIT(I, TRAIT_TOOL_CROWBAR))
to_chat(user, SPAN_NOTICE("You start to [cistern ? "replace the lid on the cistern" : "lift the lid off the cistern"]."))
playsound(loc, 'sound/effects/stonedoor_openclose.ogg', 25, 1)
if(do_after(user, 30, INTERRUPT_ALL|BEHAVIOR_IMMOBILE, BUSY_ICON_BUILD))
Expand Down
2 changes: 1 addition & 1 deletion code/game/turfs/floor.dm
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@
if(src.weeds)
return weeds.attackby(hitting_item,user)

if(istype(hitting_item, /obj/item/tool/crowbar) && (tool_flags & (REMOVE_CROWBAR|BREAK_CROWBAR)))
if(HAS_TRAIT(hitting_item, TRAIT_TOOL_CROWBAR) && (tool_flags & (REMOVE_CROWBAR|BREAK_CROWBAR)))
if(broken || burnt)
to_chat(user, SPAN_WARNING("You remove the broken tiles."))
else
Expand Down
2 changes: 1 addition & 1 deletion code/modules/power/port_gen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ display round(lastgen) and phorontank amount
to_chat(user, SPAN_NOTICE(" You open the access panel."))
else
to_chat(user, SPAN_NOTICE(" You close the access panel."))
else if(istype(O, /obj/item/tool/crowbar) && open)
else if(HAS_TRAIT(O, TRAIT_TOOL_CROWBAR) && open)
var/obj/structure/machinery/constructable_frame/new_frame = new /obj/structure/machinery/constructable_frame(src.loc)
for(var/obj/item/I in component_parts)
if(I.reliability < 100)
Expand Down

0 comments on commit 297d2a9

Please sign in to comment.