mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-22 11:37:40 +01:00
Nanopaste now can repair mecha (#25251)
* Nanopaste now can repair mecha * Update nanopaste.dm * refactor mech code * fix * Update code/game/objects/items/stacks/nanopaste.dm Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com> Signed-off-by: Сиротка <114731039+ErdGinalD@users.noreply.github.com> * Update nanopaste.dm * Update nanopaste.dm * Update nanopaste.dm * Update nanopaste.dm * Update code/game/objects/items/stacks/nanopaste.dm Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> Signed-off-by: Сиротка <114731039+ErdGinalD@users.noreply.github.com> * Update nanopaste.dm * Update code/game/objects/items/stacks/nanopaste.dm Co-authored-by: Matt <116982774+Burzah@users.noreply.github.com> Signed-off-by: Сиротка <114731039+ErdGinalD@users.noreply.github.com> * Update code/game/mecha/mecha.dm Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> Signed-off-by: Сиротка <114731039+ErdGinalD@users.noreply.github.com> * Update code/game/objects/items/stacks/nanopaste.dm Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> Signed-off-by: Сиротка <114731039+ErdGinalD@users.noreply.github.com> --------- Signed-off-by: Сиротка <114731039+ErdGinalD@users.noreply.github.com> Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com> Co-authored-by: DGamerL <108773801+DGamerL@users.noreply.github.com> Co-authored-by: Matt <116982774+Burzah@users.noreply.github.com> Co-authored-by: S34N <12197162+S34NW@users.noreply.github.com>
This commit is contained in:
co-authored by
Henri215
DGamerL
Matt
S34N
parent
d32d6ee9eb
commit
ccf5ef4fc4
@@ -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
|
||||
|
||||
+65
-65
@@ -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, "<span class='info'>You push off of [backup] to propel yourself.</span>")
|
||||
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, "<span class='notice'>You climb out from [src].</span>")
|
||||
return 0
|
||||
return FALSE
|
||||
if(connected_port)
|
||||
if(world.time - last_message > 20)
|
||||
occupant_message("<span class='warning'>Unable to move while connected to the air system port!</span>")
|
||||
last_message = world.time
|
||||
return 0
|
||||
return FALSE
|
||||
if(state)
|
||||
occupant_message("<span class='danger'>Maintenance protocols in effect.</span>")
|
||||
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("<span class='danger'>Unable to move while in defence mode.</span>")
|
||||
last_message = world.time
|
||||
return 0
|
||||
return FALSE
|
||||
if(zoom_mode)
|
||||
if(world.time - last_message > 20)
|
||||
occupant_message("<span class='danger'>Unable to move while in zoom mode.</span>")
|
||||
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("<span class='danger'>[src]'s armour deflects the attack!</span>")
|
||||
log_message("Armor saved.")
|
||||
return 0
|
||||
return FALSE
|
||||
if(.)
|
||||
. *= booster_damage_modifier
|
||||
|
||||
@@ -729,7 +729,7 @@
|
||||
to_chat(user, "<span class='warning'>Maintenance protocols disabled by operator.</span>")
|
||||
|
||||
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, "<span class='notice'>You repair the damaged temperature controller.</span>")
|
||||
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, "<span class='notice'>You unscrew and pry out the powercell.</span>")
|
||||
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, "<span class='notice'>You screw the cell in place.</span>")
|
||||
|
||||
/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, "<span class='notice'>[src] is currently being repaired!</span>")
|
||||
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, "<span class='warning'>[src] can not be repaired without maintenance protocols active!</span>")
|
||||
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, "<span class='warning'>Access denied.</span>")
|
||||
log_append_to_last("Permission denied.")
|
||||
@@ -1213,7 +1213,7 @@
|
||||
to_chat(user, "<span class='warning'>Access denied. [name] is secured with an ID lock.</span>")
|
||||
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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -18,7 +18,7 @@
|
||||
if(R.getBruteLoss() || R.getFireLoss())
|
||||
R.heal_overall_damage(15, 15)
|
||||
use(1)
|
||||
user.visible_message("<span class='notice'>\The [user] applied some [src] at [R]'s damaged areas.</span>",\
|
||||
user.visible_message("<span class='notice'>[user] applies some [src] at [R]'s damaged areas.</span>",\
|
||||
"<span class='notice'>You apply some [src] at [R]'s damaged areas.</span>")
|
||||
else
|
||||
to_chat(user, "<span class='notice'>All [R]'s systems are nominal.</span>")
|
||||
@@ -32,6 +32,28 @@
|
||||
else
|
||||
to_chat(user, "<span class='notice'>[src] won't work on that.</span>")
|
||||
|
||||
/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, "<span class='notice'>[mecha] is at full integrity!</span>")
|
||||
return
|
||||
if(mecha.state == MECHA_MAINT_OFF)
|
||||
to_chat(user, "<span class='warning'>[mecha] cannot be repaired without maintenance protocols active!</span>")
|
||||
return
|
||||
if(mecha.repairing)
|
||||
to_chat(user, "<span class='notice'>[mecha] is currently being repaired!</span>")
|
||||
return
|
||||
if(mecha.internal_damage & MECHA_INT_TANK_BREACH)
|
||||
mecha.clearInternalDamage(MECHA_INT_TANK_BREACH)
|
||||
user.visible_message("<span class='notice'>[user] repairs the damaged air tank.</span>", "<span class='notice'>You repair the damaged air tank.</span>")
|
||||
else if(mecha.obj_integrity < mecha.max_integrity)
|
||||
mecha.obj_integrity += min(20, mecha.max_integrity - mecha.obj_integrity)
|
||||
use(1)
|
||||
user.visible_message("<span class='notice'>[user] applies some [src] to [mecha]'s damaged areas.</span>",\
|
||||
"<span class='notice'>You apply some [src] to [mecha]'s damaged areas.</span>")
|
||||
|
||||
/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, "<span class='notice'>Nothing to fix here.</span>")
|
||||
|
||||
Reference in New Issue
Block a user