Merge pull request #5840 from Crazylemon64/adds_reset_perspective

Polishes up `reset_view`
This commit is contained in:
Fox McCloud
2016-12-23 07:27:36 -05:00
committed by GitHub
71 changed files with 623 additions and 562 deletions
-8
View File
@@ -2235,14 +2235,6 @@
qdel(O)
for(var/obj/structure/grille/O in world)
qdel(O)
/* for(var/obj/machinery/vehicle/pod/O in world)
for(var/mob/M in src)
M.loc = src.loc
if(M.client)
M.client.perspective = MOB_PERSPECTIVE
M.client.eye = M
qdel(O)
ok = 1*/
if("monkey")
feedback_inc("admin_secrets_fun_used",1)
feedback_add_details("admin_secrets_fun_used","M")
+3 -1
View File
@@ -151,6 +151,8 @@
var/emagged = 0
var/vision_flags = 0
var/darkness_view = 0//Base human is 2
var/invis_override = 0
var/invis_view = SEE_INVISIBLE_LIVING
var/invisa_view = 0
var/color_view = null//overrides client.color while worn
strip_delay = 20 // but seperated to allow items to protect but not impair vision, like space helmets
@@ -343,6 +345,7 @@ BLIND // can't see anything
src.loc = user
user.wear_mask = null
user.put_in_hands(src)
H.wear_mask_update(src, toggle_off = mask_adjusted)
usr.update_inv_wear_mask()
usr.update_inv_head()
for(var/X in actions)
@@ -707,4 +710,3 @@ BLIND // can't see anything
for(var/obj/item/clothing/accessory/A in accessories)
A.emp_act(severity)
..()
+3 -2
View File
@@ -6,7 +6,6 @@
//slot_flags = SLOT_EYES
//var/vision_flags = 0
//var/darkness_view = 0//Base human is 2
//var/invisa_view = 0
var/prescription = 0
var/prescription_upgradable = 0
var/see_darkness = 1
@@ -360,7 +359,9 @@
to_chat(usr, "You push the [src] up out of your face.")
flash_protect = 0
tint = 0
usr.update_inv_glasses()
var/mob/living/carbon/user = usr
user.update_inv_glasses()
user.update_tint()
for(var/X in actions)
var/datum/action/A = X
@@ -67,6 +67,8 @@
to_chat(usr, "You push the [src] up out of your face.")
flash_protect = 0
tint = 0
var/mob/living/carbon/C = usr
C.update_tint()
usr.update_inv_head() //so our mob-overlays update
for(var/X in actions)
+1 -1
View File
@@ -77,7 +77,7 @@
user.unset_machine()
return null
user.reset_view(S.current)
user.reset_perspective(S.current)
return 1
/*
+5 -5
View File
@@ -237,7 +237,7 @@
computer.update_icon()
for(var/mob/living/L in viewers(1))
if(!istype(L,/mob/living/silicon/ai) && L.machine == src)
L.reset_view(null)
L.reset_perspective(null)
Reset()
@@ -245,7 +245,7 @@
current = null
for(var/mob/living/L in viewers(1))
if(!istype(L,/mob/living/silicon/ai) && L.machine == src)
L.reset_view(null)
L.reset_perspective(null)
interact()
if(!interactable())
@@ -265,7 +265,7 @@
return
if(computer.camnet.verify_machine(current))
usr.reset_view(current)
usr.reset_perspective(current)
if(world.time - last_camera_refresh > 50 || !camera_list)
last_camera_refresh = world.time
@@ -302,13 +302,13 @@
var/obj/machinery/camera/C = locate(href_list["show"])
if(istype(C) && C.status)
current = C
usr.reset_view(C)
usr.reset_perspective(C)
interact()
return
if("keyselect" in href_list)
current = null
usr.reset_view(null)
usr.reset_perspective(null)
key = input(usr,"Select a camera network key:", "Key Select", null) as null|anything in computer.list_files(/datum/file/camnet_key)
camera_list = null
update_icon()
+1 -4
View File
@@ -251,9 +251,6 @@
/obj/item/device/mobcapsule/proc/dump_contents(mob/user)
if(captured)
captured.forceMove(get_turf(src))
if(captured.client)
captured.client.eye = captured.client.mob
captured.client.perspective = MOB_PERSPECTIVE
captured = null
/obj/item/device/mobcapsule/attack_self(mob/user)
@@ -530,4 +527,4 @@
if(do_after(user, 20, target = src))
new /obj/item/stack/rods(loc)
qdel(src)
return ..()
return ..()
+1 -1
View File
@@ -22,7 +22,7 @@
var/atom/movable/mob_container
mob_container = M
mob_container.forceMove(get_turf(src))
M.reset_view()
M.reset_perspective()
qdel(src)
@@ -1,6 +0,0 @@
/mob/living/carbon/alien/humanoid/Login()
..()
if(!isturf(loc))
client.eye = loc
client.perspective = EYE_PERSPECTIVE
return
+26 -16
View File
@@ -31,21 +31,31 @@
return 1
/mob/living/carbon/alien/update_sight()
if(stat == DEAD || (XRAY in mutations))
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
if(!client)
return
if(stat == DEAD)
grant_death_vision()
return
sight = SEE_MOBS
if(nightvision)
see_in_dark = 8
see_invisible = SEE_INVISIBLE_MINIMUM
else
see_in_dark = 4
see_invisible = SEE_INVISIBLE_LEVEL_TWO
else if(stat != DEAD)
sight |= SEE_MOBS
sight &= ~SEE_TURFS
sight &= ~SEE_OBJS
if(nightvision)
see_in_dark = 8
see_invisible = SEE_INVISIBLE_MINIMUM
else if(!nightvision)
see_in_dark = 4
see_invisible = 45
if(see_override)
see_invisible = see_override
if(client.eye != src)
var/atom/A = client.eye
if(A.update_remote_sight(src)) //returns 1 if we override all other sight updates.
return
for(var/obj/item/organ/internal/cyberimp/eyes/E in internal_organs)
sight |= E.vision_flags
if(E.dark_view)
see_in_dark = max(see_in_dark, E.dark_view)
if(E.see_invisible)
see_invisible = min(see_invisible, E.see_invisible)
if(see_override)
see_invisible = see_override
@@ -62,22 +62,5 @@
. = 1
/mob/living/carbon/brain/handle_vision()
..()
if(stat == 2 || (XRAY in src.mutations))
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
else if(stat != 2)
sight &= ~SEE_TURFS
sight &= ~SEE_MOBS
sight &= ~SEE_OBJS
see_in_dark = 2
see_invisible = SEE_INVISIBLE_LIVING
handle_hud_icons_health()
/mob/living/carbon/brain/breathe()
return
+46
View File
@@ -1039,3 +1039,49 @@ so that different stomachs can handle things in different ways VB*/
/mob/living/carbon/proc/update_internals_hud_icon(internal_state = 0)
if(hud_used && hud_used.internals)
hud_used.internals.icon_state = "internal[internal_state]"
//to recalculate and update the mob's total tint from tinted equipment it's wearing.
/mob/living/carbon/proc/update_tint()
if(!tinted_weldhelh)
return
var/tinttotal = get_total_tint()
if(tinttotal >= TINT_BLIND)
overlay_fullscreen("tint", /obj/screen/fullscreen/blind)
else if(tinttotal >= TINT_IMPAIR)
overlay_fullscreen("tint", /obj/screen/fullscreen/impaired, 2)
else
clear_fullscreen("tint", 0)
/mob/living/carbon/proc/get_total_tint()
. = 0
if(istype(head, /obj/item/clothing/head))
var/obj/item/clothing/head/HT = head
. += HT.tint
if(wear_mask)
. += wear_mask.tint
/mob/living/carbon/human/get_total_tint()
. = ..()
if(glasses)
var/obj/item/clothing/glasses/G = glasses
. += G.tint
//handle stuff to update when a mob equips/unequips a mask.
/mob/living/proc/wear_mask_update(obj/item/clothing/C, toggle_off = 1)
update_inv_wear_mask()
/mob/living/carbon/wear_mask_update(obj/item/clothing/C, toggle_off = 1)
if(C.tint || initial(C.tint))
update_tint()
update_inv_wear_mask()
//handle stuff to update when a mob equips/unequips a headgear.
/mob/living/carbon/proc/head_update(obj/item/I, forced)
if(istype(I, /obj/item/clothing))
var/obj/item/clothing/C = I
if(C.tint || initial(C.tint))
update_tint()
if(I.flags_inv & HIDEMASK || forced)
update_inv_wear_mask()
update_inv_head()
@@ -721,6 +721,17 @@
if(istype(id))
return id
/mob/living/carbon/human/update_sight()
if(!client)
return
if(stat == DEAD)
grant_death_vision()
return
species.update_sight(src)
//Removed the horrible safety parameter. It was only being used by ninja code anyways.
//Now checks siemens_coefficient of the affected area by default
/mob/living/carbon/human/electrocute_act(shock_damage, obj/source, siemens_coeff = 1, safety = 0, override = 0, tesla_shock = 0)
@@ -111,6 +111,13 @@
update_inv_gloves()
else if(I == glasses)
glasses = null
var/obj/item/clothing/glasses/G = I
if(G.tint)
update_tint()
if(G.prescription)
clear_fullscreen("nearsighted")
if(G.vision_flags || G.darkness_view || G.invis_override || G.invis_view)
update_sight()
update_inv_glasses()
else if(I == head)
head = null
@@ -118,6 +125,7 @@
update_hair() //rebuild hair
update_fhair()
update_head_accessory()
head_update(I)
update_inv_head()
else if(I == r_ear)
r_ear = null
@@ -140,6 +148,7 @@
if(internal)
internal = null
update_internals_hud_icon(0)
wear_mask_update(I, toggle_off = FALSE)
sec_hud_set_ID()
update_inv_wear_mask()
else if(I == wear_id)
@@ -203,6 +212,7 @@
update_head_accessory(redraw_mob)
if(hud_list.len)
sec_hud_set_ID()
wear_mask_update(W, toggle_off = TRUE)
update_inv_wear_mask(redraw_mob)
if(slot_handcuffed)
handcuffed = W
@@ -247,6 +257,14 @@
update_inv_ears(redraw_mob)
if(slot_glasses)
glasses = W
var/obj/item/clothing/glasses/G = W
if(G.tint)
update_tint()
if(G.prescription)
if(disabilities & NEARSIGHTED)
overlay_fullscreen("nearsighted", /obj/screen/fullscreen/impaired, 1)
if(G.vision_flags || G.darkness_view || G.invis_override || G.invis_view)
update_sight()
update_inv_glasses(redraw_mob)
if(slot_gloves)
gloves = W
@@ -257,6 +275,7 @@
update_hair(redraw_mob) //rebuild hair
update_fhair(redraw_mob)
update_head_accessory(redraw_mob)
head_update(W)
update_inv_head(redraw_mob)
if(slot_shoes)
shoes = W
+2 -7
View File
@@ -1,8 +1,5 @@
//This file was auto-corrected by findeclaration.exe on 25.5.2012 20:42:32
#define TINT_IMPAIR 2 //Threshold of tint level to apply weld mask overlay
#define TINT_BLIND 3 //Threshold of tint level to obscure vision fully
/mob/living/carbon/human
var/pressure_alert = 0
@@ -12,11 +9,9 @@
var/exposedtimenow = 0
var/firstexposed = 0
var/heartbeat = 0
var/tinttotal = 0 // Total level of visually impairing items
/mob/living/carbon/human/Life()
fire_alert = 0 //Reset this here, because both breathe() and handle_environment() have a chance to set it.
tinttotal = tintcheck() //here as both hud updates and status updates call it
life_tick++
in_stasis = 0
@@ -899,7 +894,7 @@
/mob/living/carbon/human/handle_vision()
if(machine)
if(!machine.check_eye(src)) reset_view(null)
if(!machine.check_eye(src)) reset_perspective(null)
else
var/isRemoteObserve = 0
if((REMOTE_VIEW in mutations) && remoteview_target)
@@ -924,7 +919,7 @@
if(!isRemoteObserve && client && !client.adminobs)
remoteview_target = null
reset_view(null)
reset_perspective(null)
species.handle_vision(src)
@@ -46,6 +46,7 @@
var/siemens_coeff = 1 //base electrocution coefficient
var/invis_sight = SEE_INVISIBLE_LIVING
var/darksight = 2
var/hazard_high_pressure = HAZARD_HIGH_PRESSURE // Dangerously high pressure.
var/warning_high_pressure = WARNING_HIGH_PRESSURE // High pressure warning.
@@ -470,118 +471,7 @@
return 0
/datum/species/proc/handle_vision(mob/living/carbon/human/H)
if(H.stat == DEAD)
H.sight |= (SEE_TURFS|SEE_MOBS|SEE_OBJS)
H.see_in_dark = 8
if(!H.druggy)
H.see_invisible = SEE_INVISIBLE_LEVEL_TWO
return
H.sight &= ~(SEE_TURFS|SEE_MOBS|SEE_OBJS)
H.see_in_dark = darksight //set their variables to default, modify them later
H.see_invisible = SEE_INVISIBLE_LIVING
if(H.mind && H.mind.vampire)
if(H.mind.vampire.get_ability(/datum/vampire_passive/full))
H.sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
H.see_in_dark = 8
H.see_invisible = SEE_INVISIBLE_MINIMUM
else if(H.mind.vampire.get_ability(/datum/vampire_passive/vision))
H.sight |= SEE_MOBS
if(XRAY in H.mutations)
H.sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
H.see_in_dark = 8
H.see_invisible = SEE_INVISIBLE_MINIMUM
if(H.seer == 1)
var/obj/effect/rune/R = locate() in H.loc
if(R && R.word1 == cultwords["see"] && R.word2 == cultwords["hell"] && R.word3 == cultwords["join"])
H.see_invisible = SEE_INVISIBLE_OBSERVER
else
H.see_invisible = SEE_INVISIBLE_LIVING
H.seer = 0
//This checks how much the mob's eyewear impairs their vision
if(H.tinttotal >= TINT_IMPAIR)
if(tinted_weldhelh)
H.overlay_fullscreen("tint", /obj/screen/fullscreen/impaired, 2)
if(H.tinttotal >= TINT_BLIND)
H.EyeBlind(1)
else
H.clear_fullscreen("tint")
var/minimum_darkness_view = INFINITY
if(H.glasses)
if(istype(H.glasses, /obj/item/clothing/glasses))
var/obj/item/clothing/glasses/G = H.glasses
H.sight |= G.vision_flags
if(G.darkness_view)
H.see_in_dark = G.darkness_view
minimum_darkness_view = G.darkness_view
if(!G.see_darkness)
H.see_invisible = SEE_INVISIBLE_MINIMUM
if(H.head)
if(istype(H.head, /obj/item/clothing/head))
var/obj/item/clothing/head/hat = H.head
H.sight |= hat.vision_flags
if(hat.darkness_view && hat.darkness_view < minimum_darkness_view) // Pick the lowest of the two darkness_views between the glasses and helmet.
H.see_in_dark = hat.darkness_view
if(!hat.see_darkness)
H.see_invisible = SEE_INVISIBLE_MINIMUM
//switch(hat.HUDType)
// if(SECHUD)
// process_sec_hud(H,1)
// if(MEDHUD)
// process_med_hud(H,1)
// if(ANTAGHUD)
// process_antag_hud(H)
if(istype(H.back, /obj/item/weapon/rig)) ///ahhhg so snowflakey
var/obj/item/weapon/rig/rig = H.back
if(rig.visor)
if(!rig.helmet || (H.head && rig.helmet == H.head))
if(rig.visor && rig.visor.vision && rig.visor.active && rig.visor.vision.glasses)
var/obj/item/clothing/glasses/G = rig.visor.vision.glasses
if(istype(G))
H.see_in_dark = (G.darkness_view ? G.darkness_view : darksight) // Otherwise we keep our darkness view with togglable nightvision.
if(G.vision_flags) // MESONS
H.sight |= G.vision_flags
if(!G.see_darkness)
H.see_invisible = SEE_INVISIBLE_MINIMUM
//switch(G.HUDType)
// if(SECHUD)
// process_sec_hud(H,1)
// if(MEDHUD)
// process_med_hud(H,1)
// if(ANTAGHUD)
// process_antag_hud(H)
if(H.vision_type)
H.see_in_dark = max(H.see_in_dark, H.vision_type.see_in_dark, darksight)
H.see_invisible = H.vision_type.see_invisible
if(H.vision_type.light_sensitive)
H.weakeyes = 1
H.sight |= H.vision_type.sight_flags
if(H.see_override) //Override all
H.see_invisible = H.see_override
if(!H.client)
return 1
// Right now this just handles blind, blurry, and similar states
if(H.blinded || H.eye_blind)
H.overlay_fullscreen("blind", /obj/screen/fullscreen/blind)
H.throw_alert("blind", /obj/screen/alert/blind)
@@ -684,3 +574,92 @@ It'll return null if the organ doesn't correspond, so include null checks when u
if(!(organ_slot in has_organ))
return null
return has_organ[organ_slot]
/datum/species/proc/update_sight(mob/living/carbon/human/H)
H.sight = initial(H.sight)
H.see_in_dark = darksight
H.see_invisible = invis_sight
if(H.client.eye != H)
var/atom/A = H.client.eye
if(A.update_remote_sight(H)) //returns 1 if we override all other sight updates.
return
if(H.mind && H.mind.vampire)
if(H.mind.vampire.get_ability(/datum/vampire_passive/full))
H.sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
H.see_in_dark = 8
H.see_invisible = SEE_INVISIBLE_MINIMUM
else if(H.mind.vampire.get_ability(/datum/vampire_passive/vision))
H.sight |= SEE_MOBS
for(var/obj/item/organ/internal/cyberimp/eyes/E in H.internal_organs)
H.sight |= E.vision_flags
if(E.dark_view)
H.see_in_dark = E.dark_view
if(E.see_invisible)
H.see_invisible = min(H.see_invisible, E.see_invisible)
if(H.seer == 1)
var/obj/effect/rune/R = locate() in H.loc
if(R && R.word1 == cultwords["see"] && R.word2 == cultwords["hell"] && R.word3 == cultwords["join"])
H.see_invisible = SEE_INVISIBLE_OBSERVER
else
H.see_invisible = SEE_INVISIBLE_LIVING
H.seer = 0
var/lesser_darkview_bonus = INFINITY
// my glasses, I can't see without my glasses
if(H.glasses)
var/obj/item/clothing/glasses/G = H.glasses
H.sight |= G.vision_flags
lesser_darkview_bonus = G.darkness_view
if(G.invis_override)
H.see_invisible = G.invis_override
else
H.see_invisible = min(G.invis_view, H.see_invisible)
// better living through hat trading
if(H.head)
if(istype(H.head, /obj/item/clothing/head))
var/obj/item/clothing/head/hat = H.head
H.sight |= hat.vision_flags
if(hat.darkness_view) // Pick the lowest of the two darkness_views between the glasses and helmet.
lesser_darkview_bonus = min(hat.darkness_view,lesser_darkview_bonus)
if(!hat.see_darkness)
H.see_invisible = SEE_INVISIBLE_MINIMUM
if(istype(H.back, /obj/item/weapon/rig)) ///ahhhg so snowflakey
var/obj/item/weapon/rig/rig = H.back
if(rig.visor)
if(!rig.helmet || (H.head && rig.helmet == H.head))
if(rig.visor && rig.visor.vision && rig.visor.active && rig.visor.vision.glasses)
var/obj/item/clothing/glasses/G = rig.visor.vision.glasses
if(istype(G))
H.see_in_dark = (G.darkness_view ? G.darkness_view : darksight) // Otherwise we keep our darkness view with togglable nightvision.
if(G.vision_flags) // MESONS
H.sight |= G.vision_flags
if(!G.see_darkness)
H.see_invisible = SEE_INVISIBLE_MINIMUM
if(lesser_darkview_bonus != INFINITY)
H.see_in_dark = max(lesser_darkview_bonus, H.see_in_dark)
if(H.vision_type)
H.see_in_dark = max(H.see_in_dark, H.vision_type.see_in_dark, darksight)
H.see_invisible = H.vision_type.see_invisible
if(H.vision_type.light_sensitive)
H.weakeyes = 1
H.sight |= H.vision_type.sight_flags
if(XRAY in H.mutations)
H.sight |= (SEE_TURFS|SEE_MOBS|SEE_OBJS)
H.see_in_dark = max(H.see_in_dark, 8)
if(H.see_override) //Override all
H.see_invisible = H.see_override
+24 -18
View File
@@ -409,27 +409,33 @@
return 1
/mob/living/carbon/update_sight()
if(!client)
return
if(stat == DEAD)
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
else
sight &= ~(SEE_TURFS|SEE_MOBS|SEE_OBJS)
if(XRAY in mutations)
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
grant_death_vision()
return
else
see_in_dark = 2
see_invisible = SEE_INVISIBLE_LIVING
see_invisible = initial(see_invisible)
see_in_dark = initial(see_in_dark)
sight = initial(sight)
if(see_override)
see_invisible = see_override
if(XRAY in mutations)
grant_xray_vision()
if(client.eye != src)
var/atom/A = client.eye
if(A.update_remote_sight(src)) //returns 1 if we override all other sight updates.
return
for(var/obj/item/organ/internal/cyberimp/eyes/E in internal_organs)
sight |= E.vision_flags
if(E.dark_view)
see_in_dark = max(see_in_dark,E.dark_view)
if(E.see_invisible)
see_invisible = min(see_invisible, E.see_invisible)
if(see_override)
see_invisible = see_override
/mob/living/carbon/handle_hud_icons()
+20 -2
View File
@@ -230,14 +230,32 @@
if(machine)
if(!machine.check_eye(src))
reset_view(null)
reset_perspective(null)
else
if(!remote_view && !client.adminobs)
reset_view(null)
reset_perspective(null)
/mob/living/proc/update_sight()
return
// Gives a mob the vision of being dead
/mob/living/proc/grant_death_vision()
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_OBSERVER
// See through walls, dark, etc.
// basically the same as death vision except you can't
// see ghosts
/mob/living/proc/grant_xray_vision()
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
/mob/living/proc/handle_hud_icons()
handle_hud_icons_health()
return
+10 -3
View File
@@ -427,7 +427,7 @@ var/list/ai_verbs_default = list(
/mob/living/silicon/ai/check_eye(var/mob/user as mob)
if(!current)
return null
user.reset_view(current)
user.reset_perspective(current)
return 1
/mob/living/silicon/ai/blob_act()
@@ -606,7 +606,7 @@ var/list/ai_verbs_default = list(
adjustBruteLoss(damage)
updatehealth()
/mob/living/silicon/ai/reset_view(atom/A)
/mob/living/silicon/ai/reset_perspective(atom/A)
if(current)
current.set_light(0)
if(istype(A,/obj/machinery/camera))
@@ -1163,4 +1163,11 @@ var/list/ai_verbs_default = list(
to_chat(src, "You are also capable of hacking APCs, which grants you more points to spend on your Malfunction powers. The drawback is that a hacked APC will give you away if spotted by the crew. Hacking an APC takes 60 seconds.")
view_core() //A BYOND bug requires you to be viewing your core before your verbs update
verbs += /mob/living/silicon/ai/proc/choose_modules
malf_picker = new /datum/module_picker
malf_picker = new /datum/module_picker
/mob/living/silicon/ai/reset_perspective(atom/A)
if(camera_light_on)
light_cameras()
if(istype(A, /obj/machinery/camera))
current = A
. = ..()
+39 -36
View File
@@ -1,3 +1,8 @@
#define POWER_RESTORATION_OFF 0
#define POWER_RESTORATION_START 1
#define POWER_RESTORATION_SEARCH_APC 2
#define POWER_RESTORATION_APC_FOUND 3
/mob/living/silicon/ai/Life()
//doesn't call parent because it's a horrible mess
if(stat == DEAD)
@@ -6,7 +11,7 @@
var/turf/T = get_turf(src)
if(stat != CONSCIOUS) //ai's fucked
cameraFollow = null
reset_view(null)
reset_perspective(null)
unset_machine()
updatehealth()
@@ -16,11 +21,16 @@
death()
return 0
if(malfhack)
if(malfhack.aidisabled)
to_chat(src, "<span class='danger'>ERROR: APC access disabled, hack attempt canceled.</span>")
malfhacking = 0
malfhack = null
if(!eyeobj || qdeleted(eyeobj) || !eyeobj.loc)
view_core()
if(machine)
machine.check_eye(src)
if(malfhack && malfhack.aidisabled)
to_chat(src, "<span class='danger'>ERROR: APC access disabled, hack attempt canceled.</span>")
malfhacking = 0
malfhack = null
if(aiRestorePowerRoutine)
adjustOxyLoss(1)
@@ -29,22 +39,9 @@
handle_stunned()
var/is_blind = 0 //THIS WAS JUST FUCKING 'blind' WHICH CONFLICTED WITH A NORMAL VARIABLE
var/area/my_area = get_area(src)
if(istype(my_area))
if(!my_area.power_equip && !is_type_in_list(loc, list(/obj/item, /obj/mecha)))
is_blind = 1 //HOW THE FUCK DID THAT EVEN COMPILE JESUS CHRIST
if(!is_blind)
sight |= SEE_TURFS
sight |= SEE_MOBS
sight |= SEE_OBJS
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
if(see_override)
see_invisible = see_override
if(!lacks_power())
if(aiRestorePowerRoutine == 2)
to_chat(src, "Alert cancelled. Power has been restored without our assistance.")
@@ -57,18 +54,12 @@
else
sight &= ~SEE_TURFS
sight &= ~SEE_MOBS
sight &= ~SEE_OBJS
overlay_fullscreen("blind", /obj/screen/fullscreen/blind)
see_in_dark = 0
see_invisible = SEE_INVISIBLE_LIVING
if(((!my_area.power_equip) || istype(T, /turf/space)) && !is_type_in_list(loc, list(/obj/item, /obj/mecha)))
if(lacks_power())
if(!aiRestorePowerRoutine)
aiRestorePowerRoutine = 1
update_sight()
to_chat(src, "<span class='danger'>You have lost power!</span>")
if(!is_special_character(src))
set_zeroth_law("")
@@ -78,7 +69,7 @@
sleep(50)
my_area = get_area(src)
T = get_turf(src)
if(my_area && my_area.power_equip && !istype(T, /turf/space))
if(!lacks_power())
to_chat(src, "Alert cancelled. Power has been restored without our assistance.")
aiRestorePowerRoutine = 0
return
@@ -115,12 +106,11 @@
aiRestorePowerRoutine = 2
return
if(my_area.power_equip)
if(!istype(T, /turf/space))
to_chat(src, "Alert cancelled. Power has been restored without our assistance.")
aiRestorePowerRoutine = 0
clear_fullscreen("blind")
return
if(!lacks_power())
to_chat(src, "Alert cancelled. Power has been restored without our assistance.")
aiRestorePowerRoutine = 0
clear_fullscreen("blind")
return
switch(PRP)
if(1)
@@ -170,4 +160,17 @@
if(client)
var/client/C = client
for(var/mob/living/carbon/human/H in view(eyeobj, 14))
C.images += H.hud_list[NATIONS_HUD]
C.images += H.hud_list[NATIONS_HUD]
/mob/living/silicon/ai/update_sight()
see_invisible = initial(see_invisible)
see_in_dark = initial(see_in_dark)
sight = initial(sight)
if(aiRestorePowerRoutine)
sight = sight&~SEE_TURFS
sight = sight&~SEE_MOBS
sight = sight&~SEE_OBJS
see_in_dark = 0
if(see_override)
see_invisible = see_override
+1 -5
View File
@@ -2,9 +2,5 @@
..()
for(var/obj/machinery/ai_status_display/O in world) //change status
O.mode = 0
if(!isturf(loc))
if(client)
client.eye = loc
client.perspective = EYE_PERSPECTIVE
src.view_core()
return
return
+6 -11
View File
@@ -137,7 +137,7 @@
/mob/living/silicon/pai/check_eye(var/mob/user as mob)
if(!src.current)
return null
user.reset_view(src.current)
user.reset_perspective(src.current)
return 1
/mob/living/silicon/pai/blob_act()
@@ -261,7 +261,7 @@
usr:cameraFollow = null
if(!C)
src.unset_machine()
src.reset_view(null)
src.reset_perspective(null)
return 0
if(stat == 2 || !C.status || !(src.network in C.network)) return 0
@@ -269,7 +269,7 @@
src.set_machine(src)
src:current = C
src.reset_view(C)
src.reset_perspective(C)
return 1
/mob/living/silicon/pai/verb/reset_record_view()
@@ -288,7 +288,7 @@
/mob/living/silicon/pai/cancel_camera()
set category = "pAI Commands"
set name = "Cancel Camera View"
src.reset_view(null)
src.reset_perspective(null)
src.unset_machine()
src:cameraFollow = null
@@ -297,7 +297,7 @@
/mob/living/silicon/pai/proc/pai_network_change()
set category = "pAI Commands"
set name = "Change Camera Network"
src.reset_view(null)
src.reset_perspective(null)
src.unset_machine()
src:cameraFollow = null
var/cameralist[0]
@@ -363,9 +363,6 @@
var/obj/item/device/pda/holder = card.loc
holder.pai = null
if(client)
client.perspective = EYE_PERSPECTIVE
client.eye = src
forceMove(get_turf(card))
card.forceMove(src)
@@ -487,9 +484,7 @@
visible_message("<span class=notice>[src] neatly folds inwards, compacting down to a rectangular card.</span>", "<span class=notice>You neatly fold inwards, compacting down to a rectangular card.</span>")
stop_pulling()
if(client)
client.perspective = EYE_PERSPECTIVE
client.eye = card
reset_perspective(card)
// If we are being held, handle removing our holder from their inv.
var/obj/item/weapon/holder/H = loc
@@ -17,6 +17,7 @@
if(istype(O,/obj/item/borg/sight))
var/obj/item/borg/sight/S = O
sight_mode &= ~S.sight_mode
update_sight()
if(client)
client.screen -= O
@@ -52,6 +53,7 @@
if((cell.charge * 100 / cell.maxcharge) < B.powerneeded)
to_chat(src, "Not enough power to activate [B.name]!")
return
var/activated_thingy = null
if(!module_state_1)
O.mouse_opacity = initial(O.mouse_opacity)
module_state_1 = O
@@ -59,8 +61,7 @@
O.plane = HUD_PLANE
O.screen_loc = inv1.screen_loc
contents += O
if(istype(module_state_1,/obj/item/borg/sight))
sight_mode |= module_state_1:sight_mode
activated_thingy = O
else if(!module_state_2)
O.mouse_opacity = initial(O.mouse_opacity)
module_state_2 = O
@@ -68,8 +69,7 @@
O.plane = HUD_PLANE
O.screen_loc = inv2.screen_loc
contents += O
if(istype(module_state_2,/obj/item/borg/sight))
sight_mode |= module_state_2:sight_mode
activated_thingy = O
else if(!module_state_3)
O.mouse_opacity = initial(O.mouse_opacity)
module_state_3 = O
@@ -77,11 +77,12 @@
O.plane = HUD_PLANE
O.screen_loc = inv3.screen_loc
contents += O
if(istype(module_state_3,/obj/item/borg/sight))
sight_mode |= module_state_3:sight_mode
activated_thingy = O
else
to_chat(src, "You need to disable a module first!")
src.update_icons()
if(istype(activated_thingy,/obj/item/borg/sight))
update_sight()
update_icons()
/mob/living/silicon/robot/proc/uneq_active()
uneq_module(module_active)
+29 -23
View File
@@ -120,32 +120,38 @@
return 1
/mob/living/silicon/robot/update_sight()
if(stat == DEAD || sight_mode & BORGXRAY)
if(!client)
return
if(stat == DEAD)
grant_death_vision()
return
see_invisible = initial(see_invisible)
see_in_dark = initial(see_in_dark)
sight = initial(sight)
if(client.eye != src)
var/atom/A = client.eye
if(A.update_remote_sight(src)) //returns 1 if we override all other sight updates.
return
if(sight_mode & BORGMESON)
sight |= SEE_TURFS
see_invisible = min(see_invisible, SEE_INVISIBLE_MINIMUM)
see_in_dark = 1
if(sight_mode & BORGXRAY)
sight |= (SEE_TURFS|SEE_MOBS|SEE_OBJS)
see_invisible = SEE_INVISIBLE_LIVING
see_in_dark = 8
if(sight_mode & BORGTHERM)
sight |= SEE_MOBS
sight |= SEE_OBJS
see_invisible = min(see_invisible, SEE_INVISIBLE_LIVING)
see_in_dark = 8
see_invisible = SEE_INVISIBLE_LEVEL_TWO
else
see_in_dark = 8
if(sight_mode & BORGMESON && sight_mode & BORGTHERM)
sight |= SEE_TURFS
sight |= SEE_MOBS
see_invisible = SEE_INVISIBLE_MINIMUM
else if(sight_mode & BORGMESON)
sight |= SEE_TURFS
see_invisible = SEE_INVISIBLE_MINIMUM
see_in_dark = 1
else if(sight_mode & BORGTHERM)
sight |= SEE_MOBS
see_invisible = SEE_INVISIBLE_LEVEL_TWO
else if(stat != DEAD)
sight &= ~SEE_MOBS
sight &= ~SEE_TURFS
sight &= ~SEE_OBJS
see_invisible = SEE_INVISIBLE_LEVEL_TWO
if(see_override)
see_invisible = see_override
if(see_override)
see_invisible = see_override
/mob/living/silicon/robot/handle_hud_icons()
update_items()
@@ -393,9 +393,8 @@
passenger = M
load = M
can_buckle = FALSE
if(M.client)
M.client.perspective = EYE_PERSPECTIVE
M.client.eye = src
// Not sure why this is done
reset_perspective(src)
return TRUE
return FALSE
@@ -423,9 +422,7 @@
if(ismob(load))
var/mob/M = load
if(M.client)
M.client.perspective = MOB_PERSPECTIVE
M.client.eye = M
M.reset_perspective(null)
unbuckle_mob()
if(load)
@@ -452,9 +449,7 @@
AM.pixel_y = initial(AM.pixel_y)
if(ismob(AM))
var/mob/M = AM
if(M.client)
M.client.perspective = MOB_PERSPECTIVE
M.client.eye = M
M.reset_perspective(null)
/mob/living/simple_animal/bot/mulebot/call_bot()
..()
@@ -706,6 +706,22 @@
/mob/living/simple_animal/proc/sentience_act() //Called when a simple animal gains sentience via gold slime potion
return
/mob/living/simple_animal/update_sight()
if(!client)
return
if(stat == DEAD)
grant_death_vision()
return
see_invisible = initial(see_invisible)
see_in_dark = initial(see_in_dark)
sight = initial(sight)
if(client.eye != src)
var/atom/A = client.eye
if(A.update_remote_sight(src)) //returns 1 if we override all other sight updates.
return
/mob/living/simple_animal/SetEarDamage()
return
+1 -6
View File
@@ -43,12 +43,7 @@
sight |= SEE_SELF
..()
if(loc && !isturf(loc))
client.eye = loc
client.perspective = EYE_PERSPECTIVE
else
client.eye = src
client.perspective = MOB_PERSPECTIVE
reset_perspective(loc)
if(ckey in deadmins)
+29 -3
View File
@@ -487,7 +487,8 @@ var/list/slot_equipment_priority = list( \
return 0 //Unsupported slot
//END HUMAN
/mob/proc/reset_view(atom/A)
// If you're looking for `reset_perspective`, that's a synonym for this proc.
/mob/proc/reset_perspective(atom/A)
if(client)
if(istype(A, /atom/movable))
client.perspective = EYE_PERSPECTIVE
@@ -499,8 +500,33 @@ var/list/slot_equipment_priority = list( \
else
client.perspective = EYE_PERSPECTIVE
client.eye = loc
return
return 1
/mob/living/reset_perspective(atom/A)
. = ..()
if(.)
// Above check means the mob has a client
update_sight()
if(client.eye != src)
var/atom/AT = client.eye
AT.get_remote_view_fullscreens(src)
else
clear_fullscreen("remote_view", 0)
update_pipe_vision()
/mob/dead/reset_perspective(atom/A)
if(client)
if(ismob(client.eye) && (client.eye != src))
// Note to self: Use `client.eye` for ghost following in place
// of periodic ghost updates
var/mob/target = client.eye
target.following_mobs -= src
. = ..()
if(.)
// Allows sharing HUDs with ghosts
if(hud_used)
client.screen = list()
hud_used.show_hud(hud_used.hud_version)
/mob/proc/show_inv(mob/user)
user.set_machine(src)
@@ -793,7 +819,7 @@ var/list/slot_equipment_priority = list( \
/mob/verb/cancel_camera()
set name = "Cancel Camera View"
set category = "OOC"
reset_view(null)
reset_perspective(null)
unset_machine()
if(istype(src, /mob/living))
if(src:cameraFollow)
+1 -1
View File
@@ -148,7 +148,7 @@
view = world.view //Reset the view
winset(src, "mapwindow.map", "icon-size=[src.reset_stretch]")
viewingCanvas = 0
mob.reset_view()
mob.reset_perspective()
if(mob.hud_used)
mob.hud_used.show_hud(HUD_STYLE_STANDARD)
+8 -20
View File
@@ -128,10 +128,7 @@
for(var/mob/V in viewers(usr))
V.show_message("[usr] starts putting [GM.name] into the disposal.", 3)
if(do_after(usr, 20, target = GM))
if(GM.client)
GM.client.perspective = EYE_PERSPECTIVE
GM.client.eye = src
GM.loc = src
GM.forceMove(src)
for(var/mob/C in viewers(src))
C.show_message("\red [GM.name] has been placed in the [src] by [user].", 3)
qdel(G)
@@ -189,10 +186,7 @@
msg_admin_attack("[key_name_admin(user)] placed [key_name_admin(target)] in a disposals unit")
else
return
if(target.client)
target.client.perspective = EYE_PERSPECTIVE
target.client.eye = src
target.loc = src
target.forceMove(src)
for(var/mob/C in viewers(src))
if(C == user)
@@ -215,14 +209,8 @@
// leave the disposal
/obj/machinery/disposal/proc/go_out(mob/user)
if(user.client)
user.client.eye = user.client.mob
user.client.perspective = MOB_PERSPECTIVE
user.loc = src.loc
user.forceMove(loc)
update()
return
// ai as human but can't flush
/obj/machinery/disposal/attack_ai(mob/user as mob)
@@ -489,6 +477,10 @@
if(current_size >= STAGE_FIVE)
qdel(src)
/obj/machinery/disposal/get_remote_view_fullscreens(mob/user)
if(user.stat == DEAD || !(user.sight & (SEEOBJS|SEEMOBS)))
user.overlay_fullscreen("remote_view", /obj/screen/fullscreen/impaired, 2)
// virtual disposal object
// travels through pipes in lieu of actual items
// contents will be items flushed by the disposal
@@ -1356,11 +1348,7 @@
// check if mob has client, if so restore client view on eject
/mob/pipe_eject(var/direction)
if(src.client)
src.client.perspective = MOB_PERSPECTIVE
src.client.eye = src
return
reset_perspective(null)
/obj/effect/decal/cleanable/blood/gibs/pipe_eject(var/direction)
var/list/dirs
@@ -76,7 +76,7 @@
origin.feed_slime_action.Remove(C)
origin.monkey_recycle_action.Remove(C)
//All of this stuff below could probably be a proc for all advanced cameras, only the action removal needs to be camera specific
remote_eye.user = null
remote_eye.eye_user = null
if(C.client)
C.client.perspective = MOB_PERSPECTIVE
C.client.eye = src
@@ -164,4 +164,4 @@
if(issmall(M) && M.stat)
M.visible_message("[M] vanishes as they are reclaimed for recycling!")
X.monkeys += 0.2
qdel(M)
qdel(M)
+6 -6
View File
@@ -8,6 +8,8 @@
w_class = 1
var/vision_flags = 0
var/dark_view = 0
var/see_invisible = 0
var/list/eye_colour = list(0,0,0)
var/list/old_eye_colour = list(0,0,0)
var/flash_protect = 0
@@ -18,15 +20,11 @@
..()
if(aug_message && !special)
to_chat(owner, "<span class='notice'>[aug_message]</span>")
M.sight |= vision_flags
M.update_sight()
/obj/item/organ/internal/cyberimp/eyes/remove(var/mob/living/carbon/M, var/special = 0)
. = ..()
M.sight ^= vision_flags
/obj/item/organ/internal/cyberimp/eyes/on_life()
..()
owner.sight |= vision_flags
M.update_sight()
/obj/item/organ/internal/cyberimp/eyes/emp_act(severity)
if(!owner)
@@ -46,6 +44,8 @@
implant_color = "#000000"
origin_tech = "materials=6;programming=4;biotech=6;magnets=5"
vision_flags = SEE_MOBS | SEE_OBJS | SEE_TURFS
dark_view = 8
see_invisible = SEE_INVISIBLE_MINIMUM
/obj/item/organ/internal/cyberimp/eyes/thermals
name = "Thermals implant"