Add a public mode to holopads (#25098)

* Add a public mode to holopads

By default, holocalls require someone to answer at the receiving end.
This change adds a multitool interaction to holopads that toggles a
public mode setting, which is disabled by default. When enabled,
holopads will automatically answer calls made to them.

* Autodoc holopad vars

* More holopad autodoc

* Add examine text to holopads

This change adds an examine text to holopads, informing users of the
maintenance panel's open status and that it can be opened or closed, and
also informing users of the holopad's public mode setting, and how to
set it.

* Reword examine text for clarity as suggested by Henri215

Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>
Signed-off-by: asciodev <81930475+asciodev@users.noreply.github.com>

* Remove redundant comment documenting holo_range var

---------

Signed-off-by: asciodev <81930475+asciodev@users.noreply.github.com>
Co-authored-by: Henri215 <77684085+Henri215@users.noreply.github.com>
This commit is contained in:
asciodev
2024-05-03 14:46:16 +00:00
committed by GitHub
co-authored by Henri215
parent 654a48ab86
commit 6ae62bde9c
+55 -9
View File
@@ -35,6 +35,28 @@ Possible to do for anyone motivated enough:
GLOBAL_LIST_EMPTY(holopads)
/**
* A stationary holopad for projecting hologram and making and receiving holocalls.
*
* Holopads are floor-plane machines similar, in appearance and interactive function, to quantum pads. They can be
* used by crew members to make and answer holocalls, or by the AI to project holograms autonomously.
*
* Holopads are machines which can project a hologram up to `holo_range` tiles away. They do this in one of two modes:
* holocalls, and AI holograms. Holocalls require a user to stand on a holopad, use its menu to select a remote holopad,
* and make a call. Holocalls must be answered by the receiving holopad, or they will fail. Holopads can be configured
* globally to auto-accept instead of failing, with the debug static variable `force_answer_call`. They can also be
* individually configured to auto-accept calls immediately by setting their public mode option (`public_mode`),
* which can be done in-game by using a screwdriver and then a multitool on a holopad. Holocalls will automatically end
* if power goes out, the caller moves off the calling holopad, the caller projects outside the receiving holopad's
* range, the caller is killed or incapacitated, the caller ghosts or disconnects, or the caller is QDELETED. AI
* holograms require the AI to focus on the originating holopad and click on it; no answer is required. If the AI moves
* out of a holopad's range and into the range of another, it will attempt to transfer its hologram to the next holopad.
* Otherwise, AI holograms will stop projecting if power goes out for the originating holopad, the AI clicks on its
* origin holopad, or, like holocalls, if the AI is killed, incapacitated, disconnected, QDELETED, or ghosts.
* Holopads relay speech from the caller made with the :h radio key, and relay all speech on the answering end to the
* caller or AI.
*/
/obj/machinery/hologram/holopad
name = "holopad"
desc = "It's a floor-mounted device for projecting holographic images."
@@ -47,17 +69,29 @@ GLOBAL_LIST_EMPTY(holopads)
max_integrity = 300
armor = list(melee = 50, bullet = 20, laser = 20, energy = 20, bomb = 0, rad = 0, fire = 50, acid = 0)
var/list/masters = list()//List of living mobs that use the holopad
var/list/holorays = list()//Holoray-mob link.
var/last_request = 0 //to prevent request spam. ~Carn
var/holo_range = 5 // Change to change how far the AI can move away from the holopad before deactivating.
/// List of living mobs currently using the holopad
var/list/masters = list()
/// Holoray-mob link.
var/list/holorays = list()
/// Last request time, to prevent request spam. ~Carn
var/last_request = 0
/// The range, in tiles, that a holopad can project a hologram.
var/holo_range = 5
var/temp = ""
var/list/holo_calls //array of /datum/holocalls
var/datum/holocall/outgoing_call //do not modify the datums only check and call the public procs
var/static/force_answer_call = FALSE //Calls will be automatically answered after a couple rings, here for debugging
/// A list of holocalls associated with this holopad.
var/list/holo_calls
/// The outgoing holocall currently being processed by this holopad.
var/datum/holocall/outgoing_call
/// Universal debug toggle for whether holopads will automatically answer calls after a few rings.
var/static/force_answer_call = FALSE
/// Toggle for auto-answering calls immediately, set via multitool.
var/public_mode = FALSE
/// The ray effect emanating from this holopad to the produced hologram.
var/obj/effect/overlay/holoray/ray
/// Whether or not this holopad is currently ringing, from being called by another pad.
var/ringing = FALSE
var/dialling_input = FALSE //The user is currently selecting where to send their call
/// Whether or not the user is currently selecting where to send their call.
var/dialling_input = FALSE
/obj/machinery/hologram/holopad/Initialize(mapload)
. = ..()
@@ -120,6 +154,13 @@ GLOBAL_LIST_EMPTY(holopads)
return
return ..()
/obj/machinery/hologram/holopad/multitool_act(mob/living/user, obj/item/I)
. = TRUE
if(!I.use_tool(src, user, 0, volume = I.tool_volume))
return
public_mode = !public_mode
to_chat(user, "<span class='notice'>You [public_mode ? "enable" : "disable"] the holopad's public mode setting.</span>")
/obj/machinery/hologram/holopad/screwdriver_act(mob/user, obj/item/I)
. = TRUE
default_deconstruction_screwdriver(user, "holopad_open", "holopad0", I)
@@ -143,6 +184,11 @@ GLOBAL_LIST_EMPTY(holopads)
user.set_machine(src)
interact(user)
/obj/machinery/hologram/holopad/examine(mob/user)
. = ..()
. += "<span class='notice'>Its maintenance panel can be <b>screwed [panel_open ? "closed" : "open"]</b>.</span>"
. += "<span class='notice'>Its public mode indicator reads <b>[public_mode ? "on" : "off"]</b>. It can be <b>turned [public_mode ? "off" : "on"]</b> by using a multitool while the maintenance panel is open.</span>"
/obj/machinery/hologram/holopad/AltClick(mob/living/carbon/human/user)
if(..())
return
@@ -300,7 +346,7 @@ GLOBAL_LIST_EMPTY(holopads)
continue
if(HC.connected_holopad != src)
if(force_answer_call && world.time > (HC.call_start_time + (HOLOPAD_MAX_DIAL_TIME / 2)))
if((force_answer_call && world.time > (HC.call_start_time + (HOLOPAD_MAX_DIAL_TIME / 2))) || public_mode)
HC.Answer(src)
break
if(outgoing_call)