mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-19 20:06:28 +01:00
Adds Virtual Mobs (#14718)
This commit is contained in:
@@ -16,7 +16,7 @@
|
||||
loc = null
|
||||
|
||||
my_client = client
|
||||
sight |= SEE_TURFS
|
||||
set_sight(sight|SEE_TURFS)
|
||||
player_list |= src
|
||||
|
||||
client.playtitlemusic()
|
||||
|
||||
@@ -860,7 +860,7 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
|
||||
set category = "Ghost"
|
||||
ghostvision = !(ghostvision)
|
||||
updateghostsight()
|
||||
to_chat(usr, "You [(ghostvision?"now":"no longer")] have ghost vision.")
|
||||
to_chat(usr, "You [(ghostvision ? "now" : "no longer")] have ghost vision.")
|
||||
|
||||
/mob/abstract/observer/verb/toggle_darkness()
|
||||
set name = "Toggle Darkness"
|
||||
@@ -872,21 +872,19 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
|
||||
//if they are on a restricted level, then set the ghost vision for them.
|
||||
if(on_restricted_level())
|
||||
//On the restricted level they have the same sight as the mob
|
||||
sight &= ~(SEE_TURFS | SEE_MOBS | SEE_OBJS)
|
||||
see_in_dark = 2
|
||||
see_invisible = SEE_INVISIBLE_OBSERVER
|
||||
set_sight(sight&(~SEE_TURFS)&(~SEE_MOBS)&(~SEE_OBJS))
|
||||
set_see_in_dark(2)
|
||||
set_see_invisible(SEE_INVISIBLE_OBSERVER)
|
||||
else
|
||||
//Outside of the restrcited level, they have enhanced vision
|
||||
sight |= (SEE_TURFS | SEE_MOBS | SEE_OBJS)
|
||||
see_in_dark = 100
|
||||
see_invisible = SEE_INVISIBLE_LEVEL_TWO
|
||||
set_sight(sight|SEE_TURFS|SEE_MOBS|SEE_OBJS)
|
||||
set_see_in_dark(100)
|
||||
set_see_invisible(SEE_INVISIBLE_LEVEL_TWO)
|
||||
|
||||
if (!seedarkness)
|
||||
see_invisible = SEE_INVISIBLE_NOLIGHTING
|
||||
set_see_invisible(SEE_INVISIBLE_NOLIGHTING)
|
||||
else
|
||||
see_invisible = SEE_INVISIBLE_OBSERVER
|
||||
if (!ghostvision)
|
||||
see_invisible = SEE_INVISIBLE_LIVING
|
||||
set_see_invisible(ghostvision ? SEE_INVISIBLE_OBSERVER : SEE_INVISIBLE_LIVING)
|
||||
|
||||
updateghostimages()
|
||||
|
||||
|
||||
@@ -0,0 +1,4 @@
|
||||
var/global/const/VIRTUAL_ABILITY_NONE = 0
|
||||
var/global/const/VIRTUAL_ABILITY_HEAR = 1
|
||||
var/global/const/VIRTUAL_ABILITY_SEE = 2
|
||||
var/global/const/VIRTUAL_ABILITY_ALL = (~VIRTUAL_ABILITY_NONE)
|
||||
@@ -0,0 +1,69 @@
|
||||
//
|
||||
// Virtual Mob
|
||||
//
|
||||
|
||||
var/global/list/all_virtual_listeners = list()
|
||||
|
||||
/mob/abstract/observer/virtual
|
||||
icon = 'icons/mob/abstract/virtual.dmi'
|
||||
invisibility = INVISIBILITY_SYSTEM
|
||||
see_in_dark = SEE_IN_DARK_DEFAULT
|
||||
see_invisible = SEE_INVISIBLE_LIVING
|
||||
sight = SEE_SELF
|
||||
|
||||
virtual_mob = null
|
||||
no_z_overlay = TRUE
|
||||
|
||||
var/atom/movable/host
|
||||
var/host_type = /atom/movable
|
||||
var/abilities = VIRTUAL_ABILITY_HEAR|VIRTUAL_ABILITY_SEE
|
||||
var/list/broadcast_methods
|
||||
|
||||
var/static/list/overlay_icons
|
||||
|
||||
/mob/abstract/observer/virtual/New(var/location, var/atom/movable/host)
|
||||
..()
|
||||
if(!istype(host, host_type))
|
||||
CRASH("Received an unexpected host type. Expected [host_type], was [log_info_line(host)].")
|
||||
src.host = host
|
||||
moved_event.register(host, src, /atom/movable/proc/move_to_turf_or_null)
|
||||
|
||||
all_virtual_listeners += src
|
||||
|
||||
update_icon()
|
||||
|
||||
/mob/abstract/observer/virtual/Initialize()
|
||||
. = ..()
|
||||
STOP_PROCESSING(SSmob, src)
|
||||
|
||||
/mob/abstract/observer/virtual/Destroy()
|
||||
moved_event.unregister(host, src, /atom/movable/proc/move_to_turf_or_null)
|
||||
all_virtual_listeners -= src
|
||||
host = null
|
||||
return ..()
|
||||
|
||||
/mob/abstract/observer/virtual/update_icon()
|
||||
if(!overlay_icons)
|
||||
overlay_icons = list()
|
||||
for(var/i_state in icon_states(icon))
|
||||
overlay_icons[i_state] = image(icon = icon, icon_state = i_state)
|
||||
overlays.Cut()
|
||||
|
||||
if(abilities & VIRTUAL_ABILITY_HEAR)
|
||||
overlays += overlay_icons["hear"]
|
||||
if(abilities & VIRTUAL_ABILITY_SEE)
|
||||
overlays += overlay_icons["see"]
|
||||
|
||||
//
|
||||
// Virtual Mob Creation
|
||||
//
|
||||
/atom/movable
|
||||
var/mob/abstract/observer/virtual/virtual_mob
|
||||
|
||||
/atom/movable/Initialize()
|
||||
. = ..()
|
||||
if(shall_have_virtual_mob())
|
||||
virtual_mob = new virtual_mob(get_turf(src), src)
|
||||
|
||||
/atom/movable/proc/shall_have_virtual_mob()
|
||||
return ispath(initial(virtual_mob))
|
||||
@@ -0,0 +1,13 @@
|
||||
/proc/mobs_in_range(var/atom/movable/AM)
|
||||
. = list()
|
||||
for(var/mob/abstract/observer/virtual/v_mob in range(world.view, get_turf(AM)))
|
||||
if(ismob(v_mob.host))
|
||||
. += v_mob.host
|
||||
|
||||
/proc/clients_in_range(var/atom/movable/AM)
|
||||
. = list()
|
||||
for(var/mob/abstract/observer/virtual/v_mob in range(world.view, get_turf(AM)))
|
||||
if(ismob(v_mob.host))
|
||||
var/mob/M = v_mob.host
|
||||
if(M.client)
|
||||
. |= M.client
|
||||
@@ -0,0 +1,22 @@
|
||||
/mob/abstract/observer/virtual/mob
|
||||
host_type = /mob
|
||||
|
||||
/mob/abstract/observer/virtual/mob/New(var/location, var/mob/host)
|
||||
..()
|
||||
|
||||
sight_set_event.register(host, src, /mob/abstract/observer/virtual/mob/proc/sync_sight)
|
||||
see_invisible_set_event.register(host, src, /mob/abstract/observer/virtual/mob/proc/sync_sight)
|
||||
see_in_dark_set_event.register(host, src, /mob/abstract/observer/virtual/mob/proc/sync_sight)
|
||||
|
||||
sync_sight(host)
|
||||
|
||||
/mob/abstract/observer/virtual/mob/Destroy()
|
||||
sight_set_event.unregister(host, src, /mob/abstract/observer/virtual/mob/proc/sync_sight)
|
||||
see_invisible_set_event.unregister(host, src, /mob/abstract/observer/virtual/mob/proc/sync_sight)
|
||||
see_in_dark_set_event.unregister(host, src, /mob/abstract/observer/virtual/mob/proc/sync_sight)
|
||||
. = ..()
|
||||
|
||||
/mob/abstract/observer/virtual/mob/proc/sync_sight(var/mob/mob_host)
|
||||
sight = mob_host.sight
|
||||
see_invisible = mob_host.see_invisible
|
||||
see_in_dark = mob_host.see_in_dark
|
||||
@@ -72,9 +72,9 @@
|
||||
|
||||
layer = MOB_LAYER
|
||||
|
||||
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
|
||||
see_in_dark = 8
|
||||
see_invisible = SEE_INVISIBLE_LEVEL_TWO
|
||||
set_sight(sight|SEE_TURFS|SEE_MOBS|SEE_OBJS)
|
||||
set_see_in_dark(8)
|
||||
set_see_invisible(SEE_INVISIBLE_LEVEL_TWO)
|
||||
|
||||
drop_r_hand()
|
||||
drop_l_hand()
|
||||
|
||||
@@ -91,24 +91,24 @@
|
||||
return 1
|
||||
|
||||
/mob/living/carbon/alien/handle_regular_hud_updates()
|
||||
if (!..())
|
||||
return//Returns if no client
|
||||
if(!..())
|
||||
return // Returns if no client.
|
||||
|
||||
if (stat == 2 || (XRAY in src.mutations))
|
||||
sight |= (SEE_TURFS|SEE_MOBS|SEE_OBJS)
|
||||
see_in_dark = 8
|
||||
see_invisible = SEE_INVISIBLE_LEVEL_TWO
|
||||
else if (stat != 2 && is_ventcrawling == 0)
|
||||
if (species && species.vision_flags)
|
||||
if(stat == DEAD || (XRAY in src.mutations))
|
||||
set_sight(sight|SEE_TURFS|SEE_MOBS|SEE_OBJS)
|
||||
set_see_in_dark(8)
|
||||
set_see_invisible(SEE_INVISIBLE_LEVEL_TWO)
|
||||
else if(stat != DEAD && is_ventcrawling == FALSE)
|
||||
if(species && species.vision_flags)
|
||||
sight = species.vision_flags
|
||||
else
|
||||
sight &= ~(SEE_TURFS|SEE_MOBS|SEE_OBJS)
|
||||
see_in_dark = 2
|
||||
see_invisible = SEE_INVISIBLE_LIVING
|
||||
set_sight(sight&(~SEE_TURFS)&(~SEE_MOBS)&(~SEE_OBJS))
|
||||
set_see_in_dark(2)
|
||||
set_see_invisible(SEE_INVISIBLE_LIVING)
|
||||
|
||||
if (healths)
|
||||
if (stat != DEAD)
|
||||
switch((health - getHalLoss()) / maxHealth * 100)//Halloss should be factored in here for displaying
|
||||
switch((health - getHalLoss()) / maxHealth * 100) // Halloss should be factored in here for displaying
|
||||
if(100 to INFINITY)
|
||||
healths.icon_state = "health0"
|
||||
if(80 to 100)
|
||||
|
||||
@@ -165,18 +165,14 @@
|
||||
return 1
|
||||
|
||||
/mob/living/carbon/brain/handle_regular_hud_updates()
|
||||
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
|
||||
if(stat == DEAD || (XRAY in src.mutations))
|
||||
set_sight(sight|SEE_TURFS|SEE_MOBS|SEE_OBJS)
|
||||
set_see_in_dark(8)
|
||||
set_see_invisible(SEE_INVISIBLE_LEVEL_TWO)
|
||||
else if(stat != DEAD)
|
||||
set_sight(sight&(~SEE_TURFS)&(~SEE_MOBS)&(~SEE_OBJS))
|
||||
set_see_in_dark(2)
|
||||
set_see_invisible(SEE_INVISIBLE_LIVING)
|
||||
|
||||
if (healths)
|
||||
if (stat != 2)
|
||||
@@ -198,18 +194,15 @@
|
||||
else
|
||||
healths.icon_state = "health7"
|
||||
|
||||
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
|
||||
if(stat == DEAD || (XRAY in src.mutations))
|
||||
set_sight(sight|SEE_TURFS|SEE_MOBS|SEE_OBJS)
|
||||
set_see_in_dark(8)
|
||||
set_see_invisible(SEE_INVISIBLE_LEVEL_TWO)
|
||||
else if(stat != DEAD)
|
||||
set_sight(sight&(~SEE_TURFS)&(~SEE_MOBS)&(~SEE_OBJS))
|
||||
set_see_in_dark(2)
|
||||
set_see_invisible(SEE_INVISIBLE_LIVING)
|
||||
|
||||
if (client)
|
||||
client.screen.Remove(global_hud.blurry,global_hud.druggy,global_hud.vimpaired)
|
||||
|
||||
|
||||
@@ -1352,7 +1352,7 @@
|
||||
if(viewflags < 0)
|
||||
reset_view(null, 0)
|
||||
else if(viewflags)
|
||||
sight |= viewflags
|
||||
set_sight(sight, viewflags)
|
||||
else if(eyeobj)
|
||||
if(eyeobj.owner != src)
|
||||
reset_view(null)
|
||||
@@ -1389,7 +1389,7 @@
|
||||
if(stat == DEAD)
|
||||
return
|
||||
if(XRAY in mutations)
|
||||
sight |= SEE_TURFS|SEE_MOBS|SEE_OBJS
|
||||
set_sight(sight|SEE_TURFS|SEE_MOBS|SEE_OBJS)
|
||||
|
||||
/mob/living/carbon/human/proc/handle_stamina()
|
||||
if (species.stamina == -1) //If species stamina is -1, it has special mechanics which will be handled elsewhere
|
||||
|
||||
@@ -510,21 +510,19 @@
|
||||
H.sight &= ~(H.equipment_vision_flags)
|
||||
H.sight &= ~(vision[1])
|
||||
else
|
||||
H.sight |= get_vision_flags(H)
|
||||
H.sight |= H.equipment_vision_flags
|
||||
H.sight |= vision[1]
|
||||
H.set_sight(H.sight|get_vision_flags(H)|H.equipment_vision_flags|vision[1])
|
||||
|
||||
if(H.stat == DEAD)
|
||||
return 1
|
||||
|
||||
if(!H.druggy)
|
||||
H.see_in_dark = (H.sight == (SEE_TURFS|SEE_MOBS|SEE_OBJS)) ? 8 : min(darksight + H.equipment_darkness_modifier, 8)
|
||||
H.set_see_in_dark((H.sight == (SEE_TURFS|SEE_MOBS|SEE_OBJS)) ? 8 : min(darksight + H.equipment_darkness_modifier, 8))
|
||||
if(H.seer)
|
||||
var/obj/effect/rune/R = locate(/obj/effect/rune) in get_turf(H)
|
||||
if(R && R.type == /datum/rune/see_invisible)
|
||||
H.see_invisible = SEE_INVISIBLE_CULT
|
||||
H.set_see_invisible(SEE_INVISIBLE_CULT)
|
||||
if(H.see_invisible != SEE_INVISIBLE_CULT && H.equipment_see_invis)
|
||||
H.see_invisible = min(H.see_invisible, H.equipment_see_invis)
|
||||
H.set_see_invisible(min(H.see_invisible, H.equipment_see_invis))
|
||||
|
||||
if(H.equipment_tint_total >= TINT_BLIND)
|
||||
H.eye_blind = max(H.eye_blind, 1)
|
||||
|
||||
@@ -146,7 +146,7 @@
|
||||
if(viewflags < 0)
|
||||
reset_view(null, 0)
|
||||
else if(viewflags)
|
||||
sight |= viewflags
|
||||
set_sight(viewflags)
|
||||
else if(eyeobj)
|
||||
if(eyeobj.owner != src)
|
||||
reset_view(null)
|
||||
|
||||
@@ -147,15 +147,15 @@
|
||||
if(is_blinded())
|
||||
update_icon()
|
||||
overlay_fullscreen("blind", /obj/screen/fullscreen/blind)
|
||||
sight &= ~(SEE_TURFS | SEE_MOBS | SEE_OBJS)
|
||||
see_in_dark = 0
|
||||
see_invisible = SEE_INVISIBLE_LIVING
|
||||
set_sight(sight&(~SEE_TURFS)&(~SEE_MOBS)&(~SEE_OBJS))
|
||||
set_see_in_dark(0)
|
||||
set_see_invisible(SEE_INVISIBLE_LIVING)
|
||||
else if(stat == DEAD)
|
||||
update_dead_sight()
|
||||
else
|
||||
sight |= (SEE_TURFS|SEE_MOBS|SEE_OBJS)
|
||||
see_in_dark = 8
|
||||
see_invisible = SEE_INVISIBLE_LIVING
|
||||
set_sight(sight|SEE_TURFS|SEE_MOBS|SEE_OBJS)
|
||||
set_see_in_dark(8)
|
||||
set_see_invisible(SEE_INVISIBLE_LIVING)
|
||||
|
||||
/mob/living/silicon/ai/proc/is_blinded()
|
||||
var/area/A = get_area(src)
|
||||
|
||||
@@ -150,30 +150,28 @@
|
||||
/mob/living/silicon/robot/handle_regular_hud_updates()
|
||||
..()
|
||||
if(stat == DEAD || (XRAY in mutations) || (sight_mode & BORGXRAY))
|
||||
sight |= (SEE_TURFS | SEE_MOBS | SEE_OBJS)
|
||||
see_in_dark = 8
|
||||
see_invisible = SEE_INVISIBLE_MINIMUM
|
||||
set_sight(sight|SEE_TURFS|SEE_MOBS|SEE_OBJS)
|
||||
set_see_in_dark(8)
|
||||
set_see_invisible(SEE_INVISIBLE_LEVEL_TWO)
|
||||
else if((sight_mode & BORGMESON) && (sight_mode & BORGTHERM))
|
||||
sight |= (SEE_TURFS | SEE_MOBS)
|
||||
see_in_dark = 8
|
||||
see_invisible = SEE_INVISIBLE_MINIMUM
|
||||
set_sight(sight|SEE_TURFS|SEE_MOBS)
|
||||
set_see_in_dark(8)
|
||||
set_see_invisible(SEE_INVISIBLE_NOLIGHTING)
|
||||
else if(sight_mode & BORGMESON)
|
||||
sight |= SEE_TURFS
|
||||
see_in_dark = 8
|
||||
see_invisible = SEE_INVISIBLE_MINIMUM
|
||||
set_sight(sight|SEE_TURFS)
|
||||
set_see_in_dark(8)
|
||||
set_see_invisible(SEE_INVISIBLE_NOLIGHTING)
|
||||
else if(sight_mode & BORGMATERIAL)
|
||||
sight |= SEE_OBJS
|
||||
see_in_dark = 8
|
||||
see_invisible = SEE_INVISIBLE_MINIMUM
|
||||
set_sight(sight|SEE_OBJS)
|
||||
set_see_in_dark(8)
|
||||
else if(sight_mode & BORGTHERM)
|
||||
sight |= SEE_MOBS
|
||||
see_in_dark = 8
|
||||
see_invisible = SEE_INVISIBLE_LEVEL_TWO
|
||||
else if(stat != 2)
|
||||
sight &= ~(SEE_TURFS | SEE_MOBS | SEE_OBJS)
|
||||
see_in_dark = 8 // see_in_dark means you can FAINTLY see in the dark, humans have a range of 3 or so, tajaran have it at 8
|
||||
see_invisible = SEE_INVISIBLE_LIVING // This is normal vision (25), setting it lower for normal vision means you don't "see" things like darkness since darkness
|
||||
// has a "invisible" value of 15
|
||||
set_sight(sight|SEE_MOBS)
|
||||
set_see_in_dark(8)
|
||||
set_see_invisible(SEE_INVISIBLE_LEVEL_TWO)
|
||||
else if(stat != DEAD)
|
||||
set_sight(sight&(~SEE_TURFS)&(~SEE_MOBS)&(~SEE_OBJS))
|
||||
set_see_in_dark(8)
|
||||
set_see_invisible(SEE_INVISIBLE_LIVING)
|
||||
|
||||
switch(sensor_mode)
|
||||
if(SEC_HUD)
|
||||
|
||||
@@ -66,7 +66,7 @@
|
||||
|
||||
disconnect_time = null
|
||||
next_move = 1
|
||||
sight |= SEE_SELF
|
||||
set_sight(sight|SEE_SELF)
|
||||
disconnect_time = null
|
||||
|
||||
player_age = client.player_age
|
||||
|
||||
Reference in New Issue
Block a user