Skip to content

Commit

Permalink
Removes: Mech Armor, Adds: Mech armor to Mech Components (#8405)
Browse files Browse the repository at this point in the history
* Initial commit

* removed an oopsie

* Fixed a spelling mistake caused by search and replace

* Changes

* Removed minimum armor ablation

* Fixes, commenting out ablation, updates

* Fixed mech movement and reactions to getting hit

* Reverted an unnecessary and hamfisted change

* Part 1

* Fixed oopsies

* Updates directional armor mechanic

* Merge remote-tracking branch 'origin/mech_updates' into mech-tests

* Yeah

* Balance v1.0

* oop

* Update arms.dm

* Update mech_damage.dm

* Uh-huh

* ij

* aa

* aaa its al ldone

* ?

* Update

---------

Co-authored-by: FrownTown <57776842+FrownTown@users.noreply.github.com>
Co-authored-by: MLGTASTICa <ak9bc10d@yahoo.com>
  • Loading branch information
3 people authored Apr 5, 2024
1 parent cc4d43f commit 06011bf
Show file tree
Hide file tree
Showing 23 changed files with 316 additions and 137 deletions.
27 changes: 27 additions & 0 deletions code/__DEFINES/maths.dm
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,33 @@ proc/leftmost_bit(num)
pos++
return pos

proc/get_vector(dir) // Accepts a directional string and returns a list containing an actual vector
switch(dir)
if(NORTH)
return list(0, 1)
if(NORTHEAST)
return list(1, 1)
if(EAST)
return list(1, 0)
if(SOUTHEAST)
return list(1, -1)
if(SOUTH)
return list(0, -1)
if(SOUTHWEST)
return list(-1, -1)
if(WEST)
return list(-1, 0)
if(NORTHWEST)
return list(-1, 1)
else if(!dir)
return list(1, 0)

proc/get_vector_angle(vec1, vec2) // Calculates the angle between two vectors, then returns the angle. Uses degrees instead of radians because BYOND expects trig functions to be called with degrees.
var/dot = vec1[1] * vec2[1] + vec1[2] * vec2[2] // Calculate the dot product
var/mag1 = sqrt((vec1[1] ** 2) + (vec1[2] ** 2)) // Calculate the magnitudes of the vectors
var/mag2 = sqrt((vec2[1] ** 2) + (vec2[2] ** 2))
var/angle = arccos(dot / (mag1 * mag2)) // Calculate the angle based on the dot product and magnitudes of the vectors
return angle

#define T100C 373.15 // 100.0 degrees celsius

Expand Down
1 change: 1 addition & 0 deletions code/__DEFINES/misc.dm
Original file line number Diff line number Diff line change
Expand Up @@ -366,3 +366,4 @@
#define TTS_SEED_DEFAULT_FEMALE "Female_1"
#define TTS_SEED_DEFAULT_MALE "Male_1"
#define TTS_SEED_ANNOUNCER "Robot_2"

38 changes: 34 additions & 4 deletions code/modules/mechs/components/_components.dm
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
dir = SOUTH
bad_type = /obj/item/mech_component

armor = list(melee = 10, bullet = 10, energy = 10, bomb = 10, bio = 100, rad = 100) // Override these for individual components

price_tag = 150

var/on_mech_icon = MECH_PARTS_ICON
Expand All @@ -25,16 +27,34 @@
var/gib_hits = 0
/// wheter or not this component can just blow up
var/can_gib = FALSE
var/shielding = 0
var/emp_shielded = FALSE // Replacement for "energy" resisting both EMP and laser/plasma (guh)

// Multipliers for damage and deflection chances when mechs get struck from different directions
// Override these to change armor-facing effectiveness for different exosuits
// These are multipliers that increase or decrease effective armor by 25% from the front and rear, respectively, by default - they are not flat additions, and they impact both damage and deflection chance
var/front_mult = 1
var/side_mult = 1
var/rear_mult = 1

/obj/item/mech_component/Initialize()
. = ..()
if(islist(armor))
armor = getArmor(arglist(armor))
// else
// armor = getArmor() // In case someone leaves armor values for something unset for some reason

/obj/item/mech_component/proc/set_colour(new_colour)
var/last_colour = color
color = new_colour
return color != last_colour

/obj/item/mech_component/emp_act(severity)
take_burn_damage(rand((10 - (severity*3)),15-(severity*4)))
for(var/obj/item/thing in contents)
thing.emp_act(severity)
if(!emp_shielded)
take_burn_damage(rand((10 - (severity*3)),15-(severity*4)))
for(var/obj/item/thing in contents)
thing.emp_act(severity)
else return

/obj/item/mech_component/examine(mob/user)
. = ..()
Expand All @@ -44,6 +64,11 @@
to_chat(user, SPAN_NOTICE("It is ready for installation."))
else
show_missing_parts(usr)
if(emp_shielded)
to_chat(user, SPAN_NOTICE("This component is fitted with a Faraday cage, making it resistant against electromagnetic pulses."))
if(front_mult != 1 || side_mult != 1 || rear_mult != 1)
to_chat(user, SPAN_NOTICE("This component has uneven armor distribution. Frontal armor is multiplied by [front_mult], side armor by [side_mult] and the rear plates by [rear_mult]"))

/*
if(reinforcement)
to_chat(user, SPAN_NOTICE("It is reinforced with sheets of [reinforcement.material_display_name]."))
Expand All @@ -54,6 +79,7 @@
var/damage_string = src.get_damage_string()
to_chat(user, "The [src.name] [src.gender == PLURAL ? "are" : "is"] [damage_string].")


/*
/obj/item/mech_component/attackby(obj/item/I, mob/living/user)
Expand Down Expand Up @@ -161,7 +187,11 @@

/obj/item/mech_component/proc/return_diagnostics(var/mob/user)
to_chat(user, SPAN_NOTICE("[capitalize(name)]:"))
to_chat(user, SPAN_NOTICE(" - Integrity: <b>[round((((max_damage - total_damage) / max_damage)) * 100)]%</b>" ))
to_chat(user, SPAN_NOTICE(" - Hull Integrity: <b>[round((((max_damage - total_damage) / max_damage)) * 100)]%</b>" ))
// if(cur_armor > 0)
// to_chat(user, SPAN_NOTICE(" - Armor Integrity: <b>[round((((max_armor - cur_armor) / max_armor)) * 100)]%</b>"))
// else
// to_chat(user, SPAN_WARNING(" - Armor integrity failure!"))

/obj/item/mech_component/attackby(obj/item/I, mob/living/user)
var/list/usable_qualities = list(QUALITY_PULSING, QUALITY_BOLT_TURNING, QUALITY_WELDING, QUALITY_PRYING, QUALITY_SCREW_DRIVING)
Expand Down
3 changes: 2 additions & 1 deletion code/modules/mechs/components/armour.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
if(prob(get_blocked(damage_type, damage_flags, armor_pen) * 100)) //extra removal of sharp and edge on account of us being big robots
damage_flags &= ~(DAM_SHARP | DAM_EDGE)
. = ..()
*/
/obj/item/robot_parts/robot_component/armour/exosuit
name = "exosuit armor plating"
Expand Down Expand Up @@ -46,3 +46,4 @@
matter = list(MATERIAL_STEEL = 20, MATERIAL_DIAMOND = 5, MATERIAL_URANIUM = 5)
spawn_blacklisted = FALSE
price_tag = 1000
*/
23 changes: 20 additions & 3 deletions code/modules/mechs/components/arms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,11 @@
can_force_doors = FALSE
max_damage = 90
power_use = 30
armor = list(melee = 20, bullet = 10, energy = 5, bomb = 60, bio = 100, rad = 0)
shielding = 5

front_mult = 1.2
rear_mult = 0.8

/obj/item/mech_component/manipulators/light
name = "light arms"
Expand All @@ -71,7 +76,9 @@
can_force_doors = FALSE
max_damage = 45
power_use = 10
matter = list(MATERIAL_STEEL = 10, MATERIAL_PLASTIC = 5)
emp_shielded = TRUE
matter = list(MATERIAL_STEEL = 10, MATERIAL_PLASTIC = 6)
armor = list(melee = 16, bullet = 8, energy = 4, bomb = 40, bio = 100, rad = 100)

/obj/item/mech_component/manipulators/combat
name = "combat arms"
Expand All @@ -82,7 +89,12 @@
action_delay = 10
max_damage = 125
power_use = 50
matter = list(MATERIAL_STEEL = 15, MATERIAL_PLASTEEL = 5, MATERIAL_PLASMA = 4, MATERIAL_DIAMOND = 2)
matter = list(MATERIAL_STEEL = 16, MATERIAL_PLASTEEL = 6, MATERIAL_PLASMA = 4, MATERIAL_DIAMOND = 2)
armor = list(melee = 26, bullet = 22, energy = 16, bomb = 100, bio = 100, rad = 100)
shielding = 10

front_mult = 1.2
rear_mult = 0.8

/obj/item/mech_component/manipulators/heavy
name = "heavy arms"
Expand All @@ -93,4 +105,9 @@
action_delay = 20
max_damage = 175
power_use = 60
matter = list(MATERIAL_STEEL = 20, MATERIAL_PLASTEEL = 10, MATERIAL_URANIUM = 5)
matter = list(MATERIAL_STEEL = 24, MATERIAL_PLASTEEL = 10, MATERIAL_URANIUM = 6)
armor = list(melee = 32, bullet = 24, energy = 20, bomb = 160, bio = 100, rad = 100)
shielding = 15

front_mult = 1.2
rear_mult = 0.8
41 changes: 17 additions & 24 deletions code/modules/mechs/components/body.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
var/mech_health = 300
var/obj/item/cell/cell
var/obj/item/robot_parts/robot_component/diagnosis_unit/diagnostics
var/obj/item/robot_parts/robot_component/armour/exosuit/armor_plate
var/obj/item/robot_parts/robot_component/exosuit_control/computer
var/obj/machinery/portable_atmospherics/canister/air_supply
var/obj/item/storage/mech/storage_compartment
Expand Down Expand Up @@ -63,7 +62,6 @@
/obj/item/mech_component/chassis/Destroy()
QDEL_NULL(cell)
QDEL_NULL(computer)
QDEL_NULL(armor_plate)
QDEL_NULL(air_supply)
QDEL_NULL(diagnostics)
QDEL_NULL(storage_compartment)
Expand All @@ -75,8 +73,6 @@
cell = null
if(A == computer)
computer = null
if(A == armor_plate)
armor_plate = null
if(A == air_supply)
air_supply = null
if(A == diagnostics)
Expand All @@ -88,16 +84,13 @@
. = ..()
cell = locate() in src
computer = locate() in src
armor_plate = locate() in src
air_supply = locate() in src
diagnostics = locate() in src
storage_compartment = locate() in src

/obj/item/mech_component/chassis/show_missing_parts(var/mob/user)
if(!cell)
to_chat(user, SPAN_WARNING("It is missing a power cell."))
if(!armor_plate)
to_chat(user, SPAN_WARNING("It is missing exosuit armor plating."))
if(!computer)
to_chat(user, SPAN_WARNING("It is missing a control computer."))
if(!diagnostics)
Expand Down Expand Up @@ -132,7 +125,7 @@
cockpit.react()

/obj/item/mech_component/chassis/ready_to_install()
return (cell && armor_plate && computer && diagnostics)
return (cell && computer && diagnostics)

/obj/item/mech_component/chassis/update_health()
. = ..()
Expand All @@ -146,7 +139,6 @@

/obj/item/mech_component/chassis/prebuild()
computer = new /obj/item/robot_parts/robot_component/exosuit_control(src)
armor = new /obj/item/robot_parts/robot_component/armour/exosuit(src)
cell = new /obj/item/cell/large/high(src)
diagnostics = new /obj/item/robot_parts/robot_component/diagnosis_unit(src)

Expand All @@ -163,20 +155,12 @@
return
if(insert_item(I, user))
cell = I
else if(istype(I, /obj/item/robot_parts/robot_component/armour/exosuit))
if(armor_plate)
to_chat(user, SPAN_WARNING("\The [src] already has armor installed."))
return
else if(insert_item(I, user))
armor_plate = I
else if(istype(I, /obj/item/robot_parts/robot_component/diagnosis_unit))
if(diagnostics)
to_chat(user, SPAN_WARNING("\The [src] already has a diagnosis unit installed."))
return
else if(insert_item(I, user))
diagnostics = I


else
return ..()

Expand All @@ -199,10 +183,6 @@
to_chat(user, SPAN_NOTICE(" Diagnostics Unit Integrity: <b>[round((((diagnostics.max_dam - diagnostics.total_dam) / diagnostics.max_dam)) * 100)]%</b>"))
else
to_chat(user, SPAN_WARNING(" Diagnostics Unit Missing or Non-functional."))
if(armor_plate)
to_chat(user, SPAN_NOTICE(" Armor Integrity: <b>[round((((armor_plate.max_dam - armor_plate.total_dam) / armor_plate.max_dam)) * 100)]%</b>"))
else
to_chat(user, SPAN_WARNING(" Armor Missing or Non-functional."))
if(computer)
to_chat(user, SPAN_NOTICE(" Installed Software"))
for(var/exosystem_computer in computer.installed_software)
Expand All @@ -225,6 +205,9 @@
max_damage = 150
power_use = 0
climb_time = 7 // Quickest entry because it's unsealed
armor = list(melee = 24, bullet = 10, energy = 4, bomb = 60, bio = 100, rad = 0)
shielding = 5
rear_mult = 1.2

/obj/item/mech_component/chassis/cheap/Initialize()
pilot_positions = list(
Expand Down Expand Up @@ -254,9 +237,11 @@
icon_state = "light_body"
max_damage = 75
power_use = 5
emp_shielded = TRUE
climb_time = 10 //gets a buff to climb_time, in exchange for being less beefy
has_hardpoints = list(HARDPOINT_BACK, HARDPOINT_RIGHT_SHOULDER)
matter = list(MATERIAL_STEEL = 20, MATERIAL_GLASS = 5, MATERIAL_PLASTIC = 10)
matter = list(MATERIAL_STEEL = 20, MATERIAL_GLASS = 6, MATERIAL_PLASTIC = 10)
armor = list(melee = 16, bullet = 8, energy = 4, bomb = 40, bio = 100, rad = 100)

/obj/item/mech_component/chassis/combat
name = "sealed exosuit chassis"
Expand All @@ -271,7 +256,11 @@
mech_health = 500 //It's not as beefy as the heavy, but it IS a combat chassis, so let's make it slightly beefier
power_use = 40
climb_time = 25 //standard values for now to encourage use over heavy
matter = list(MATERIAL_STEEL = 45, MATERIAL_PLASTEEL = 12, MATERIAL_GOLD = 4, MATERIAL_SILVER = 4)
matter = list(MATERIAL_STEEL = 46, MATERIAL_PLASTEEL = 12, MATERIAL_GOLD = 4, MATERIAL_SILVER = 4)
armor = list(melee = 26, bullet = 22, energy = 16, bomb = 100, bio = 100, rad = 100)
shielding = 10
front_mult = 1.25
rear_mult = 0.75

/obj/item/mech_component/chassis/heavy
name = "reinforced exosuit chassis"
Expand All @@ -285,6 +274,10 @@
power_use = 50
climb_time = 35 //Takes longer to climb into, but is beefy as HELL.
matter = list(MATERIAL_STEEL = 50, MATERIAL_URANIUM = 20, MATERIAL_PLASTEEL = 20)
armor = list(melee = 32, bullet = 24, energy = 20, bomb = 160, bio = 100, rad = 100)
shielding = 15
front_mult = 1.5
rear_mult = 0.75

/obj/item/mech_component/chassis/forklift
name = "forklift chassis"
Expand All @@ -297,7 +290,7 @@
mech_health = 200
opaque_chassis = FALSE
matter = list(MATERIAL_STEEL = 20, MATERIAL_PLASTIC = 10)

armor = list(melee = 20, bullet = 8, energy = 4, bomb = 50, bio = 100, rad = 0)

/obj/item/mech_component/chassis/forklift/Initialize()
pilot_positions = list(
Expand Down
15 changes: 14 additions & 1 deletion code/modules/mechs/components/head.dm
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,8 @@
desc = "A primitive set of sensors designed to provide basic visual information to the pilot."
max_damage = 125
power_use = 0
armor = list(melee = 20, bullet = 10, energy = 5, bomb = 60, bio = 100, rad = 0)
shielding = 5

/obj/item/mech_component/sensors/light
name = "light sensors"
Expand All @@ -99,7 +101,12 @@
vision_flags = SEE_TURFS
see_invisible = SEE_INVISIBLE_NOLIGHTING
power_use = 50
emp_shielded = TRUE
matter = list(MATERIAL_STEEL = 10, MATERIAL_GLASS = 5, MATERIAL_SILVER = 2) //NVG takes uranium, but mecha NVGs are bugged & it's mecha-sized so let's not
armor = list(melee = 16, bullet = 8, energy = 4, bomb = 40, bio = 100, rad = 100)

front_mult = 0.5


/obj/item/mech_component/sensors/combat
name = "combat sensors"
Expand All @@ -111,7 +118,11 @@
see_invisible = SEE_INVISIBLE_NOLIGHTING
max_damage = 75 //the sensors are delicate, the value of this part is in the SEE_MOBS flag anyway
power_use = 200
matter = list(MATERIAL_STEEL = 10, MATERIAL_GLASS = 5, MATERIAL_GOLD = 7, MATERIAL_SILVER = 7, MATERIAL_URANIUM = 7)
matter = list(MATERIAL_STEEL = 10, MATERIAL_GLASS = 6, MATERIAL_GOLD = 8, MATERIAL_SILVER = 8, MATERIAL_URANIUM = 8)
armor = list(melee = 26, bullet = 22, energy = 16, bomb = 100, bio = 100, rad = 100)
shielding = 10

front_mult = 0.75

/obj/item/mech_component/sensors/heavy
name = "heavy sensors"
Expand All @@ -121,3 +132,5 @@
max_damage = 200
power_use = 0
matter = list(MATERIAL_STEEL = 20, MATERIAL_PLASTEEL = 8, MATERIAL_URANIUM = 6)
armor = list(melee = 32, bullet = 24, energy = 20, bomb = 160, bio = 100, rad = 100)
shielding = 15
Loading

0 comments on commit 06011bf

Please sign in to comment.