diff --git a/code/__DEFINES/mecha_defines.dm b/code/__DEFINES/mecha_defines.dm
index b414f146705..0d126314227 100644
--- a/code/__DEFINES/mecha_defines.dm
+++ b/code/__DEFINES/mecha_defines.dm
@@ -15,8 +15,8 @@
#define MECHA_SIDE_ARMOUR 2
#define MECHA_BACK_ARMOUR 3
-#define MECHA_LOCKED 0
-#define MECHA_SECURE_BOLTS 1
-#define MECHA_LOOSE_BOLTS 2
-#define MECHA_OPEN_HATCH 3
-#define MECHA_UNSECURE_CELL 4
+#define MECHA_MAINT_OFF 0
+#define MECHA_MAINT_ON 1
+#define MECHA_BOLTS_UP 2
+#define MECHA_OPEN_HATCH 3
+#define MECHA_BATTERY_UNSCREW 4
diff --git a/code/game/mecha/mecha.dm b/code/game/mecha/mecha.dm
index fd1975ccc0c..ee12fd81f94 100644
--- a/code/game/mecha/mecha.dm
+++ b/code/game/mecha/mecha.dm
@@ -29,8 +29,8 @@
var/overload_step_energy_drain_min = 100
var/deflect_chance = 10 //chance to deflect the incoming projectiles, hits, or lesser the effect of ex_act.
var/obj/item/stock_parts/cell/cell
- var/state = 0
- var/list/log = new
+ var/state = MECHA_MAINT_OFF
+ var/list/log = list()
var/last_message = 0
var/add_req_access = 1
var/maint_access = 1
@@ -84,7 +84,7 @@
var/destruction_sleep_duration = 2 SECONDS //Time that mech pilot is put to sleep for if mech is destroyed
var/melee_cooldown = 10
- var/melee_can_hit = 1
+ var/melee_can_hit = TRUE
/// How many ion thrusters we got on this bad boy
var/thruster_count = 0
@@ -247,9 +247,9 @@
if(!melee_can_hit || !isatom(target))
return
target.mech_melee_attack(src)
- melee_can_hit = 0
+ melee_can_hit = FALSE
spawn(melee_cooldown)
- melee_can_hit = 1
+ melee_can_hit = TRUE
/obj/mecha/proc/mech_toxin_damage(mob/living/target)
playsound(src, 'sound/effects/spray2.ogg', 50, 1)
@@ -270,11 +270,11 @@
/obj/mecha/Process_Spacemove(movement_dir = 0)
. = ..()
if(.)
- return 1
+ return TRUE
if(thrusters_active && movement_dir && use_power(step_energy_drain))
step_in = initial(step_in) / thruster_count
new /obj/effect/particle_effect/ion_trails(get_turf(src), dir)
- return 1
+ return TRUE
var/atom/movable/backup = get_spacemove_backup()
if(backup)
@@ -282,7 +282,7 @@
if(backup.newtonian_move(turn(movement_dir, 180)))
if(occupant)
to_chat(occupant, "You push off of [backup] to propel yourself.")
- return 1
+ return TRUE
/obj/mecha/relaymove(mob/user, direction)
if(!direction || frozen)
@@ -290,12 +290,12 @@
if(user != occupant) //While not "realistic", this piece is player friendly.
user.forceMove(get_turf(src))
to_chat(user, "You climb out from [src].")
- return 0
+ return FALSE
if(connected_port)
if(world.time - last_message > 20)
occupant_message("Unable to move while connected to the air system port!")
last_message = world.time
- return 0
+ return FALSE
if(state)
occupant_message("Maintenance protocols in effect.")
return
@@ -303,21 +303,21 @@
/obj/mecha/proc/domove(direction)
if(can_move >= world.time)
- return 0
+ return FALSE
if(!Process_Spacemove(direction))
- return 0
+ return FALSE
if(!has_charge(step_energy_drain))
- return 0
+ return FALSE
if(defence_mode)
if(world.time - last_message > 20)
occupant_message("Unable to move while in defence mode.")
last_message = world.time
- return 0
+ return FALSE
if(zoom_mode)
if(world.time - last_message > 20)
occupant_message("Unable to move while in zoom mode.")
last_message = world.time
- return 0
+ return FALSE
if(thrusters_active && has_gravity(src))
thrusters_active = FALSE
@@ -364,7 +364,7 @@
dir = direction
if(turnsound)
playsound(src,turnsound,40,1)
- return 1
+ return TRUE
/obj/mecha/proc/mechstep(direction)
. = step(src, direction)
@@ -387,25 +387,25 @@
/obj/mecha/Bump(atom/obstacle, bump_allowed)
if(throwing) //high velocity mechas in your face!
- var/breakthrough = 0
+ var/breakthrough = FALSE
if(istype(obstacle, /obj/structure/window))
qdel(obstacle)
- breakthrough = 1
+ breakthrough = TRUE
else if(istype(obstacle, /obj/structure/grille/))
var/obj/structure/grille/G = obstacle
G.obj_break()
- breakthrough = 1
+ breakthrough = TRUE
else if(istype(obstacle, /obj/structure/table))
var/obj/structure/table/T = obstacle
qdel(T)
- breakthrough = 1
+ breakthrough = TRUE
else if(istype(obstacle, /obj/structure/rack))
new /obj/item/rack_parts(obstacle.loc)
qdel(obstacle)
- breakthrough = 1
+ breakthrough = TRUE
else if(istype(obstacle, /obj/structure/reagent_dispensers/fueltank))
obstacle.ex_act(1)
@@ -421,7 +421,7 @@
L.Weaken(10 SECONDS)
L.apply_effect(STUTTER, 10 SECONDS)
playsound(src, pick(hit_sound), 50, 0, 0)
- breakthrough = 1
+ breakthrough = TRUE
else
if(throwing)
@@ -524,7 +524,7 @@
/obj/mecha/run_obj_armor(damage_amount, damage_type, damage_flag = 0, attack_dir)
. = ..()
if(!damage_amount)
- return 0
+ return FALSE
var/booster_deflection_modifier = 1
var/booster_damage_modifier = 1
if(damage_flag == BULLET || damage_flag == LASER || damage_flag == ENERGY)
@@ -547,7 +547,7 @@
if(prob(deflect_chance * booster_deflection_modifier))
visible_message("[src]'s armour deflects the attack!")
log_message("Armor saved.")
- return 0
+ return FALSE
if(.)
. *= booster_damage_modifier
@@ -729,7 +729,7 @@
to_chat(user, "Maintenance protocols disabled by operator.")
else if(istype(W, /obj/item/stack/cable_coil))
- if(state == 3 && hasInternalDamage(MECHA_INT_SHORT_CIRCUIT))
+ if(state == MECHA_OPEN_HATCH && hasInternalDamage(MECHA_INT_SHORT_CIRCUIT))
var/obj/item/stack/cable_coil/CC = W
if(CC.get_amount() > 1)
CC.use(2)
@@ -740,7 +740,7 @@
return
else if(istype(W, /obj/item/stock_parts/cell))
- if(state==4)
+ if(state == MECHA_BATTERY_UNSCREW)
if(!cell)
if(!user.drop_item())
return
@@ -819,16 +819,16 @@
/obj/mecha/crowbar_act(mob/user, obj/item/I)
- if(state != 2 && state != 3 && !(state == 4 && pilot_is_mmi()))
+ if(state != MECHA_BOLTS_UP && state != MECHA_OPEN_HATCH && !(state == MECHA_BATTERY_UNSCREW && pilot_is_mmi()))
return
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
- if(state == 2)
- state = 3
+ if(state == MECHA_BOLTS_UP)
+ state = MECHA_OPEN_HATCH
to_chat(user, "You open the hatch to the power unit")
- else if(state == 3)
- state = 2
+ else if(state == MECHA_OPEN_HATCH)
+ state = MECHA_BOLTS_UP
to_chat(user, "You close the hatch to the power unit")
else
// Since having maint protocols available is controllable by the MMI, I see this as a consensual way to remove an MMI without destroying the mech
@@ -841,7 +841,7 @@
/obj/mecha/screwdriver_act(mob/user, obj/item/I)
if(user.a_intent == INTENT_HARM)
return
- if(!(state==3 && cell) && !(state==4 && cell))
+ if(!(state == MECHA_OPEN_HATCH && cell) && !(state == MECHA_BATTERY_UNSCREW && cell))
return
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
@@ -849,27 +849,27 @@
if(hasInternalDamage(MECHA_INT_TEMP_CONTROL))
clearInternalDamage(MECHA_INT_TEMP_CONTROL)
to_chat(user, "You repair the damaged temperature controller.")
- else if(state==3 && cell)
+ else if(state == MECHA_OPEN_HATCH && cell)
cell.forceMove(loc)
cell = null
- state = 4
+ state = MECHA_BATTERY_UNSCREW
to_chat(user, "You unscrew and pry out the powercell.")
log_message("Powercell removed")
- else if(state==4 && cell)
- state=3
+ else if(state == MECHA_BATTERY_UNSCREW && cell)
+ state = MECHA_OPEN_HATCH
to_chat(user, "You screw the cell in place.")
/obj/mecha/wrench_act(mob/user, obj/item/I)
- if(state != 1 && state != 2)
+ if(state != MECHA_MAINT_ON && state != MECHA_BOLTS_UP)
return
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
- if(state==1)
- state = 2
+ if(state == MECHA_MAINT_ON)
+ state = MECHA_BOLTS_UP
to_chat(user, "You undo the securing bolts.")
else
- state = 1
+ state = MECHA_MAINT_ON
to_chat(user, "You tighten the securing bolts.")
/obj/mecha/welder_act(mob/user, obj/item/I)
@@ -884,7 +884,7 @@
if(repairing)
to_chat(user, "[src] is currently being repaired!")
return
- if(state == 0) // If maint protocols are not active, the state is zero
+ if(state == MECHA_MAINT_OFF) // If maint protocols are not active, the state is zero
to_chat(user, "[src] can not be repaired without maintenance protocols active!")
return
WELDER_ATTEMPT_REPAIR_MESSAGE
@@ -902,7 +902,7 @@
/obj/mecha/mech_melee_attack(obj/mecha/M)
if(!has_charge(melee_energy_drain))
- return 0
+ return FALSE
use_power(melee_energy_drain)
if(M.damtype == BRUTE || M.damtype == BURN)
add_attack_logs(M.occupant, src, "Mecha-attacked with [M] ([uppertext(M.occupant.a_intent)]) ([uppertext(M.damtype)])")
@@ -1068,11 +1068,11 @@
/obj/mecha/proc/connect(obj/machinery/atmospherics/unary/portables_connector/new_port)
//Make sure not already connected to something else
if(connected_port || !istype(new_port) || new_port.connected_device)
- return 0
+ return FALSE
//Make sure are close enough for a valid connection
if(new_port.loc != loc)
- return 0
+ return FALSE
//Perform the connection
connected_port = new_port
@@ -1088,14 +1088,14 @@
/obj/mecha/proc/disconnect()
if(!connected_port)
- return 0
+ return FALSE
connected_port.connected_device = null
connected_port = null
log_message("Disconnected from gas port.")
if(occupant)
occupant.clear_alert("mechaport_d")
- return 1
+ return TRUE
/obj/mecha/portableConnectorReturnAir()
return internal_tank.return_air()
@@ -1137,9 +1137,9 @@
if(dna)
if(ishuman(user))
if(user.dna.unique_enzymes == dna)
- passed = 1
+ passed = TRUE
else if(operation_allowed(user))
- passed = 1
+ passed = TRUE
if(!passed)
to_chat(user, "Access denied.")
log_append_to_last("Permission denied.")
@@ -1213,7 +1213,7 @@
to_chat(user, "Access denied. [name] is secured with an ID lock.")
return FALSE
- if(do_after(user, 40, target = src))
+ if(do_after(user, 4 SECONDS, target = src))
if(!occupant)
return mmi_moved_inside(mmi_as_oc,user)
else
@@ -1261,8 +1261,8 @@
var/mob/living/brain/brain = occupant
mob_container = brain.container
if(istype(mob_container, /obj/item/mmi))
- return 1
- return 0
+ return TRUE
+ return FALSE
/obj/mecha/proc/pilot_mmi_hud(mob/living/brain/pilot)
return
@@ -1349,34 +1349,34 @@
return 0
for(var/ID in list(H.get_active_hand(), H.wear_id, H.belt, H.wear_pda))
if(check_access(ID, operation_req_access))
- return 1
- return 0
+ return TRUE
+ return FALSE
/obj/mecha/proc/internals_access_allowed(mob/living/carbon/human/H)
for(var/atom/ID in list(H.get_active_hand(), H.wear_id, H.belt, H.wear_pda))
if(check_access(ID, internals_req_access))
- return 1
- return 0
+ return TRUE
+ return FALSE
/obj/mecha/check_access(obj/item/card/id/I, list/access_list)
if(!istype(access_list))
- return 1
+ return TRUE
if(!length(access_list)) //no requirements
- return 1
+ return TRUE
I = I?.GetID()
if(!istype(I) || !I.access) //not ID or no access
- return 0
+ return FALSE
if(access_list==operation_req_access)
for(var/req in access_list)
if(!(req in I.access)) //doesn't have this access
- return 0
+ return FALSE
else if(access_list==internals_req_access)
for(var/req in access_list)
if(req in I.access)
- return 1
- return 1
+ return TRUE
+ return TRUE
///////////////////////
///// MARK: Power stuff
@@ -1398,16 +1398,16 @@
cell.use(amount)
if(occupant)
update_cell()
- return 1
- return 0
+ return TRUE
+ return FALSE
/obj/mecha/proc/give_power(amount)
if(!isnull(get_charge()))
cell.give(amount)
if(occupant)
update_cell()
- return 1
- return 0
+ return TRUE
+ return FALSE
/obj/mecha/proc/update_cell()
if(cell)
diff --git a/code/game/mecha/mecha_topic.dm b/code/game/mecha/mecha_topic.dm
index afdee42432d..c41573b8b44 100644
--- a/code/game/mecha/mecha_topic.dm
+++ b/code/game/mecha/mecha_topic.dm
@@ -327,19 +327,19 @@
if(!in_range(src, usr)) return
var/mob/user = afilter.getMob("user")
if(user)
- if(state==0)
- state = 1
+ if(state == MECHA_MAINT_OFF)
+ state = MECHA_MAINT_ON
to_chat(user, "The securing bolts are now exposed.")
if(occupant)
occupant.throw_alert("locked", /atom/movable/screen/alert/mech_maintenance)
- else if(state==1)
- state = 0
+ else if(state == MECHA_MAINT_ON)
+ state = MECHA_MAINT_OFF
to_chat(user, "The securing bolts are now hidden.")
if(occupant)
occupant.clear_alert("locked")
output_maintenance_dialog(afilter.getObj("id_card"),user)
return
- if(href_list["set_internal_tank_valve"] && state >=1)
+ if(href_list["set_internal_tank_valve"] && state >= MECHA_MAINT_ON)
if(!in_range(src, usr)) return
var/mob/user = afilter.getMob("user")
if(user)
diff --git a/code/game/objects/items/stacks/nanopaste.dm b/code/game/objects/items/stacks/nanopaste.dm
index 53d367f3552..6c53d139848 100644
--- a/code/game/objects/items/stacks/nanopaste.dm
+++ b/code/game/objects/items/stacks/nanopaste.dm
@@ -18,7 +18,7 @@
if(R.getBruteLoss() || R.getFireLoss())
R.heal_overall_damage(15, 15)
use(1)
- user.visible_message("\The [user] applied some [src] at [R]'s damaged areas.",\
+ user.visible_message("[user] applies some [src] at [R]'s damaged areas.",\
"You apply some [src] at [R]'s damaged areas.")
else
to_chat(user, "All [R]'s systems are nominal.")
@@ -32,6 +32,28 @@
else
to_chat(user, "[src] won't work on that.")
+/obj/item/stack/nanopaste/afterattack(atom/A, mob/user, proximity_flag)
+ if(!ismecha(A) || user.a_intent == INTENT_HARM || !proximity_flag)
+ return
+ var/obj/mecha/mecha = A
+ if((mecha.obj_integrity >= mecha.max_integrity) && !mecha.internal_damage)
+ to_chat(user, "[mecha] is at full integrity!")
+ return
+ if(mecha.state == MECHA_MAINT_OFF)
+ to_chat(user, "[mecha] cannot be repaired without maintenance protocols active!")
+ return
+ if(mecha.repairing)
+ to_chat(user, "[mecha] is currently being repaired!")
+ return
+ if(mecha.internal_damage & MECHA_INT_TANK_BREACH)
+ mecha.clearInternalDamage(MECHA_INT_TANK_BREACH)
+ user.visible_message("[user] repairs the damaged air tank.", "You repair the damaged air tank.")
+ else if(mecha.obj_integrity < mecha.max_integrity)
+ mecha.obj_integrity += min(20, mecha.max_integrity - mecha.obj_integrity)
+ use(1)
+ user.visible_message("[user] applies some [src] to [mecha]'s damaged areas.",\
+ "You apply some [src] to [mecha]'s damaged areas.")
+
/obj/item/stack/nanopaste/proc/robotic_limb_repair(mob/user, obj/item/organ/external/external_limb, mob/living/carbon/human/H)
if(!external_limb.get_damage())
to_chat(user, "Nothing to fix here.")