Skip to content

Commit

Permalink
Camera eyes have been lightly refactored (among other things...) (tgs…
Browse files Browse the repository at this point in the history
…tation#87805)

## About The Pull Request

* A generic /mob/eye/camera type has been made, containing everything
needed to interface with a cameranet
* /mob/eye/ai_eye has been refactored into a generic /mob/eye/camera
instance
* Advanced cameras no longer inherit from AI eyes, splitting off
behaviour
* Camera code has been somewhat cleaned up
* Probably some more stuff I'm forgetting right now

## Big man Southport:

![image](https://github.com/user-attachments/assets/de6e6ff0-ca99-4636-bdec-5e0b2d6b8037)

## Changelog

:cl:
code: made /proc/getviewsize() pure

refactor: mob/eye/ai_eye has been restructured, now inheriting from a
generic mob/eye/camera type
refactor: advanced cameras and their subtypes are now
mob/eye/camera/remote subtypes
code: the cameranet no longer expects the user to be an AI eye
code: remote camera eyes have had their initialization streamlined
code: remote cameras handle assigning and unassigning users by
themselves now
code: remote cameras now use weakrefs instead of hard referencing owners
and origins
code: also the sentient disease is_define was removed (we don't have
those anymore)
fix: AI eyes no longer assign real names to themselves, fixing their
orbit name
/:cl:

---------

Co-authored-by: Ghom <[email protected]>
  • Loading branch information
tontyGH and Ghommie authored Nov 21, 2024
1 parent 6859e71 commit d8450b4
Show file tree
Hide file tree
Showing 29 changed files with 473 additions and 357 deletions.
4 changes: 2 additions & 2 deletions .github/guides/ISSUE_MANAGER.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ If an issue reports a runtime, it must have the actual runtime call stack provid
- usr.loc: the floor (150,25,4) (/turf/open/floor/circuit)
- call stack:
- Camera Net (/datum/cameranet): visibility(/list (/list), null, /list (/list), 1)
- AI (/mob/living/silicon/ai): camera visibility(Inactive AI Eye (/mob/eye/ai_eye))
- Inactive AI Eye (/mob/eye/ai_eye): setLoc(the floor (150,25,4) (/turf/open/floor/circuit), 0)
- AI (/mob/living/silicon/ai): camera visibility(Inactive AI Eye (/mob/eye/camera/ai))
- Inactive AI Eye (/mob/eye/camera/ai): setLoc(the floor (150,25,4) (/turf/open/floor/circuit), 0)
- AI (/mob/living/silicon/ai): create eye()
- AI (/mob/living/silicon/ai): Initialize(0, null, TagGamerGame2 (/mob/dead/new_player))
- Atoms (/datum/controller/subsystem/atoms): InitAtom(AI (/mob/living/silicon/ai), 0, /list (/list))
Expand Down
18 changes: 10 additions & 8 deletions code/__DEFINES/is_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -202,21 +202,23 @@ GLOBAL_LIST_INIT(turfs_pass_meteor, typecacheof(list(

#define isspider(A) (istype(A, /mob/living/basic/spider))

//Eye mobs
#define iseyemob(A) (istype(A, /mob/eye))

//Misc mobs
#define isobserver(A) (istype(A, /mob/dead/observer))
#define isovermind(A) (istype(A, /mob/eye/blob))

#define isdead(A) (istype(A, /mob/dead))
#define iscameramob(A) (istype(A, /mob/eye/camera))

#define isnewplayer(A) (istype(A, /mob/dead/new_player))
#define isaicamera(A) (istype(A, /mob/eye/camera/ai))

#define isovermind(A) (istype(A, /mob/eye/blob))
#define isremotecamera(A) (istype(A, /mob/eye/camera/remote))

#define issentientdisease(A) (istype(A, /mob/eye/disease))
//Dead mobs
#define isdead(A) (istype(A, /mob/dead))

#define iseyemob(A) (istype(A, /mob/eye))
#define isobserver(A) (istype(A, /mob/dead/observer))

#define isaicamera(A) (istype(A, /mob/eye/ai_eye))
#define isnewplayer(A) (istype(A, /mob/dead/new_player))

//Objects
#define isobj(A) istype(A, /obj) //override the byond proc because it returns true on children of /atom/movable that aren't objs
Expand Down
6 changes: 2 additions & 4 deletions code/__HELPERS/view.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
/proc/getviewsize(view)
if(!view) // Just to avoid any runtimes that could otherwise cause constant disconnect loops.
stack_trace("Missing value for 'view' in getviewsize(), defaulting to world.view!")
view = world.view
/proc/getviewsize(view = world.view)
SHOULD_BE_PURE(TRUE)

if(isnum(view))
var/totalviewrange = (view < 0 ? -1 : 1) + 2 * view
Expand Down
2 changes: 1 addition & 1 deletion code/_globalvars/lists/mobs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ GLOBAL_LIST_EMPTY(available_ai_shells)
GLOBAL_LIST_INIT(simple_animals, list(list(),list(),list())) // One for each AI_* status define
GLOBAL_LIST_EMPTY(spidermobs) //all sentient spider mobs
GLOBAL_LIST_EMPTY(bots_list)
GLOBAL_LIST_EMPTY(aiEyes)
GLOBAL_LIST_EMPTY(camera_eyes)
GLOBAL_LIST_EMPTY(suit_sensors_list) //all people with suit sensors on

/// All alive mobs with clients.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@
/atom/movable/screen/plane_master/camera_static/proc/eye_changed(datum/hud/source, atom/old_eye, atom/new_eye)
SIGNAL_HANDLER

if(!isaicamera(new_eye))
if(!iscameramob(new_eye))
if(!force_hidden)
hide_plane(source.mymob)
return
Expand Down
2 changes: 1 addition & 1 deletion code/datums/components/supermatter_crystal.dm
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@
if(iscyborg(user) && atom_source.Adjacent(user))
dust_mob(source, user, cause = "cyborg attack")
return
if(isaicamera(user))
if(iscameramob(user))
return
if(islarva(user))
dust_mob(source, user, cause = "larva attack")
Expand Down
26 changes: 10 additions & 16 deletions code/datums/holocall.dm
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
/mob/eye/ai_eye/remote/holo/setLoc(turf/destination, force_update = FALSE)
/mob/eye/camera/remote/holo/setLoc(turf/destination, force_update = FALSE)
// If we're moving outside the space of our projector, then just... don't
var/obj/machinery/holopad/H = origin
if(!H?.move_hologram(eye_user, destination))
var/obj/machinery/holopad/H = origin_ref?.resolve()
if(!H?.move_hologram(user_ref?.resolve(), destination))
sprint = initial(sprint) // Reset sprint so it doesn't balloon in our calling proc
return
return ..()

/obj/machinery/holopad/remove_eye_control(mob/living/user)
if(user.client)
user.reset_perspective(null)
user.remote_control = null
var/mob/eye/camera/remote/eye = user.remote_control
if(!istype(eye))
CRASH("Attempted to remove eye control from non-camera eye. Something has gone horribly wrong.")
eye.assign_user(null)

//this datum manages its own references

Expand All @@ -24,7 +25,7 @@
var/list/dialed_holopads

///user's eye, once connected
var/mob/eye/ai_eye/remote/holo/eye
var/mob/eye/camera/remote/holo/eye
///user's hologram, once connected
var/obj/effect/overlay/holo_pad_hologram/hologram
///hangup action
Expand Down Expand Up @@ -155,15 +156,8 @@
hologram = answering_holopad.activate_holo(user)
hologram.HC = src

//eyeobj code is horrid, this is the best copypasta I could make
eye = new
eye.origin = answering_holopad
eye.eye_initialized = TRUE
eye.eye_user = user
eye.name = "Camera Eye ([user.name])"
user.remote_control = eye
user.reset_perspective(eye)
eye.setLoc(answering_holopad.loc)
eye = new(get_turf(answering_holopad), answering_holopad)
eye.assign_user(user)

hangup = new(eye, src)
hangup.Grant(user)
Expand Down
2 changes: 1 addition & 1 deletion code/game/atom/_atom.dm
Original file line number Diff line number Diff line change
Expand Up @@ -881,7 +881,7 @@
var/extra_context = ""
var/used_name = name

if(isliving(user) || isovermind(user) || isaicamera(user) || (ghost_screentips && isobserver(user)))
if(isliving(user) || isovermind(user) || iscameramob(user) || (ghost_screentips && isobserver(user)))
var/obj/item/held_item = user.get_active_held_item()

if (user.mob_flags & MOB_HAS_SCREENTIPS_NAME_OVERRIDE)
Expand Down
2 changes: 1 addition & 1 deletion code/game/data_huds.dm
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
. = ..()
if(!new_viewer || hud_users_all_z_levels.len != 1)
return
for(var/mob/eye/ai_eye/eye as anything in GLOB.aiEyes)
for(var/mob/eye/camera/ai/eye as anything in GLOB.camera_eyes)
eye.update_ai_detect_hud()

/datum/atom_hud/data/malf_apc
Expand Down
Loading

0 comments on commit d8450b4

Please sign in to comment.