What was supposed to be another straightforward major system overhaul that once again spiraled out of control (#8220)

* get_tool_quality has numerical meaning

* Basic tools set tool quality

* Toolspeed is replaced by tool quality checks

* Addresses assorted results from live test

* Extra cleanup
This commit is contained in:
Atermonera
2022-01-16 15:52:55 -08:00
committed by GitHub
parent 0232be9531
commit 4d8c43f106
312 changed files with 1902 additions and 2271 deletions

View File

@@ -71,11 +71,11 @@ var/global/list/rad_collectors = list()
W.loc = src
update_icons()
return 1
else if(W.is_crowbar())
else if(W.get_tool_quality(TOOL_CROWBAR))
if(P && !src.locked)
eject()
return 1
else if(W.is_wrench())
else if(W.get_tool_quality(TOOL_WRENCH))
if(P)
to_chat(user, "<font color='blue'>Remove the phoron tank first.</font>")
return 1

View File

@@ -147,7 +147,7 @@
/obj/machinery/power/emitter/attackby(obj/item/W, mob/user)
if(W.is_wrench())
if(W.get_tool_quality(TOOL_WRENCH))
if(active)
to_chat(user, "Turn off [src] first.")
return
@@ -171,7 +171,7 @@
to_chat(user, "<span class='warning'>\The [src] needs to be unwelded from the floor.</span>")
return
if(istype(W, /obj/item/weapon/weldingtool))
if(W.get_tool_quality(TOOL_WELDER))
var/obj/item/weapon/weldingtool/WT = W
if(active)
to_chat(user, "Turn off [src] first.")
@@ -185,7 +185,7 @@
user.visible_message("[user.name] starts to weld [src] to the floor.", \
"You start to weld [src] to the floor.", \
"You hear welding")
if (do_after(user,20 * WT.toolspeed))
if (do_after(user,20 * WT.get_tool_speed(TOOL_WELDER)))
if(!src || !WT.isOn()) return
state = 2
to_chat(user, "You weld [src] to the floor.")
@@ -198,7 +198,7 @@
user.visible_message("[user.name] starts to cut [src] free from the floor.", \
"You start to cut [src] free from the floor.", \
"You hear welding")
if (do_after(user,20 * WT.toolspeed))
if (do_after(user,20 * WT.get_tool_speed(TOOL_WELDER)))
if(!src || !WT.isOn()) return
state = 1
to_chat(user, "You cut [src] free from the floor.")

View File

@@ -103,7 +103,7 @@ field_generator power level display
if(active)
to_chat(user, "The [src] needs to be off.")
return
else if(W.is_wrench())
else if(W.get_tool_quality(TOOL_WRENCH))
switch(state)
if(0)
state = 1
@@ -122,7 +122,7 @@ field_generator power level display
if(2)
to_chat(user, "<font color='red'>The [src.name] needs to be unwelded from the floor.</font>")
return
else if(istype(W, /obj/item/weapon/weldingtool))
else if(W.get_tool_quality(TOOL_WELDER))
var/obj/item/weapon/weldingtool/WT = W
switch(state)
if(0)
@@ -134,7 +134,7 @@ field_generator power level display
user.visible_message("[user.name] starts to weld the [src.name] to the floor.", \
"You start to weld the [src] to the floor.", \
"You hear welding")
if (do_after(user,20 * WT.toolspeed))
if (do_after(user,20 * WT.get_tool_speed(TOOL_WELDER)))
if(!src || !WT.isOn()) return
state = 2
to_chat(user, "You weld the field generator to the floor.")
@@ -146,7 +146,7 @@ field_generator power level display
user.visible_message("[user.name] starts to cut the [src.name] free from the floor.", \
"You start to cut the [src] free from the floor.", \
"You hear welding")
if (do_after(user,20 * WT.toolspeed))
if (do_after(user,20 * WT.get_tool_speed(TOOL_WELDER)))
if(!src || !WT.isOn()) return
state = 1
to_chat(user, "You cut the [src] free from the floor.")

View File

@@ -17,7 +17,7 @@
if(src) qdel(src)
/obj/machinery/the_singularitygen/attackby(obj/item/W, mob/user)
if(W.is_wrench())
if(W.get_tool_quality(TOOL_WRENCH))
anchored = !anchored
playsound(src, W.usesound, 75, 1)
if(anchored)
@@ -29,13 +29,13 @@
"You unsecure the [src.name] from the floor.", \
"You hear a ratchet.")
return
if(W.is_screwdriver())
if(W.get_tool_quality(TOOL_SCREWDRIVER))
panel_open = !panel_open
playsound(src, W.usesound, 50, 1)
visible_message("<span class='notice'>\The [user] adjusts \the [src]'s mechanisms.</span>")
if(panel_open && do_after(user, 30))
to_chat(user, "<span class='notice'>\The [src] looks like it could be modified.</span>")
if(panel_open && do_after(user, 80 * W.toolspeed)) // We don't have skills, so a delayed hint for engineers will have to do for now. (Panel open check for sanity)
if(panel_open && do_after(user, 80 * W.get_tool_speed(TOOL_SCREWDRIVER))) // We don't have skills, so a delayed hint for engineers will have to do for now. (Panel open check for sanity)
playsound(src, W.usesound, 50, 1)
to_chat(user, "<span class='cult'>\The [src] looks like it could be adapted to forge advanced materials via particle acceleration, somehow..</span>")
else

View File

@@ -125,13 +125,8 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
. += "It is assembled."
/obj/structure/particle_accelerator/attackby(obj/item/W, mob/user)
if(istool(W))
if(src.process_tool_hit(W,user))
return
..()
return
return src.process_tool_hit(W,user) || ..()
/obj/structure/particle_accelerator/Moved(atom/old_loc, direction, forced = FALSE)
. = ..()
if(master?.active)
@@ -197,21 +192,21 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
/obj/structure/particle_accelerator/proc/process_tool_hit(var/obj/item/O, var/mob/user)
if(!(O) || !(user))
return 0
return FALSE
if(!ismob(user) || !isobj(O))
return 0
return FALSE
var/temp_state = src.construction_state
switch(src.construction_state)//TODO:Might be more interesting to have it need several parts rather than a single list of steps
if(0)
if(O.is_wrench())
if(O.get_tool_quality(TOOL_WRENCH))
playsound(src, O.usesound, 75, 1)
src.anchored = 1
user.visible_message("[user.name] secures the [src.name] to the floor.", \
"You secure the external bolts.")
temp_state++
if(1)
if(O.is_wrench())
if(O.get_tool_quality(TOOL_WRENCH))
playsound(src, O.usesound, 75, 1)
src.anchored = 0
user.visible_message("[user.name] detaches the [src.name] from the floor.", \
@@ -223,27 +218,27 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
"You add some wires.")
temp_state++
if(2)
if(O.is_wirecutter())//TODO:Shock user if its on?
if(O.get_tool_quality(TOOL_WIRECUTTER))//TODO:Shock user if its on?
user.visible_message("[user.name] removes some wires from the [src.name].", \
"You remove some wires.")
temp_state--
else if(O.is_screwdriver())
else if(O.get_tool_quality(TOOL_SCREWDRIVER))
user.visible_message("[user.name] closes the [src.name]'s access panel.", \
"You close the access panel.")
temp_state++
if(3)
if(O.is_screwdriver())
if(O.get_tool_quality(TOOL_SCREWDRIVER))
user.visible_message("[user.name] opens the [src.name]'s access panel.", \
"You open the access panel.")
temp_state--
if(temp_state == src.construction_state)//Nothing changed
return 0
else
src.construction_state = temp_state
if(src.construction_state < 3)//Was taken apart, update state
update_state()
update_icon()
return 1
return FALSE
src.construction_state = temp_state
if(src.construction_state < 3)//Was taken apart, update state
update_state()
update_icon()
return TRUE
@@ -305,11 +300,7 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
/obj/machinery/particle_accelerator/attackby(obj/item/W, mob/user)
if(istool(W))
if(src.process_tool_hit(W,user))
return
..()
return
return src.process_tool_hit(W,user) || ..()
/obj/machinery/particle_accelerator/ex_act(severity)
switch(severity)
@@ -332,20 +323,20 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
/obj/machinery/particle_accelerator/proc/process_tool_hit(var/obj/item/O, var/mob/user)
if(!(O) || !(user))
return 0
return FALSE
if(!ismob(user) || !isobj(O))
return 0
return FALSE
var/temp_state = src.construction_state
switch(src.construction_state)//TODO:Might be more interesting to have it need several parts rather than a single list of steps
if(0)
if(O.is_wrench())
if(O.get_tool_quality(TOOL_WRENCH))
playsound(src, O.usesound, 75, 1)
src.anchored = 1
user.visible_message("[user.name] secures the [src.name] to the floor.", \
"You secure the external bolts.")
temp_state++
if(1)
if(O.is_wrench())
if(O.get_tool_quality(TOOL_WRENCH))
playsound(src, O.usesound, 75, 1)
src.anchored = 0
user.visible_message("[user.name] detaches the [src.name] from the floor.", \
@@ -357,29 +348,29 @@ So, hopefully this is helpful if any more icons are to be added/changed/wonderin
"You add some wires.")
temp_state++
if(2)
if(O.is_wirecutter())//TODO:Shock user if its on?
if(O.get_tool_quality(TOOL_WIRECUTTER))//TODO:Shock user if its on?
user.visible_message("[user.name] removes some wires from the [src.name].", \
"You remove some wires.")
temp_state--
else if(O.is_screwdriver())
else if(O.get_tool_quality(TOOL_SCREWDRIVER))
user.visible_message("[user.name] closes the [src.name]'s access panel.", \
"You close the access panel.")
temp_state++
if(3)
if(O.is_screwdriver())
if(O.get_tool_quality(TOOL_SCREWDRIVER))
user.visible_message("[user.name] opens the [src.name]'s access panel.", \
"You open the access panel.")
temp_state--
active = 0
if(temp_state == src.construction_state)//Nothing changed
return 0
else
if(src.construction_state < 3)//Was taken apart, update state
update_state()
if(use_power)
update_use_power(USE_POWER_OFF)
src.construction_state = temp_state
if(src.construction_state >= 3)
update_use_power(USE_POWER_IDLE)
update_icon()
return 1
return FALSE
if(src.construction_state < 3)//Was taken apart, update state
update_state()
if(use_power)
update_use_power(USE_POWER_OFF)
src.construction_state = temp_state
if(src.construction_state >= 3)
update_use_power(USE_POWER_IDLE)
update_icon()
return TRUE

View File

@@ -71,7 +71,7 @@
to_chat(user, "<span class='notice'>You add \the [reagent_container] to \the [src].</span>")
update_icon()
return
else if(W.is_wrench())
else if(W.get_tool_quality(TOOL_WRENCH))
anchored = !anchored
playsound(src, W.usesound, 75, 1)
if(anchored)