Skip to content

Commit

Permalink
Refactor marine_armor.dm and split it into multiples files. (#5740)
Browse files Browse the repository at this point in the history
# About the pull request
1-Refactor the marine_armor.dm file by splitting them into multiples
files.
2-in marine_armor.dm i also remove a serie of duplicate declaration of
the same items.
<!-- Remove this text and explain what the purpose of your PR is.

Mention if you have tested your changes. If you changed a map, make sure
you used the mapmerge tool.
If this is an Issue Correction, you can type "Fixes Issue #169420" to
link the PR to the corresponding Issue number #169420.

Remember: something that is self-evident to you might not be to others.
Explain your rationale fully, even if you feel it goes without saying.
-->

# Explain why it's good for the game
# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog
:cl:
refactor: refactor marine_armor.dm and split it into multiples files.
/:cl:

---------

Co-authored-by: Julien <[email protected]>
Co-authored-by: SabreML <[email protected]>
  • Loading branch information
3 people committed Feb 24, 2024
1 parent 159bc59 commit 747b74d
Show file tree
Hide file tree
Showing 8 changed files with 1,987 additions and 2,009 deletions.
2,008 changes: 0 additions & 2,008 deletions code/modules/clothing/suits/marine_armor.dm

This file was deleted.

669 changes: 669 additions & 0 deletions code/modules/clothing/suits/marine_armor/_marine_armor.dm

Large diffs are not rendered by default.

822 changes: 822 additions & 0 deletions code/modules/clothing/suits/marine_armor/ert.dm

Large diffs are not rendered by default.

162 changes: 162 additions & 0 deletions code/modules/clothing/suits/marine_armor/ghillie.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
#define FULL_CAMOUFLAGE_ALPHA 15

/obj/item/clothing/suit/storage/marine/ghillie
name = "\improper M45 pattern ghillie armor"
desc = "A lightweight ghillie camouflage suit, used by USCM snipers on recon missions. Very lightweight, but doesn't protect much."
icon_state = "ghillie_armor"
armor_bio = CLOTHING_ARMOR_MEDIUMHIGH
slowdown = SLOWDOWN_ARMOR_LIGHT
flags_marine_armor = ARMOR_LAMP_OVERLAY
flags_item = MOB_LOCK_ON_EQUIP
specialty = "M45 pattern ghillie"
valid_accessory_slots = list(ACCESSORY_SLOT_ARMBAND, ACCESSORY_SLOT_DECOR, ACCESSORY_SLOT_MEDAL, ACCESSORY_SLOT_PONCHO)
restricted_accessory_slots = list(ACCESSORY_SLOT_ARMBAND)

var/camo_active = FALSE
var/hide_in_progress = FALSE
var/full_camo_alpha = FULL_CAMOUFLAGE_ALPHA
var/incremental_shooting_camo_penalty = 35
var/current_camo = FULL_CAMOUFLAGE_ALPHA
var/camouflage_break = 5 SECONDS
var/camouflage_enter_delay = 4 SECONDS
var/can_camo = TRUE

actions_types = list(/datum/action/item_action/toggle, /datum/action/item_action/specialist/prepare_position)

/obj/item/clothing/suit/storage/marine/ghillie/dropped(mob/user)
if(ishuman(user) && !issynth(user))
deactivate_camouflage(user, FALSE)

. = ..()

/obj/item/clothing/suit/storage/marine/ghillie/verb/camouflage()
set name = "Prepare Position"
set desc = "Use the ghillie suit and the nearby environment to become near invisible."
set category = "Object"
set src in usr
if(!usr || usr.is_mob_incapacitated(TRUE))
return

if(!ishuman(usr) || hide_in_progress || !can_camo)
return
var/mob/living/carbon/human/H = usr
if(!skillcheck(H, SKILL_SPEC_WEAPONS, SKILL_SPEC_ALL) && H.skills.get_skill_level(SKILL_SPEC_WEAPONS) != SKILL_SPEC_SNIPER && !(GLOB.character_traits[/datum/character_trait/skills/spotter] in H.traits))
to_chat(H, SPAN_WARNING("You don't seem to know how to use [src]..."))
return
if(H.wear_suit != src)
to_chat(H, SPAN_WARNING("You must be wearing the ghillie suit to activate it!"))
return

if(camo_active)
deactivate_camouflage(H)
return

H.visible_message(SPAN_DANGER("[H] goes prone, and begins adjusting \his ghillie suit!"), SPAN_NOTICE("You go prone, and begins adjusting your ghillie suit."), max_distance = 4)
hide_in_progress = TRUE
H.unset_interaction() // If we're sticking to a machine gun or what not.
if(!do_after(H, camouflage_enter_delay, INTERRUPT_NO_NEEDHAND|BEHAVIOR_IMMOBILE, BUSY_ICON_BUILD))
hide_in_progress = FALSE
return
hide_in_progress = FALSE
RegisterSignal(H, list(
COMSIG_MOB_FIRED_GUN,
COMSIG_MOB_FIRED_GUN_ATTACHMENT)
, PROC_REF(fade_in))
RegisterSignal(H, list(
COMSIG_MOB_DEATH,
COMSIG_HUMAN_EXTINGUISH
), PROC_REF(deactivate_camouflage))
camo_active = TRUE
H.alpha = full_camo_alpha
H.FF_hit_evade = 1000
ADD_TRAIT(H, TRAIT_UNDENSE, SPECIALIST_GEAR_TRAIT)

RegisterSignal(H, COMSIG_MOB_MOVE_OR_LOOK, PROC_REF(handle_mob_move_or_look))

var/datum/mob_hud/security/advanced/SA = GLOB.huds[MOB_HUD_SECURITY_ADVANCED]
SA.remove_from_hud(H)
var/datum/mob_hud/xeno_infection/XI = GLOB.huds[MOB_HUD_XENO_INFECTION]
XI.remove_from_hud(H)

anim(H.loc, H, 'icons/mob/mob.dmi', null, "cloak", null, H.dir)


/obj/item/clothing/suit/storage/marine/ghillie/proc/deactivate_camouflage(mob/user)
SIGNAL_HANDLER
var/mob/living/carbon/human/H = user
if(!istype(H))
return FALSE

if(!camo_active)
return

UnregisterSignal(H, list(
COMSIG_MOB_FIRED_GUN,
COMSIG_MOB_FIRED_GUN_ATTACHMENT,
COMSIG_MOB_DEATH,
COMSIG_HUMAN_EXTINGUISH,
COMSIG_MOB_MOVE_OR_LOOK
))

camo_active = FALSE
animate(H, alpha = initial(H.alpha), flags = ANIMATION_END_NOW)
H.FF_hit_evade = initial(H.FF_hit_evade)
REMOVE_TRAIT(H, TRAIT_UNDENSE, SPECIALIST_GEAR_TRAIT)

var/datum/mob_hud/security/advanced/SA = GLOB.huds[MOB_HUD_SECURITY_ADVANCED]
SA.add_to_hud(H)
var/datum/mob_hud/xeno_infection/XI = GLOB.huds[MOB_HUD_XENO_INFECTION]
XI.add_to_hud(H)

H.visible_message(SPAN_DANGER("[H]'s camouflage fails!"), SPAN_WARNING("Your camouflage fails!"), max_distance = 4)

/obj/item/clothing/suit/storage/marine/ghillie/proc/fade_in(mob/user)
SIGNAL_HANDLER
var/mob/living/carbon/human/H = user
if(camo_active)
if(current_camo < full_camo_alpha)
current_camo = full_camo_alpha
current_camo = clamp(current_camo + incremental_shooting_camo_penalty, full_camo_alpha, 255)
H.alpha = current_camo
addtimer(CALLBACK(src, PROC_REF(fade_out_finish), H), camouflage_break, TIMER_OVERRIDE|TIMER_UNIQUE)
animate(H, alpha = full_camo_alpha + 5, time = camouflage_break, easing = LINEAR_EASING, flags = ANIMATION_END_NOW)

/obj/item/clothing/suit/storage/marine/ghillie/proc/fade_out_finish(mob/living/carbon/human/H)
if(camo_active && H.wear_suit == src)
to_chat(H, SPAN_BOLDNOTICE("The smoke clears and your position is once again hidden completely!"))
animate(H, alpha = full_camo_alpha)
current_camo = full_camo_alpha

/obj/item/clothing/suit/storage/marine/ghillie/proc/handle_mob_move_or_look(mob/living/mover, actually_moving, direction, specific_direction)
SIGNAL_HANDLER

if(camo_active && actually_moving)
deactivate_camouflage(mover)

/datum/action/item_action/specialist/prepare_position
ability_primacy = SPEC_PRIMARY_ACTION_1

/datum/action/item_action/specialist/prepare_position/New(mob/living/user, obj/item/holder)
..()
name = "Prepare Position"
button.name = name
button.overlays.Cut()
var/image/IMG = image('icons/mob/hud/actions.dmi', button, "prepare_position")
button.overlays += IMG

/datum/action/item_action/specialist/prepare_position/can_use_action()
var/mob/living/carbon/human/H = owner
if(istype(H) && !H.is_mob_incapacitated() && H.body_position == STANDING_UP && holder_item == H.wear_suit)
return TRUE

/datum/action/item_action/specialist/prepare_position/action_activate()
var/obj/item/clothing/suit/storage/marine/ghillie/GS = holder_item
GS.camouflage()

#undef FULL_CAMOUFLAGE_ALPHA

/obj/item/clothing/suit/storage/marine/ghillie/forecon
name = "UDEP Thermal Poncho"
desc = "UDEP or the Ultra Diffusive Environmental Poncho is a camouflaged rain-cover worn to protect against the elements and chemical spills. It's commonly treated with an infrared absorbing coating, making a marine almost invisible in the rain. Favoured by USCM specialists for it's comfort and practicality."
icon_state = "mercenary_miner_armor"
flags_atom = MOB_LOCK_ON_EQUIP|NO_SNOW_TYPE|NO_NAME_OVERRIDE
118 changes: 118 additions & 0 deletions code/modules/clothing/suits/marine_armor/intel.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
/obj/item/clothing/suit/storage/marine/medium/rto/intel
name = "\improper XM4 pattern intelligence officer armor"
uniform_restricted = list(/obj/item/clothing/under/marine/officer/intel)
specialty = "XM4 pattern intel"
desc = "Tougher than steel, quieter than whispers, the XM4 Intel Armor provides capable protection combined with an experimental integrated motion tracker. It took an R&D team a weekend to develop and costs more than the Chinook Station... probably. When worn, uniform accessories such as webbing cannot be attached due to the motion sensors occupying the clips."
desc_lore = "ARMAT Perfection. The XM4 Soldier Awareness System mixes M4-style hard armor and a distributed series of motion sensors clipped onto the breastplate. When connected to any HUD optic, it replicates the effects of an M314 Motion Detector unit, increasing user situational awareness. It is currently undergoing field trials by intelligence operatives."
storage_slots = 5
/// XM4 Integral Motion Detector Ability
actions_types = list(/datum/action/item_action/toggle, /datum/action/item_action/intel/toggle_motion_detector)
var/motion_detector = FALSE
var/obj/item/device/motiondetector/xm4/proximity
var/long_range_cooldown = 2
var/recycletime = 120

/obj/item/clothing/suit/storage/marine/medium/rto/intel/Initialize(mapload, ...)
. = ..()
proximity = new(src)
update_icon()

/datum/action/item_action/intel/action_activate()
if(!ishuman(owner))
return

/datum/action/item_action/intel/update_button_icon()
return

/datum/action/item_action/intel/toggle_motion_detector/New(Target, obj/item/holder)
. = ..()
name = "Toggle Motion Detector"
action_icon_state = "motion_detector"
button.name = name
button.overlays.Cut()
button.overlays += image('icons/mob/hud/actions.dmi', button, action_icon_state)

/datum/action/item_action/intel/toggle_motion_detector/action_activate()
. = ..()
var/obj/item/clothing/suit/storage/marine/medium/rto/intel/recon = holder_item
recon.toggle_motion_detector(owner)

/datum/action/item_action/intel/toggle_motion_detector/proc/update_icon()
if(!holder_item)
return
var/obj/item/clothing/suit/storage/marine/medium/rto/intel/recon = holder_item
if(recon.motion_detector)
button.icon_state = "template_on"
else
button.icon_state = "template"

/obj/item/clothing/suit/storage/marine/medium/rto/intel/process()
if(!motion_detector)
STOP_PROCESSING(SSobj, src)
if(motion_detector)
recycletime--
if(!recycletime)
recycletime = initial(recycletime)
proximity.refresh_blip_pool()
long_range_cooldown--
if(long_range_cooldown)
return
long_range_cooldown = initial(long_range_cooldown)
proximity.scan()

/obj/item/clothing/suit/storage/marine/medium/rto/intel/proc/toggle_motion_detector(mob/user)
to_chat(user,SPAN_NOTICE("You [motion_detector? "<B>disable</b>" : "<B>enable</b>"] \the [src]'s motion detector."))
if(!motion_detector)
playsound(loc,'sound/items/detector_turn_on.ogg', 25, 1)
else
playsound(loc,'sound/items/detector_turn_off.ogg', 25, 1)
motion_detector = !motion_detector
var/datum/action/item_action/intel/toggle_motion_detector/TMD = locate(/datum/action/item_action/intel/toggle_motion_detector) in actions
TMD.update_icon()
motion_detector()

/obj/item/clothing/suit/storage/marine/medium/rto/intel/proc/motion_detector()
if(motion_detector)
START_PROCESSING(SSobj, src)
else
STOP_PROCESSING(SSobj, src)

/obj/item/clothing/suit/storage/marine/medium/rto/intel/mob_can_equip(mob/living/carbon/human/user, slot, disable_warning) //Thanks to Drathek for the help on this part!
if(!..())
return FALSE

// Only equip if uniform doesn't already have a utility accessory slot equipped
var/obj/item/clothing/under/uniform = user.w_uniform
var/accessory = locate(/obj/item/clothing/accessory/storage) in uniform.accessories
if(accessory)
to_chat(user, SPAN_WARNING("[src] can't be worn with [accessory]."))
return FALSE
// Only equip if user has expert intel skill level
if(!skillcheck(user, SKILL_INTEL, SKILL_INTEL_EXPERT))
to_chat(user, SPAN_WARNING("You don't seem to know how to use [src]..."))
return FALSE
return TRUE

/obj/item/clothing/suit/storage/marine/medium/rto/intel/equipped(mob/user, slot, silent) //When XM4 is equipped this removes ACCESSORY_SLOT_UTILITY as a valid accessory for the uniform
. = ..()
if(slot == WEAR_JACKET)
var/mob/living/carbon/human/human = user
var/obj/item/clothing/under/uniform = human.w_uniform
if(uniform?.valid_accessory_slots)
uniform?.valid_accessory_slots -= ACCESSORY_SLOT_UTILITY

/obj/item/clothing/suit/storage/marine/medium/rto/intel/unequipped(mob/user, slot) //When unequipped this adds the ACCESSORY_SLOT_UTILITY back as a valid accessory
. = ..()
if(slot == WEAR_JACKET)
var/mob/living/carbon/human/human = user
var/obj/item/clothing/under/uniform = human.w_uniform
if(uniform)
// Figure out if the uniform originally allowed ACCESSORY_SLOT_UTILITY
var/obj/item/clothing/under/temp_uniform = new uniform.type
if(temp_uniform.valid_accessory_slots)
for(var/allowed in temp_uniform.valid_accessory_slots)
if(allowed == ACCESSORY_SLOT_UTILITY)
// It was allowed previously, now add it back
uniform.valid_accessory_slots += ACCESSORY_SLOT_UTILITY
break
qdel(temp_uniform)
60 changes: 60 additions & 0 deletions code/modules/clothing/suits/marine_armor/smartgunner.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/obj/item/clothing/suit/storage/marine/smartgunner
name = "\improper M56 combat harness"
desc = "A heavy protective vest designed to be worn with the M56 Smartgun System. \nIt has specially designed straps and reinforcement to carry the Smartgun and accessories."
icon_state = "8"
item_state = "armor"
armor_laser = CLOTHING_ARMOR_LOW
armor_bomb = CLOTHING_ARMOR_MEDIUM
armor_rad = CLOTHING_ARMOR_MEDIUM
storage_slots = 2
slowdown = SLOWDOWN_ARMOR_LIGHT
flags_inventory = BLOCKSHARPOBJ|SMARTGUN_HARNESS
allowed = list(
/obj/item/tank/emergency_oxygen,
/obj/item/device/flashlight,
/obj/item/ammo_magazine,
/obj/item/explosive/mine,
/obj/item/attachable/bayonet,
/obj/item/weapon/gun/smartgun,
/obj/item/storage/backpack/general_belt,
/obj/item/device/motiondetector,
/obj/item/device/walkman,
)

/obj/item/clothing/suit/storage/marine/smartgunner/Initialize()
. = ..()
if(SSmapping.configs[GROUND_MAP].environment_traits[MAP_COLD] && name == "M56 combat harness")
name = "M56 snow combat harness"
else
name = "M56 combat harness"
//select_gamemode_skin(type)

/obj/item/clothing/suit/storage/marine/smartgunner/mob_can_equip(mob/equipping_mob, slot, disable_warning = FALSE)
. = ..()

if(equipping_mob.back)
to_chat(equipping_mob, SPAN_WARNING("You can't equip [src] while wearing a backpack."))
return FALSE

/obj/item/clothing/suit/storage/marine/smartgunner/equipped(mob/user, slot, silent)
. = ..()

if(slot == WEAR_JACKET)
RegisterSignal(user, COMSIG_HUMAN_ATTEMPTING_EQUIP, PROC_REF(check_equipping))

/obj/item/clothing/suit/storage/marine/smartgunner/proc/check_equipping(mob/living/carbon/human/equipping_human, obj/item/equipping_item, slot)
SIGNAL_HANDLER

if(slot != WEAR_BACK)
return

. = COMPONENT_HUMAN_CANCEL_ATTEMPT_EQUIP

if(equipping_item.flags_equip_slot == SLOT_BACK)
to_chat(equipping_human, SPAN_WARNING("You can't equip [equipping_item] on your back while wearing [src]."))
return

/obj/item/clothing/suit/storage/marine/smartgunner/unequipped(mob/user, slot)
. = ..()

UnregisterSignal(user, COMSIG_HUMAN_ATTEMPTING_EQUIP)
Loading

0 comments on commit 747b74d

Please sign in to comment.