diff --git a/aurorastation.dme b/aurorastation.dme
index 8597c8bff41..4ec1e45295b 100644
--- a/aurorastation.dme
+++ b/aurorastation.dme
@@ -1501,7 +1501,7 @@
#include "code\modules\heavy_vehicle\mech_wreckage.dm"
#include "code\modules\heavy_vehicle\mecha.dm"
#include "code\modules\heavy_vehicle\components\_components.dm"
-#include "code\modules\heavy_vehicle\components\armour.dm"
+#include "code\modules\heavy_vehicle\components\armor.dm"
#include "code\modules\heavy_vehicle\components\arms.dm"
#include "code\modules\heavy_vehicle\components\body.dm"
#include "code\modules\heavy_vehicle\components\frame.dm"
diff --git a/code/__defines/_macros.dm b/code/__defines/_macros.dm
index 05dd7e8685e..f5dad3c6bac 100644
--- a/code/__defines/_macros.dm
+++ b/code/__defines/_macros.dm
@@ -22,6 +22,8 @@
#define ishuman(A) istype(A, /mob/living/carbon/human)
+#define ismech(A) istype(A, /mob/living/heavy_vehicle)
+
#define isliving(A) istype(A, /mob/living)
#define israt(A) istype(A, /mob/living/simple_animal/rat)
diff --git a/code/__defines/qdel.dm b/code/__defines/qdel.dm
index b7cf56b65b0..ac86f23ef8a 100644
--- a/code/__defines/qdel.dm
+++ b/code/__defines/qdel.dm
@@ -20,3 +20,4 @@
#define QDEL_IN(item, time) addtimer(CALLBACK(GLOBAL_PROC, .proc/qdel, item), time, TIMER_STOPPABLE)
#define QDEL_NULL(item) qdel(item); item = null
+#define QDEL_NULL_LIST(x) if(x) { for(var/y in x) { qdel(y) }}; if(x) {x.Cut(); x = null } // Second x check to handle items that LAZYREMOVE on qdel.
diff --git a/code/game/machinery/portable_turret.dm b/code/game/machinery/portable_turret.dm
index e861dfe9539..23070d38b06 100644
--- a/code/game/machinery/portable_turret.dm
+++ b/code/game/machinery/portable_turret.dm
@@ -578,6 +578,11 @@
if(L.lying) //if the perp is lying down, it's still a target but a less-important target
return lethal ? TURRET_SECONDARY_TARGET : TURRET_NOT_TARGET
+ if(ismech(L))
+ var/mob/living/heavy_vehicle/M = L
+ if(!M.pilots?.len)
+ return TURRET_NOT_TARGET
+
return TURRET_PRIORITY_TARGET //if the perp has passed all previous tests, congrats, it is now a "shoot-me!" nominee
/obj/machinery/porta_turret/proc/assess_perp(var/mob/living/carbon/human/H)
@@ -1131,4 +1136,4 @@
#undef TURRET_PRIORITY_TARGET
#undef TURRET_SECONDARY_TARGET
-#undef TURRET_NOT_TARGET
\ No newline at end of file
+#undef TURRET_NOT_TARGET
diff --git a/code/modules/heavy_vehicle/components/armour.dm b/code/modules/heavy_vehicle/components/armor.dm
similarity index 76%
rename from code/modules/heavy_vehicle/components/armour.dm
rename to code/modules/heavy_vehicle/components/armor.dm
index 60bfd987966..92ecc43eb54 100644
--- a/code/modules/heavy_vehicle/components/armour.dm
+++ b/code/modules/heavy_vehicle/components/armor.dm
@@ -3,24 +3,24 @@
damage_flags &= ~(DAM_SHARP | DAM_EDGE)
. = ..()*/
-/obj/item/robot_parts/robot_component/armour
- name = "exosuit armour plating"
+/obj/item/robot_parts/robot_component/armor
+ name = "exosuit armor plating"
armor = list(melee = 75, bullet = 33, laser = 50, energy = 10, bomb = 25, bio = 100, rad = 0)
origin_tech = list(TECH_MATERIAL = 1)
-/obj/item/robot_parts/robot_component/armour/radproof
- name = "radiation-proof armour plating"
+/obj/item/robot_parts/robot_component/armor/radproof
+ name = "radiation-proof armor plating"
desc = "A fully enclosed radiation hardened shell designed to protect the pilot from radiation."
armor = list(melee = 75, bullet = 33, laser = 50, energy = 25, bomb = 25, bio = 100, rad = 100)
origin_tech = list(TECH_MATERIAL = 3)
-/obj/item/robot_parts/robot_component/armour/em
- name = "EM-shielded armour plating"
+/obj/item/robot_parts/robot_component/armor/em
+ name = "EM-shielded armor plating"
desc = "A shielded plating that sorrounds the eletronics and protects them from electromagnetic radiation."
armor = list(melee = 65, bullet = 20, laser = 25, energy = 100, bomb = 10, bio = 100, rad = 60)
origin_tech = list(TECH_MATERIAL = 3)
-/obj/item/robot_parts/robot_component/armour/combat
+/obj/item/robot_parts/robot_component/armor/combat
name = "heavy combat plating"
desc = "Plating designed to deflect incoming attacks and explosions."
armor = list(melee = 85, bullet = 70, laser = 60, energy = 10, bomb = 70, bio = 100, rad = 0)
diff --git a/code/modules/heavy_vehicle/components/body.dm b/code/modules/heavy_vehicle/components/body.dm
index e8614cad881..ebedbf7fa85 100644
--- a/code/modules/heavy_vehicle/components/body.dm
+++ b/code/modules/heavy_vehicle/components/body.dm
@@ -6,7 +6,7 @@
var/mech_health = 300
var/obj/item/robot_parts/robot_component/diagnosis_unit/diagnostics
var/obj/item/cell/cell
- var/obj/item/robot_parts/robot_component/armour/
+ var/obj/item/robot_parts/robot_component/armor/mech_armor
var/obj/machinery/portable_atmospherics/canister/air_supply
var/datum/gas_mixture/cockpit
var/pilot_offset_x = 0
@@ -22,7 +22,7 @@
/obj/item/mech_component/chassis/update_components()
diagnostics = locate() in src
cell = locate() in src
- armour = locate() in src
+ mech_armor = locate() in src
air_supply = locate() in src
/obj/item/mech_component/chassis/New()
@@ -40,7 +40,7 @@
/obj/item/mech_component/chassis/Destroy()
QDEL_NULL(cell)
QDEL_NULL(diagnostics)
- QDEL_NULL(armour)
+ QDEL_NULL(mech_armor)
QDEL_NULL(air_supply)
. = ..()
@@ -49,7 +49,7 @@
to_chat(user, "It is missing a power cell.")
if(!diagnostics)
to_chat(user, "It is missing a diagnostics unit.")
- if(!armour)
+ if(!mech_armor)
to_chat(user, "It is missing armor plating.")
/obj/item/mech_component/chassis/Initialize()
@@ -80,7 +80,7 @@
cockpit.react()
/obj/item/mech_component/chassis/ready_to_install()
- return (cell && diagnostics && armour)
+ return (cell && diagnostics && mech_armor)
/obj/item/mech_component/chassis/prebuild()
diagnostics = new(src)
@@ -98,12 +98,12 @@
to_chat(user, "\The [src] already has a cell installed.")
return
if(install_component(thing,user)) cell = thing
- else if(istype(thing, /obj/item/robot_parts/robot_component/armour))
- if(armour)
- to_chat(user, "\The [src] already has armour installed.")
+ else if(istype(thing, /obj/item/robot_parts/robot_component/armor))
+ if(mech_armor)
+ to_chat(user, "\The [src] already has mech_armor installed.")
return
if(install_component(thing, user))
- armour = thing
+ mech_armor = thing
else
return ..()
diff --git a/code/modules/heavy_vehicle/equipment/_equipment.dm b/code/modules/heavy_vehicle/equipment/_equipment.dm
index f715c010e3b..abe9ec34820 100644
--- a/code/modules/heavy_vehicle/equipment/_equipment.dm
+++ b/code/modules/heavy_vehicle/equipment/_equipment.dm
@@ -77,7 +77,6 @@
if(holding) //It'd be strange for this to be called with this var unset
destroyed_event.unregister(holding, src, .proc/forget_holding)
holding = null
- qdel(src)
/obj/item/mecha_equipment/mounted_system/Initialize()
. = ..()
diff --git a/code/modules/heavy_vehicle/interface/screen_objectsa.dm b/code/modules/heavy_vehicle/interface/screen_objectsa.dm
index ec198c59f67..a736771c9c7 100644
--- a/code/modules/heavy_vehicle/interface/screen_objectsa.dm
+++ b/code/modules/heavy_vehicle/interface/screen_objectsa.dm
@@ -33,6 +33,11 @@
maptext_y = 3
maptext_width = 72
+/obj/screen/movable/mecha/hardpoint/Destroy()
+ owner = null
+ holding = null
+ . = ..()
+
/obj/screen/movable/mecha/hardpoint/MouseDrop()
..()
if(holding) holding.screen_loc = screen_loc
diff --git a/code/modules/heavy_vehicle/mech_damage.dm b/code/modules/heavy_vehicle/mech_damage.dm
index c53e63c1a80..893d320c563 100644
--- a/code/modules/heavy_vehicle/mech_damage.dm
+++ b/code/modules/heavy_vehicle/mech_damage.dm
@@ -22,11 +22,6 @@
return def_zone
-/mob/living/heavy_vehicle/getarmor(var/def_zone, var/type)
- if(body.armour)
- return isnull(body.armour.armor[type]) ? 0 : body.armour.armor[type]
- return 0
-
/mob/living/heavy_vehicle/hitby(atom/movable/AM, speed)
if(LAZYLEN(pilots) && (!hatch_closed || !prob(body.pilot_coverage)))
var/mob/living/pilot = pick(pilots)
@@ -34,8 +29,8 @@
. = ..()
/mob/living/heavy_vehicle/getarmor(var/def_zone, var/type)
- if(body && body.armour)
- return isnull(body.armour.armor[type]) ? 0 : body.armour.armor[type]
+ if(body && body.mech_armor)
+ return isnull(body.mech_armor.armor[type]) ? 0 : body.mech_armor.armor[type]
return 0
/mob/living/heavy_vehicle/updatehealth()
@@ -73,9 +68,9 @@
//Only 2 types of damage concern mechs and vehicles
switch(damagetype)
if(BRUTE)
- adjustBruteLoss(damage, target)
+ adjustBruteLoss(damage * BLOCKED_MULT(blocked), target)
if(BURN)
- adjustFireLoss(damage, target)
+ adjustFireLoss(damage * BLOCKED_MULT(blocked), target)
if((damagetype == BRUTE || damagetype == BURN) && prob(25+(damage*2)))
spark(src, 3)
diff --git a/code/modules/heavy_vehicle/mech_interaction.dm b/code/modules/heavy_vehicle/mech_interaction.dm
index 702a40577a7..8286e5cc4e7 100644
--- a/code/modules/heavy_vehicle/mech_interaction.dm
+++ b/code/modules/heavy_vehicle/mech_interaction.dm
@@ -294,12 +294,14 @@
playsound(src.loc,legs.mech_turn_sound,40,1)
next_move = world.time + legs.turn_delay
set_dir(direction)
+ update_icon()
/mob/living/heavy_vehicle/Move()
if(..() && !istype(loc, /turf/space))
if(legs && legs.mech_step_sound)
playsound(src.loc,legs.mech_step_sound,40,1)
get_cell().use(legs.power_use * CELLRATE)
+ update_icon()
/mob/living/heavy_vehicle/attackby(var/obj/item/thing, var/mob/user)
if(user.a_intent != I_HURT && istype(thing, /obj/item/mecha_equipment))
diff --git a/code/modules/heavy_vehicle/mecha.dm b/code/modules/heavy_vehicle/mecha.dm
index 5525ea5bf24..923a7a186e2 100644
--- a/code/modules/heavy_vehicle/mecha.dm
+++ b/code/modules/heavy_vehicle/mecha.dm
@@ -72,13 +72,11 @@
pilot.forceMove(get_turf(src))
pilots = null
- for(var/thing in hud_elements)
- qdel(thing)
- hud_elements.Cut()
+ QDEL_NULL_LIST(hud_elements)
- for(var/hardpoint in hardpoints)
- qdel(hardpoints[hardpoint])
- hardpoints.Cut()
+ hardpoint_hud_elements = null
+
+ hardpoints = null
QDEL_NULL(access_card)
QDEL_NULL(arms)
@@ -86,13 +84,7 @@
QDEL_NULL(head)
QDEL_NULL(body)
- for(var/hardpoint in hardpoint_hud_elements)
- var/obj/screen/movable/mecha/hardpoint/H = hardpoint_hud_elements[hardpoint]
- H.owner = null
- H.holding = null
- qdel(H)
- hardpoint_hud_elements.Cut()
- ..()
+ . = ..()
/mob/living/heavy_vehicle/IsAdvancedToolUser()
return 1
diff --git a/code/modules/heavy_vehicle/premade/combat.dm b/code/modules/heavy_vehicle/premade/combat.dm
index 74e4cedff72..46dfd3f2320 100644
--- a/code/modules/heavy_vehicle/premade/combat.dm
+++ b/code/modules/heavy_vehicle/premade/combat.dm
@@ -66,7 +66,7 @@
/obj/item/mech_component/chassis/combat/prebuild()
. = ..()
- armor = new /obj/item/robot_parts/robot_component/armour/combat(src)
+ mech_armor = new /obj/item/robot_parts/robot_component/armor/combat(src)
/obj/item/mech_component/chassis/combat/Initialize()
pilot_positions = list(
diff --git a/code/modules/heavy_vehicle/premade/heavy.dm b/code/modules/heavy_vehicle/premade/heavy.dm
index 7ed0fc08655..2945ef0b2c6 100644
--- a/code/modules/heavy_vehicle/premade/heavy.dm
+++ b/code/modules/heavy_vehicle/premade/heavy.dm
@@ -68,7 +68,7 @@
/obj/item/mech_component/chassis/heavy/prebuild()
. = ..()
- armor = new /obj/item/robot_parts/robot_component/armour/combat(src)
+ mech_armor = new /obj/item/robot_parts/robot_component/armor/combat(src)
/obj/item/mech_component/chassis/superheavy
name = "reinforced exosuit chassis"
@@ -84,7 +84,7 @@
/obj/item/mech_component/chassis/superheavy/prebuild()
. = ..()
cell = new /obj/item/cell/super(src)
- armor = new /obj/item/robot_parts/robot_component/armour/combat(src)
+ mech_armor = new /obj/item/robot_parts/robot_component/armor/combat(src)
/mob/living/heavy_vehicle/premade/superheavy
name = "Marauder"
diff --git a/code/modules/heavy_vehicle/premade/light.dm b/code/modules/heavy_vehicle/premade/light.dm
index c4d1b9dd4d1..726ab03549a 100644
--- a/code/modules/heavy_vehicle/premade/light.dm
+++ b/code/modules/heavy_vehicle/premade/light.dm
@@ -76,7 +76,7 @@
/obj/item/mech_component/chassis/light/prebuild()
. = ..()
- armour = new /obj/item/robot_parts/robot_component/armour/radproof(src)
+ mech_armor = new /obj/item/robot_parts/robot_component/armor/radproof(src)
/obj/item/mech_component/chassis/light/Initialize()
pilot_positions = list(
diff --git a/code/modules/heavy_vehicle/premade/powerloader.dm b/code/modules/heavy_vehicle/premade/powerloader.dm
index 5a059a7d2e3..d04514e741e 100644
--- a/code/modules/heavy_vehicle/premade/powerloader.dm
+++ b/code/modules/heavy_vehicle/premade/powerloader.dm
@@ -16,7 +16,7 @@
body = new /obj/item/mech_component/chassis/ripley(src)
body.color = "#ffdc37"
- body.armour = new /obj/item/robot_parts/robot_component/armour(src)
+ body.armor = new /obj/item/robot_parts/robot_component/armour(src)
. = ..()
@@ -65,7 +65,7 @@
/obj/item/mech_component/chassis/ripley/prebuild()
. = ..()
- armour = new /obj/item/robot_parts/robot_component/armour(src)
+ armor = new /obj/item/robot_parts/robot_component/armour(src)
/obj/item/mech_component/chassis/ripley/Initialize()
pilot_positions = list(
@@ -149,7 +149,7 @@
body = new /obj/item/mech_component/chassis/ripley(src)
body.color = "#849bc1"
- body.armour = new /obj/item/robot_parts/robot_component/armour/combat(src)
+ body.mech_armor = new /obj/item/robot_parts/robot_component/armor/combat(src)
. = ..()
diff --git a/code/modules/mob/living/simple_animal/hostile/hostile.dm b/code/modules/mob/living/simple_animal/hostile/hostile.dm
index 31f8156fb32..dc545d10f6c 100644
--- a/code/modules/mob/living/simple_animal/hostile/hostile.dm
+++ b/code/modules/mob/living/simple_animal/hostile/hostile.dm
@@ -339,6 +339,11 @@ mob/living/simple_animal/hostile/hitby(atom/movable/AM as mob|obj,var/speed = TH
//////////////////////////////
/mob/living/simple_animal/hostile/proc/validator_living(var/mob/living/L, var/atom/current)
+ if(ismech(L))
+ var/mob/living/heavy_vehicle/M = L
+ if(!M.pilots?.len)
+ return FALSE
+
if((L.faction == src.faction) && !attack_same)
return FALSE
if(L in friends)
diff --git a/code/modules/research/designs/mechfab/mechs/designs_exosuits.dm b/code/modules/research/designs/mechfab/mechs/designs_exosuits.dm
index de47b38c8c3..d85b2fd8a84 100644
--- a/code/modules/research/designs/mechfab/mechs/designs_exosuits.dm
+++ b/code/modules/research/designs/mechfab/mechs/designs_exosuits.dm
@@ -56,7 +56,7 @@
/datum/design/item/mechfab/exosuit/radproof_armour
name = "radiation-proof exosuit armour"
id = "mech_armour_radproof"
- build_path = /obj/item/robot_parts/robot_component/armour/radproof
+ build_path = /obj/item/robot_parts/robot_component/armor/radproof
time = 50
req_tech = list(TECH_MATERIAL = 2, TECH_ENGINEERING = 2)
materials = list(DEFAULT_WALL_MATERIAL = 12500)
@@ -64,15 +64,15 @@
/datum/design/item/mechfab/exosuit/em_armour
name = "EM-shielded exosuit armour"
id = "mech_armour_em"
- build_path = /obj/item/robot_parts/robot_component/armour/em
+ build_path = /obj/item/robot_parts/robot_component/armor/em
time = 50
req_tech = list(TECH_MATERIAL = 2, TECH_POWER = 2)
materials = list(DEFAULT_WALL_MATERIAL = 12500, "silver" = 1000)
/datum/design/item/mechfab/exosuit/combat_armour
- name = "Combat exosuit armour"
+ name = "combat exosuit armor"
id = "mech_armour_combat"
- build_path = /obj/item/robot_parts/robot_component/armour/combat
+ build_path = /obj/item/robot_parts/robot_component/armor/combat
time = 50
req_tech = list(TECH_MATERIAL = 4, TECH_COMBAT = 3)
materials = list(DEFAULT_WALL_MATERIAL = 20000, "diamond" = 5000)
diff --git a/html/changelogs/Sindorman-mechs.yml b/html/changelogs/Sindorman-mechs.yml
new file mode 100644
index 00000000000..31eee2b94a0
--- /dev/null
+++ b/html/changelogs/Sindorman-mechs.yml
@@ -0,0 +1,43 @@
+################################
+# Example Changelog File
+#
+# Note: This file, and files beginning with ".", and files that don't end in ".yml" will not be read. If you change this file, you will look really dumb.
+#
+# Your changelog will be merged with a master changelog. (New stuff added only, and only on the date entry for the day it was merged.)
+# When it is, any changes listed below will disappear.
+#
+# Valid Prefixes:
+# bugfix
+# wip (For works in progress)
+# tweak
+# soundadd
+# sounddel
+# rscadd (general adding of nice things)
+# rscdel (general deleting of nice things)
+# imageadd
+# imagedel
+# maptweak
+# spellcheck (typo fixes)
+# experiment
+# balance
+# admin
+# backend
+# security
+# refactor
+#################################
+
+# Your name.
+author: PoZe
+
+# Optional: Remove this file after generating master changelog. Useful for PR changelogs that won't get used again.
+delete-after: True
+
+# Any changes you've made. See valid prefix list above.
+# INDENT WITH TWO SPACES. NOT TABS. SPACES.
+# SCREW THIS UP AND IT WON'T WORK.
+# Also, all entries are changed into a single [] after a master changelog generation. Just remove the brackets when you add new entries.
+# Please surround your changes in double quotes ("), as certain characters otherwise screws up compiling. The quotes will not show up in the changelog.
+changes:
+ - bugfix: "Mechs no longer runtime during destroy call."
+ - bugfix: "Turrets and NPCS no longer target empty mechs."
+ - bugfix: "Mechs no longer runtime during armor check. Mechs now use their armor and values for it. Before it would ignore them entirely and deal 100% damage."
diff --git a/maps/space_ruins/scrapheap.dmm b/maps/space_ruins/scrapheap.dmm
index f45f9cced6d..9eeecbc95bf 100644
--- a/maps/space_ruins/scrapheap.dmm
+++ b/maps/space_ruins/scrapheap.dmm
@@ -1506,7 +1506,7 @@
/turf/simulated/floor/tiled/dark,
/area/derelict/ship)
"er" = (
-/obj/item/robot_parts/robot_component/armour/combat,
+/obj/item/robot_parts/robot_component/armor/combat,
/obj/machinery/mech_recharger,
/turf/simulated/floor/tiled/dark,
/area/derelict/ship)