Merge pull request #6318 from PsiOmegaDelta/EyeOfTheNinja

Ninja-night vision now works.
This commit is contained in:
Chinsky
2014-09-13 03:53:07 +04:00
6 changed files with 119 additions and 85 deletions

View File

@@ -15,6 +15,8 @@ var/datum/global_hud/global_hud = new()
var/list/vimpaired
var/list/darkMask
var/obj/screen/nvg
var/obj/screen/thermal
var/obj/screen/meson
/datum/global_hud/New()
//420erryday psychedellic colours screen overlay for when you are high
@@ -33,11 +35,25 @@ var/datum/global_hud/global_hud = new()
nvg = new /obj/screen()
nvg.screen_loc = "1,1"
nvg.icon = 'icons/obj/nvg_hud_full.dmi'
nvg.icon = 'icons/obj/hud_full.dmi'
nvg.icon_state = "nvg_hud"
nvg.layer = 17
nvg.mouse_opacity = 0
thermal = new /obj/screen()
thermal.screen_loc = "1,1"
thermal.icon = 'icons/obj/hud_full.dmi'
thermal.icon_state = "thermal_hud"
thermal.layer = 17
thermal.mouse_opacity = 0
meson = new /obj/screen()
meson.screen_loc = "1,1"
meson.icon = 'icons/obj/hud_full.dmi'
meson.icon_state = "meson_hud"
meson.layer = 17
meson.mouse_opacity = 0
var/obj/screen/O
var/i
//that nasty looking dither you get when you're short-sighted

View File

@@ -1173,16 +1173,25 @@ ________________________________________________________________________________
/*
===================================================================================
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<SPACE NINJA MASK>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<SPACE NINJA HUD>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
===================================================================================
*/
/obj/item/clothing/mask/gas/voice/space_ninja/New()
verbs += /obj/item/clothing/mask/gas/voice/space_ninja/proc/togglev
verbs += /obj/item/clothing/mask/gas/voice/space_ninja/proc/switchm
/obj/item/clothing/glasses/hud/ninja
name = "Ninja Scanner HUD"
desc = "Assesses targets"
body_parts_covered = 0
//This proc is linked to human life.dm. It determines what hud icons to display based on mind special role for most mobs.
/obj/item/clothing/mask/gas/voice/space_ninja/proc/assess_targets(list/target_list, mob/living/carbon/U)
/obj/item/clothing/glasses/hud/ninja/process_hud(var/mob/M)
var/target_list[] = list()
for(var/mob/living/target in oview(M))
if(target.mind && (target.mind.special_role || issilicon(target))) //They need to have a mind.
target_list += target
if(target_list.len)
assess_targets(target_list, M)
if(!M.druggy) M.see_invisible = SEE_INVISIBLE_LIVING
/obj/item/clothing/glasses/hud/ninja/proc/assess_targets(list/target_list, mob/living/carbon/U)
var/icon/tempHud = 'icons/mob/hud.dmi'
for(var/mob/living/target in target_list)
if(iscarbon(target))
@@ -1216,6 +1225,42 @@ ________________________________________________________________________________
U.client.images += image(tempHud,silicon_target,"hudmalai")
return 1
/*
===================================================================================
<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<SPACE NINJA MASK>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
===================================================================================
*/
/datum/ninja_vision
var/mode
var/obj/item/clothing/glasses/glasses
/datum/ninja_vision/scouter
mode = "Scouter"
glasses = new/obj/item/clothing/glasses/hud/ninja
/datum/ninja_vision/nvg
mode = "Night Vision"
glasses = new/obj/item/clothing/glasses/night
/datum/ninja_vision/thermal
mode = "Thermal Scanner"
glasses = new/obj/item/clothing/glasses/thermal
/datum/ninja_vision/meson
mode = "Meson Scanner"
glasses = new/obj/item/clothing/glasses/meson
/obj/item/clothing/mask/gas/voice/space_ninja
var/datum/ninja_vision/ninja_vision
var/list/datum/ninja_vision/ninja_visions
/obj/item/clothing/mask/gas/voice/space_ninja/New()
ninja_visions = list(new/datum/ninja_vision/scouter, new/datum/ninja_vision/nvg, new/datum/ninja_vision/thermal, new/datum/ninja_vision/meson)
ninja_vision = ninja_visions[1]
verbs += /obj/item/clothing/mask/gas/voice/space_ninja/proc/togglev
verbs += /obj/item/clothing/mask/gas/voice/space_ninja/proc/switchm
/obj/item/clothing/mask/gas/voice/space_ninja/proc/togglev()
set name = "Toggle Voice"
set desc = "Toggles the voice synthesizer on or off."
@@ -1248,42 +1293,20 @@ ________________________________________________________________________________
set name = "Switch Mode"
set desc = "Switches between Night Vision, Meson, or Thermal vision modes."
set category = "Ninja Equip"
//Have to reset these manually since life.dm is retarded like that. Go figure.
//This will only work for humans because only they have the appropriate code for the mask.
var/index = ninja_visions.Find(ninja_vision) + 1
if(index > ninja_visions.len)
index = 1
ninja_vision = ninja_visions[index]
var/mob/U = loc
switch(mode)
if(0)
mode=1
U << "Switching mode to <B>Night Vision</B>."
if(1)
mode=2
U.see_in_dark = 2
U << "Switching mode to <B>Thermal Scanner</B>."
if(2)
mode=3
U.see_invisible = SEE_INVISIBLE_LIVING
U.sight &= ~SEE_MOBS
U << "Switching mode to <B>Meson Scanner</B>."
if(3)
mode=0
U.sight &= ~SEE_TURFS
U << "Switching mode to <B>Scouter</B>."
U << "Switching mode to <B>[ninja_vision.mode]</B>."
/obj/item/clothing/mask/gas/voice/space_ninja/examine()
set src in view()
..()
var/mode
switch(mode)
if(0)
mode = "Scouter"
if(1)
mode = "Night Vision"
if(2)
mode = "Thermal Scanner"
if(3)
mode = "Meson Scanner"
usr << "<B>[mode]</B> is active."//Leaving usr here since it may be on the floor or on a person.
usr << "<B>[ninja_vision.mode]</B> is active."//Leaving usr here since it may be on the floor or on a person.
usr << "Voice mimicking algorithm is set <B>[!vchange?"inactive":"active"]</B>."
/*

View File

@@ -11,6 +11,7 @@
var/prescription = 0
var/toggleable = 0
var/active = 1
var/obj/screen/overlay = null
body_parts_covered = EYES
/obj/item/clothing/glasses/attack_self(mob/user)
@@ -18,13 +19,11 @@
if(active)
active = 0
icon_state = "degoggles"
vision_flags = 0
user.update_inv_glasses()
usr << "You deactivate the optical matrix on the [src]."
else
active = 1
icon_state = initial(icon_state)
vision_flags = initial(vision_flags)
user.update_inv_glasses()
usr << "You activate the optical matrix on the [src]."
@@ -38,6 +37,10 @@
toggleable = 1
vision_flags = SEE_TURFS
/obj/item/clothing/glasses/meson/New()
..()
overlay = global_hud.meson
/obj/item/clothing/glasses/meson/prescription
name = "prescription mesons"
desc = "Optical Meson Scanner with prescription lenses."
@@ -57,6 +60,10 @@
origin_tech = "magnets=2"
darkness_view = 7
/obj/item/clothing/glasses/night/New()
..()
overlay = global_hud.nvg
/obj/item/clothing/glasses/eyepatch
name = "eyepatch"
desc = "Yarr."
@@ -212,6 +219,10 @@
M.disabilities &= ~NEARSIGHTED
..()
/obj/item/clothing/glasses/thermal/New()
..()
overlay = global_hud.thermal
/obj/item/clothing/glasses/thermal/syndi //These are now a traitor item, concealed as mesons. -Pete
name = "Optical Meson Scanner"
desc = "Used for seeing walls, floors, and stuff through anything."

View File

@@ -1202,7 +1202,7 @@
if(copytext(hud.icon_state,1,4) == "hud") //ugly, but icon comparison is worse, I believe
client.images.Remove(hud)
client.screen.Remove(global_hud.blurry, global_hud.druggy, global_hud.vimpaired, global_hud.darkMask, global_hud.nvg)
client.screen.Remove(global_hud.blurry, global_hud.druggy, global_hud.vimpaired, global_hud.darkMask, global_hud.nvg, global_hud.thermal, global_hud.meson)
update_action_buttons()
@@ -1314,57 +1314,18 @@
see_invisible = SEE_INVISIBLE_LIVING
seer = 0
var/tmp/glasses_processed = 0
if(istype(wear_mask, /obj/item/clothing/mask/gas/voice/space_ninja))
var/obj/item/clothing/mask/gas/voice/space_ninja/O = wear_mask
switch(O.mode)
if(0)
var/target_list[] = list()
for(var/mob/living/target in oview(src))
if( target.mind&&(target.mind.special_role||issilicon(target)) )//They need to have a mind.
target_list += target
if(target_list.len)//Everything else is handled by the ninja mask proc.
O.assess_targets(target_list, src)
if(!druggy) see_invisible = SEE_INVISIBLE_LIVING
if(1)
see_in_dark = 5
if(!druggy) see_invisible = SEE_INVISIBLE_LIVING
if(2)
sight |= SEE_MOBS
if(!druggy) see_invisible = SEE_INVISIBLE_LEVEL_TWO
if(3)
sight |= SEE_TURFS
if(!druggy) see_invisible = SEE_INVISIBLE_LIVING
glasses_processed = 1
process_glasses(O.ninja_vision.glasses)
if(glasses)
var/obj/item/clothing/glasses/G = glasses
if(istype(G))
see_in_dark += G.darkness_view
if(G.vision_flags) // MESONS
sight |= G.vision_flags
if(!druggy)
see_invisible = SEE_INVISIBLE_MINIMUM
if(istype(G,/obj/item/clothing/glasses/night))
see_invisible = SEE_INVISIBLE_MINIMUM
client.screen += global_hud.nvg
glasses_processed = 1
process_glasses(glasses)
/* HUD shit goes here, as long as it doesn't modify sight flags */
// The purpose of this is to stop xray and w/e from preventing you from using huds -- Love, Doohl
if(istype(glasses, /obj/item/clothing/glasses/sunglasses/sechud))
var/obj/item/clothing/glasses/sunglasses/sechud/O = glasses
if(O.hud) O.hud.process_hud(src)
if(!druggy) see_invisible = SEE_INVISIBLE_LIVING
else if(istype(glasses, /obj/item/clothing/glasses/hud))
var/obj/item/clothing/glasses/hud/O = glasses
O.process_hud(src)
if(!druggy)
see_invisible = SEE_INVISIBLE_LIVING
else if(!seer)
if(!seer && !glasses_processed)
see_invisible = SEE_INVISIBLE_LIVING
if(healths)
if (analgesic)
healths.icon_state = "health_health_numb"
@@ -1491,6 +1452,29 @@
reset_view(null)
return 1
proc/process_glasses(var/obj/item/clothing/glasses/G)
if(G && G.active)
see_in_dark += G.darkness_view
if(G.overlay)
client.screen |= G.overlay
if(G.vision_flags)
sight |= G.vision_flags
if(!druggy)
see_invisible = SEE_INVISIBLE_MINIMUM
if(istype(G,/obj/item/clothing/glasses/night))
see_invisible = SEE_INVISIBLE_MINIMUM
/* HUD shit goes here, as long as it doesn't modify sight flags */
// The purpose of this is to stop xray and w/e from preventing you from using huds -- Love, Doohl
if(istype(G, /obj/item/clothing/glasses/sunglasses/sechud))
var/obj/item/clothing/glasses/sunglasses/sechud/O = G
if(O.hud) O.hud.process_hud(src)
if(!druggy) see_invisible = SEE_INVISIBLE_LIVING
else if(istype(G, /obj/item/clothing/glasses/hud))
var/obj/item/clothing/glasses/hud/O = G
O.process_hud(src)
if(!druggy)
see_invisible = SEE_INVISIBLE_LIVING
proc/handle_random_events()
// Puke if toxloss is too high
if(!stat)

BIN
icons/obj/hud_full.dmi Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.0 KiB