Blueprints Rework (#18947)

Reworks blueprints to use an eye component for area selection and
changing. Blueprints will now work on whichever overmap site they spawn
on if overmap is enabled, though currently they have only been added to
the Horizon.

Adds shuttle-modifying blueprints for altering shuttle areas and
exoplanet outpost blueprints for creating areas on exoplanets. A set of
outpost blueprints and a lockbox containing blueprints for the Horizon's
shuttles have been added to the CE's locker.

Moves eye creation to a component.

Ported from:
https://github.com/NebulaSS13/Nebula/pull/465
https://github.com/NebulaSS13/Nebula/pull/564
https://github.com/NebulaSS13/Nebula/pull/3046
This commit is contained in:
RustingWithYou
2024-04-20 09:56:26 +12:00
committed by GitHub
parent ab23fbdb70
commit 6957bc34f1
29 changed files with 810 additions and 302 deletions
+84
View File
@@ -0,0 +1,84 @@
/datum/component/eye
///The actual eye mob linked to the component
var/mob/abstract/eye/component_eye
///What type of /mob/abstract/eye is used
var/eye_type = /mob/abstract/eye
///The mob currently looking through the eye
var/mob/current_looker
///Actions used to pass commands from the eye to the holder. Must be subtypes of /datum/action/eye
///Base type of the action, all subtypes of this are added to actions.
var/action_type
///The actions available to the eye
var/list/actions = list()
/datum/component/eye/Destroy()
unlook()
QDEL_LIST(actions)
. = ..()
/datum/component/eye/proc/look(var/mob/new_looker, var/list/eye_args)
if(new_looker.eyeobj || current_looker)
return FALSE
LAZYINSERT(eye_args, get_turf(current_looker), 1) //Make sure that a loc is provided to the eye
if(!component_eye)
component_eye = new eye_type(arglist(eye_args))
current_looker = new_looker
component_eye.possess(current_looker)
if(action_type)
for(var/atype in subtypesof(action_type))
var/datum/action/eye/action = new atype(src)
actions += action
action.Grant(current_looker)
//Manual unlooking for the looker
var/datum/action/eye/unlook/unlook_action = new(src)
actions += unlook_action
unlook_action.Grant(current_looker)
//Checks for removing the user from the eye outside of unlook actions.
RegisterSignal(parent, COMSIG_MOVABLE_MOVED, PROC_REF(unlook))
RegisterSignal(current_looker, COMSIG_MOVABLE_MOVED, PROC_REF(unlook))
RegisterSignal(parent, COMSIG_QDELETING, PROC_REF(unlook))
RegisterSignal(current_looker, COMSIG_QDELETING, PROC_REF(unlook))
RegisterSignal(component_eye, COMSIG_QDELETING, PROC_REF(unlook))
RegisterSignal(current_looker, COMSIG_MOB_LOGOUT, PROC_REF(unlook))
RegisterSignal(current_looker, COMSIG_GLOB_MOB_DEATH, PROC_REF(unlook))
return TRUE
/datum/component/eye/proc/unlook()
if(!isnull(parent))
UnregisterSignal(parent, COMSIG_QDELETING)
UnregisterSignal(parent, COMSIG_MOVABLE_MOVED)
if(!isnull(component_eye))
UnregisterSignal(component_eye, COMSIG_QDELETING)
component_eye.release(current_looker)
if(!isnull(current_looker))
UnregisterSignal(current_looker, COMSIG_MOVABLE_MOVED)
UnregisterSignal(current_looker, COMSIG_QDELETING)
UnregisterSignal(current_looker, COMSIG_MOB_LOGOUT)
UnregisterSignal(current_looker, COMSIG_GLOB_MOB_DEATH)
if(current_looker.client)
current_looker.client.eye = current_looker
current_looker.eyeobj = null
QDEL_NULL(component_eye)
if(current_looker)
for(var/datum/action/A in actions)
A.Remove(current_looker)
current_looker = null
/datum/component/eye/proc/get_eye_turf()
return get_turf(component_eye)
//Every eye created using a subtype of this extension will have this action added for manual unlooking.
/datum/action/eye/unlook
name = "Stop looking"
procname = "unlook"
button_icon_state = "cancel"
target_type = COMPONENT_TARGET
+48
View File
@@ -0,0 +1,48 @@
/datum/component/eye/blueprints
eye_type = /mob/abstract/eye/blueprints
action_type = /datum/action/eye/blueprints
/datum/action/eye/blueprints
eye_type = /mob/abstract/eye/blueprints
/datum/action/eye/blueprints/mark_new_area
name = "Mark New Area"
procname = "create_area"
button_icon_state = "pencil"
target_type = EYE_TARGET
/datum/action/eye/blueprints/remove_selection
name = "Remove Selection"
procname = "remove_selection"
button_icon_state = "eraser"
target_type = EYE_TARGET
/datum/action/eye/blueprints/edit_area
name = "Edit Area"
procname = "edit_area"
button_icon_state = "edit_area"
target_type = EYE_TARGET
/datum/action/eye/blueprints/remove_area
name = "Remove Area"
procname = "remove_area"
button_icon_state = "remove_area"
target_type = EYE_TARGET
/datum/action/eye/blueprints/help
name = "Help"
procname = "help"
button_icon_state = "help"
target_type = COMPONENT_TARGET
/datum/component/eye/blueprints/proc/help()
if(!current_looker)
return
to_chat(current_looker, SPAN_NOTICE("***********************************************************"))
to_chat(current_looker, SPAN_NOTICE("Left Click = Select Area"))
to_chat(current_looker, SPAN_NOTICE("Shift Click = Deselect Area"))
to_chat(current_looker, SPAN_NOTICE("Control Click = Clear Selection"))
to_chat(current_looker, SPAN_NOTICE("***********************************************************"))
/datum/component/eye/blueprints/shuttle
eye_type = /mob/abstract/eye/blueprints/shuttle
+13
View File
@@ -0,0 +1,13 @@
//For mobs connecting to the station's cameranet without needing AI procs
/datum/component/eye/cameranet
eye_type = /mob/abstract/eye/cameranet
//For mobs connecting to other visualnets. Pass visualnet as eye_args in look()
/datum/component/eye/freelook
eye_type = /mob/abstract/eye
/datum/component/eye/freelook/proc/set_visualnet(var/datum/visualnet/net)
if(component_eye)
var/mob/abstract/eye/eye = component_eye
if(istype(eye))
eye.visualnet = net