Skip to content

Commit

Permalink
helmet motion detector to replace to night vision
Browse files Browse the repository at this point in the history
  • Loading branch information
Releasethesea committed Mar 21, 2024
1 parent 6e08dc8 commit ad6633b
Show file tree
Hide file tree
Showing 4 changed files with 85 additions and 1 deletion.
5 changes: 5 additions & 0 deletions code/game/objects/items/devices/motion_detector.dm
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,11 @@
if(ishuman(holder.loc))
return holder.loc

/obj/item/device/motiondetector/xm43/get_user()
var/atom/holder = loc
if(ishuman(holder.loc))
return holder.loc

/obj/item/device/motiondetector/proc/apply_debuff(mob/M)
return

Expand Down
73 changes: 73 additions & 0 deletions code/modules/clothing/head/helmet.dm
Original file line number Diff line number Diff line change
Expand Up @@ -894,6 +894,79 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list(
desc = "A state of the art helmet designed in tandem with the XM43E1, this helmets equiped with all the gizmos and gadgets, ballistics tracker, astrology, wind elevation, proper escalation, everything you can think of it has... probably, thats why the helmets flashing.. probably."
min_cold_protection_temperature = ICE_PLANET_MIN_COLD_PROT
flags_atom = NO_SNOW_TYPE
flags_item = MOB_LOCK_ON_EQUIP|NO_CRYO_STORE

/// XM43 Integral Motion Detector Ability
actions_types = list(/datum/action/item_action/toggle, /datum/action/item_action/xm43/toggle_motion_detector)
var/motion_detector = FALSE
var/obj/item/device/motiondetector/xm43/proximity
var/long_range_cooldown = 2
var/recycletime = 120

/obj/item/clothing/head/helmet/marine/xm43e1/Initialize(mapload, ...)
. = ..()
proximity = new(src)
update_icon()

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

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

/datum/action/item_action/xm43/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/xm43/toggle_motion_detector/action_activate()
. = ..()
var/obj/item/clothing/head/helmet/marine/xm43e1/recon = holder_item
recon.toggle_motion_detector(owner)

/datum/action/item_action/xm43/toggle_motion_detector/proc/update_icon()
if(!holder_item)
return
var/obj/item/clothing/head/helmet/marine/xm43e1/recon = holder_item
if(recon.motion_detector)
button.icon_state = "template_on"
else
button.icon_state = "template"

/obj/item/clothing/head/helmet/marine/xm43e1/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/head/helmet/marine/xm43e1/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/xm43/toggle_motion_detector/TMD = locate(/datum/action/item_action/xm43/toggle_motion_detector) in actions
TMD.update_icon()
motion_detector()

/obj/item/clothing/head/helmet/marine/xm43e1/proc/motion_detector()
if(motion_detector)
START_PROCESSING(SSobj, src)
else
STOP_PROCESSING(SSobj, src)

/obj/item/clothing/head/helmet/marine/pilot
name = "\improper M30 tactical helmet"
Expand Down
1 change: 0 additions & 1 deletion code/modules/cm_marines/equipment/kit_boxes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@
desc = "a large case containing a XM43E1 anti material rifle"
new /obj/item/clothing/suit/storage/marine/light/vest/xm43e1_vest(src)
new /obj/item/clothing/head/helmet/marine/xm43e1(src)
new /obj/item/clothing/glasses/night/m42_night_goggles(src)
new /obj/item/weapon/gun/rifle/sniper/XM43E1(src)
new /obj/item/ammo_magazine/sniper/anti_materiel(src)
new /obj/item/ammo_magazine/sniper/anti_materiel(src)
Expand Down
7 changes: 7 additions & 0 deletions code/modules/mob/living/carbon/human/human_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,13 @@
var/datum/action/item_action/intel/toggle_motion_detector/TMD = locate(/datum/action/item_action/intel/toggle_motion_detector) in xm4.actions
TMD.update_icon()
xm4.motion_detector()
if(istype(i, /obj/item/clothing/head/helmet/marine/xm43e1))
var/obj/item/clothing/head/helmet/marine/xm43e1/xm43 = i
if(xm43.motion_detector)
xm43.motion_detector = FALSE
var/datum/action/item_action/xm43/toggle_motion_detector/TMD = locate(/datum/action/item_action/xm43/toggle_motion_detector) in xm43.actions
TMD.update_icon()
xm43.motion_detector()

/mob/living/carbon/human/proc/disable_headsets()
//Disable all radios to reduce radio spam for dead people
Expand Down

0 comments on commit ad6633b

Please sign in to comment.