mirror of
https://github.com/yogstation13/Yogstation.git
synced 2025-02-26 09:04:50 +00:00
Reworks Mech pilot suits to instead be a component (#16524)
* Reworks EVA suits to instead be a clothing variable * Now a component instead of a variable * random recompile * Lets people also get the component, not just clothing * random recompile to fix lintbot * Updates melee weapons * only checks the jumpsuit rather than every clothing item
This commit is contained in:
7
code/datums/components/mech_pilot.dm
Normal file
7
code/datums/components/mech_pilot.dm
Normal file
@@ -0,0 +1,7 @@
|
||||
/// A component for clothes that affect one's ability to pilot mechs
|
||||
/datum/component/mech_pilot
|
||||
/// Modifier of mech delay, based on percentage 1 = 100%. lower is faster
|
||||
var/piloting_speed = 1
|
||||
|
||||
/datum/component/mech_pilot/Initialize(_piloting_speed = 1)
|
||||
piloting_speed = _piloting_speed
|
||||
@@ -109,7 +109,7 @@
|
||||
/obj/item/mecha_parts/mecha_equipment/proc/start_cooldown()
|
||||
set_ready_state(0)
|
||||
chassis.use_power(energy_drain)
|
||||
addtimer(CALLBACK(src, .proc/set_ready_state, 1), equip_cooldown * (check_eva() ? EVA_MODIFIER : 1))
|
||||
addtimer(CALLBACK(src, .proc/set_ready_state, 1), equip_cooldown * check_eva())
|
||||
|
||||
/obj/item/mecha_parts/mecha_equipment/proc/do_after_cooldown(atom/target)
|
||||
if(!chassis)
|
||||
@@ -117,7 +117,7 @@
|
||||
var/C = chassis.loc
|
||||
set_ready_state(0)
|
||||
chassis.use_power(energy_drain)
|
||||
. = do_after(chassis.occupant, equip_cooldown * (check_eva() ? EVA_MODIFIER : 1), target)
|
||||
. = do_after(chassis.occupant, equip_cooldown * check_eva(), target)
|
||||
set_ready_state(1)
|
||||
if(!chassis || chassis.loc != C || src != chassis.selected || !(get_dir(chassis, target)&chassis.dir))
|
||||
return 0
|
||||
|
||||
@@ -50,7 +50,7 @@
|
||||
/obj/item/mecha_parts/mecha_equipment/melee_weapon/start_cooldown()
|
||||
set_ready_state(0)
|
||||
chassis.use_power(energy_drain)
|
||||
addtimer(CALLBACK(src, .proc/set_ready_state, 1), chassis.melee_cooldown * attack_speed_modifier * (check_eva() ? EVA_MODIFIER : 1)) //Guns only shoot so fast, but weapons can be used as fast as the chassis can swing it!
|
||||
addtimer(CALLBACK(src, .proc/set_ready_state, 1), chassis.melee_cooldown * attack_speed_modifier * check_eva()) //Guns only shoot so fast, but weapons can be used as fast as the chassis can swing it!
|
||||
|
||||
//Melee weapon attacks are a little different in that they'll override the standard melee attack
|
||||
/obj/item/mecha_parts/mecha_equipment/melee_weapon/action(atom/target, params)
|
||||
|
||||
@@ -11,8 +11,6 @@
|
||||
#define SIDE_ARMOUR 2
|
||||
#define BACK_ARMOUR 3
|
||||
|
||||
#define EVA_MODIFIER 0.8
|
||||
|
||||
/obj/mecha
|
||||
name = "mecha"
|
||||
desc = "Exosuit"
|
||||
@@ -673,18 +671,18 @@
|
||||
var/move_result = 0
|
||||
var/oldloc = loc
|
||||
if(internal_damage & MECHA_INT_CONTROL_LOST)
|
||||
set_glide_size(DELAY_TO_GLIDE_SIZE(step_in * (check_eva() ? EVA_MODIFIER : 1)))
|
||||
set_glide_size(DELAY_TO_GLIDE_SIZE(step_in * check_eva()))
|
||||
move_result = mechsteprand()
|
||||
else if(dir != direction && (!strafe || occupant?.client?.prefs.bindings.isheld_key("Alt")))
|
||||
move_result = mechturn(direction)
|
||||
else
|
||||
set_glide_size(DELAY_TO_GLIDE_SIZE(step_in * (check_eva() ? EVA_MODIFIER : 1)))
|
||||
set_glide_size(DELAY_TO_GLIDE_SIZE(step_in * check_eva()))
|
||||
move_result = mechstep(direction)
|
||||
if(move_result || loc != oldloc)// halfway done diagonal move still returns false
|
||||
use_power(step_energy_drain)
|
||||
if(leg_overload_mode)
|
||||
take_damage(2, BRUTE)
|
||||
can_move = world.time + step_in * (check_eva() ? EVA_MODIFIER : 1)
|
||||
can_move = world.time + step_in * check_eva()
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
@@ -728,7 +726,7 @@
|
||||
flick(phase_state, src)
|
||||
forceMove(newloc)
|
||||
use_power(phasing_energy_drain)
|
||||
sleep(step_in * (check_eva() ? 0.8 : 1)*3)
|
||||
sleep(step_in * check_eva()*3)
|
||||
can_move = TRUE
|
||||
else
|
||||
if(..()) //mech was thrown
|
||||
@@ -1289,9 +1287,18 @@ GLOBAL_VAR_INIT(year_integer, text2num(year)) // = 2013???
|
||||
to_chat(user, span_notice("None of the equipment on this exosuit can use this ammo!"))
|
||||
return FALSE
|
||||
|
||||
// Is the occupant wearing a pilot suit?
|
||||
// Checks the pilot and their clothing for mech speed buffs
|
||||
/obj/mecha/proc/check_eva()
|
||||
var/evaNum = 1
|
||||
if(ishuman(occupant))
|
||||
var/mob/living/carbon/human/H = occupant
|
||||
return istype(H.w_uniform, /obj/item/clothing/under/mech_suit)
|
||||
return FALSE
|
||||
var/mob/living/carbon/human/H = occupant //if the person is skilled
|
||||
var/datum/component/mech_pilot/skill = H.GetComponent(/datum/component/mech_pilot)
|
||||
if(skill)
|
||||
evaNum *= skill.piloting_speed
|
||||
|
||||
var/obj/item/clothing/under/clothes = H.get_item_by_slot(SLOT_WEAR_SUIT) //if the suit directly assists the pilot
|
||||
if(clothes)
|
||||
var/datum/component/mech_pilot/MP = clothes.GetComponent(/datum/component/mech_pilot)
|
||||
if(MP)
|
||||
evaNum *= MP.piloting_speed
|
||||
return evaNum
|
||||
|
||||
@@ -791,6 +791,10 @@
|
||||
alternate_worn_layer = GLOVES_LAYER //covers hands but gloves can go over it. This is how these things work in my head.
|
||||
can_adjust = FALSE
|
||||
|
||||
/obj/item/clothing/under/mech_suit/ComponentInitialize()
|
||||
..()
|
||||
AddComponent(/datum/component/mech_pilot, 0.8)
|
||||
|
||||
/obj/item/clothing/under/mech_suit/white
|
||||
name = "white mech pilot's suit"
|
||||
desc = "A white mech pilot's suit. Very fetching."
|
||||
|
||||
@@ -439,6 +439,7 @@
|
||||
#include "code\datums\components\lockon_aiming.dm"
|
||||
#include "code\datums\components\magnetic_catch.dm"
|
||||
#include "code\datums\components\material_container.dm"
|
||||
#include "code\datums\components\mech_pilot.dm"
|
||||
#include "code\datums\components\mirage_border.dm"
|
||||
#include "code\datums\components\mood.dm"
|
||||
#include "code\datums\components\nanites.dm"
|
||||
|
||||
Reference in New Issue
Block a user