Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

makes visors movielike #461

Draft
wants to merge 10 commits into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions code/__DEFINES/traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,8 @@
#define TRAIT_SPEC(spec_type) "t_spec_[spec_type]"
/// If the mob won't drop items held in face slot when downed
#define TRAIT_IRON_TEETH "t_iron_teeth"
/// If the mob won't drop items held in face slot when downed
#define TRAIT_HUD_SIGHT "t_hud_sight"

// -- ability traits --
/// Xenos with this trait cannot have plasma transfered to them
Expand Down
8 changes: 8 additions & 0 deletions code/game/atoms.dm
Original file line number Diff line number Diff line change
Expand Up @@ -834,3 +834,11 @@ Parameters are passed from New.
var/refid = REF(src)
. += "[VV_HREF_TARGETREF(refid, VV_HK_AUTO_RENAME, "<b id='name'>[src]</b>")]"
. += "<br><font size='1'><a href='?_src_=vars;[HrefToken()];rotatedatum=[refid];rotatedir=left'><<</a> <a href='?_src_=vars;[HrefToken()];datumedit=[refid];varnameedit=dir' id='dir'>[dir2text(dir) || dir]</a> <a href='?_src_=vars;[HrefToken()];rotatedatum=[refid];rotatedir=right'>>></a></font>"

/atom/MouseEntered(location, control, params)
if(usr.face_mouse)
usr.face_atom(src)

/atom/MouseExited(location, control, params)
if(usr.face_mouse)
usr.face_atom(src)
33 changes: 29 additions & 4 deletions code/game/objects/items/devices/helmet_visors.dm
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,15 @@

/// Called by toggle_visor() to activate the visor's effects
/obj/item/device/helmet_visor/proc/activate_visor(obj/item/clothing/head/helmet/marine/attached_helmet, mob/living/carbon/human/user)
var/datum/mob_hud/current_mob_hud = GLOB.huds[hud_type]
current_mob_hud.add_hud_to(user, attached_helmet)
if(isnull(GLOB.huds[hud_type]?.hudusers[user]))
var/datum/mob_hud/current_mob_hud = GLOB.huds[hud_type]
current_mob_hud.add_hud_to(user, attached_helmet)

/// Called by toggle_visor() to deactivate the visor's effects
/obj/item/device/helmet_visor/proc/deactivate_visor(obj/item/clothing/head/helmet/marine/attached_helmet, mob/living/carbon/human/user)
var/datum/mob_hud/current_mob_hud = GLOB.huds[hud_type]
current_mob_hud.remove_hud_from(user, attached_helmet)
if(!isnull(GLOB.huds[hud_type]?.hudusers[user]))
var/datum/mob_hud/current_mob_hud = GLOB.huds[hud_type]
current_mob_hud.remove_hud_from(user, attached_helmet)

/// Called by /obj/item/clothing/head/helmet/marine/get_examine_text(mob/user) to get extra examine text for this visor
/obj/item/device/helmet_visor/proc/get_helmet_examine_text()
Expand Down Expand Up @@ -333,3 +335,26 @@

/obj/item/device/helmet_visor/night_vision/marine_raider/process(delta_time)
return PROCESS_KILL

/obj/item/device/helmet_visor/sight
name = "sight optic"
desc = "A standard M10 pattern helmet optic that grants its user point and shoot capabilities and provides tactical squad HUD display."

/obj/item/device/helmet_visor/sight/activate_visor(obj/item/clothing/head/helmet/marine/attached_helmet, mob/living/carbon/human/user)
. = ..()

user.client.mouse_pointer_icon = 'icons/effects/cursors/aim_reticle.dmi'
user.client.color = "#FDE8D9"
user.overlay_fullscreen("optic", /atom/movable/screen/fullscreen/flash/noise/nvg)
ADD_TRAIT(user, TRAIT_HUD_SIGHT, src)
user.face_mouse = TRUE


/obj/item/device/helmet_visor/sight/deactivate_visor(obj/item/clothing/head/helmet/marine/attached_helmet, mob/living/carbon/human/user)
. = ..()

user.client.mouse_pointer_icon = initial(user.client.mouse_pointer_icon)
user.client.color = initial(user.client.color)
user.clear_fullscreen("optic", 0.5 SECONDS)
REMOVE_TRAIT(user, TRAIT_HUD_SIGHT, src)
user.face_mouse = FALSE
19 changes: 6 additions & 13 deletions code/modules/clothing/head/helmet.dm
Original file line number Diff line number Diff line change
Expand Up @@ -406,7 +406,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list(
var/helmet_overlay_icon = 'icons/mob/humans/onmob/head_1.dmi'

///Any visors built into the helmet
var/list/built_in_visors = list(new /obj/item/device/helmet_visor)
var/list/built_in_visors = list(new /obj/item/device/helmet_visor/sight)

///Any visors that have been added into the helmet
var/list/inserted_visors = list()
Expand Down Expand Up @@ -706,11 +706,6 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list(
if(length(total_visors) > iterator)
var/obj/item/device/helmet_visor/next_visor = total_visors[iterator + 1]

if(!isnull(GLOB.huds[next_visor.hud_type]?.hudusers[user]))
iterator++
skipped_hud = TRUE
continue

if(!next_visor.can_toggle(user))
iterator++
skipped_hud = TRUE
Expand All @@ -727,8 +722,6 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list(
iterator++

for(var/obj/item/device/helmet_visor/new_visor in total_visors)
if(!isnull(GLOB.huds[new_visor.hud_type]?.hudusers[user]))
continue

if(!new_visor.can_toggle(user))
continue
Expand Down Expand Up @@ -774,7 +767,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list(
desc = "A modified M10 marine helmet for ComTechs. Features a toggleable welding screen for eye protection."
icon_state = "tech_helmet"
specialty = "M10 technician"
built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/welding_visor)
built_in_visors = list(new /obj/item/device/helmet_visor/sight, new /obj/item/device/helmet_visor/welding_visor)

/obj/item/clothing/head/helmet/marine/grey
desc = "A standard M10 Pattern Helmet. This one has not had a camouflage pattern applied to it yet. There is a built-in camera on the right side."
Expand Down Expand Up @@ -808,14 +801,14 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list(
flags_inventory = BLOCKSHARPOBJ
flags_inv_hide = HIDEEARS|HIDETOPHAIR
specialty = "M50 tanker"
built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/welding_visor/tanker)
built_in_visors = list(new /obj/item/device/helmet_visor/sight, new /obj/item/device/helmet_visor/welding_visor/tanker)

/obj/item/clothing/head/helmet/marine/medic
name = "\improper M10 corpsman helmet"
desc = "M10 combat helmet issued to marine hospital corpsmen. Has a red cross painted on its front for attracting the injured and snipers' attentions alike."
icon_state = "med_helmet"
specialty = "M10 pattern medic"
built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced)
built_in_visors = list(new /obj/item/device/helmet_visor/sight, new /obj/item/device/helmet_visor/medical/advanced)
start_down_visor_type = /obj/item/device/helmet_visor/medical/advanced

/obj/item/clothing/head/helmet/marine/medic/white
Expand Down Expand Up @@ -965,7 +958,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list(
armor_bio = CLOTHING_ARMOR_MEDIUMHIGH
specialty = "M10 pattern captain"
flags_atom = NO_SNOW_TYPE
built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced, new /obj/item/device/helmet_visor/security)
built_in_visors = list(new /obj/item/device/helmet_visor/sight, new /obj/item/device/helmet_visor/medical/advanced, new /obj/item/device/helmet_visor/security)

/obj/item/clothing/head/helmet/marine/MP
name = "\improper M10 pattern MP helmet"
Expand All @@ -989,7 +982,7 @@ GLOBAL_LIST_INIT(allowed_helmet_items, list(
icon_state = "helmet"
item_state = "helmet"
specialty = "M10 pattern officer"
built_in_visors = list(new /obj/item/device/helmet_visor, new /obj/item/device/helmet_visor/medical/advanced)
built_in_visors = list(new /obj/item/device/helmet_visor/sight, new /obj/item/device/helmet_visor/medical/advanced)

/obj/item/clothing/head/helmet/marine/mp/provost/marshal
name = "\improper Provost Marshal Cap"
Expand Down
2 changes: 2 additions & 0 deletions code/modules/mob/mob_defines.dm
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,8 @@
// contains /atom/movable/screen/alert only
var/list/alerts = list()

var/face_mouse = FALSE

/mob/vv_get_dropdown()
. = ..()
VV_DROPDOWN_OPTION(VV_HK_EXPLODE, "Trigger Explosion")
Expand Down
7 changes: 7 additions & 0 deletions code/modules/movement/movement.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,15 @@
var/old_dir = dir

. = ..()

if (flags_atom & DIRLOCK)
setDir(old_dir)

else if(ismob(src))
var/mob/mob = src
if(mob.face_mouse)
setDir(old_dir)

else if(old_dir != direct)
setDir(direct)
l_move_time = world.time
Expand Down
2 changes: 2 additions & 0 deletions code/modules/projectiles/gun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1706,6 +1706,8 @@ not all weapons use normal magazines etc. load_into_chamber() itself is designed
skill_accuracy = -1
else
skill_accuracy = user.skills.get_skill_level(SKILL_FIREARMS)
if(HAS_TRAIT(user, TRAIT_HUD_SIGHT))
skill_accuracy += 1
if(skill_accuracy)
gun_accuracy_mult += skill_accuracy * HIT_ACCURACY_MULT_TIER_3 // Accuracy mult increase/decrease per level is equal to attaching/removing a red dot sight

Expand Down
Binary file added icons/effects/cursors/aim_reticle.dmi
Binary file not shown.
Binary file modified icons/mob/humans/onmob/helmet_garb.dmi
Binary file not shown.
Binary file modified icons/obj/items/clothing/helmet_visors.dmi
Binary file not shown.
Loading