Adds wires for holopad (#89947)

## About The Pull Request
Adds wires for the holopad with a red light to turn recording on and off
and a purple one to switch the loop.

An example of a fun use with proximity sensor and looping switching:


https://github.com/user-attachments/assets/ad6a711a-3e10-4bfd-9b8c-ab83ca949f03

And a small piece showing what happens if you try to play a recording
without a disc or with an empty disc:



https://github.com/user-attachments/assets/9dd398d6-f189-4f65-b5e3-f53f2747398f
## Why It's Good For The Game
The holopad has great potential for personal constructions of players,
and I would like to expand its functionality by adding interaction with
the wiring.
## Changelog
🆑
add: Adds wires for holopad
/🆑

---------

Co-authored-by: grungussuss <96586172+Sadboysuss@users.noreply.github.com>
Co-authored-by: Ghom <42542238+Ghommie@users.noreply.github.com>
This commit is contained in:
Maximal08
2025-03-17 13:26:32 +05:00
committed by GitHub
parent 1116ed0e03
commit 8752e4e991
4 changed files with 65 additions and 2 deletions

View File

@@ -95,6 +95,8 @@
#define WIRE_OVERCLOCK "Overclock"
#define WIRE_EQUIPMENT "Equipment"
#define WIRE_ENVIRONMENT "Environment"
#define WIRE_LOOP_MODE "Loop mode"
#define WIRE_REPLAY_MODE "Replay mode"
// Wire states for the AI
#define AI_WIRE_NORMAL 0

View File

@@ -0,0 +1,47 @@
/datum/wires/holopad
holder_type = /obj/machinery/holopad
proper_name = "holopad"
/datum/wires/holopad/interactable(mob/user)
var/obj/machinery/holopad/holopad = holder
return holopad.panel_open ? ..() : FALSE
/datum/wires/holopad/New(atom/holder)
wires = list(
WIRE_LOOP_MODE,
WIRE_REPLAY_MODE
)
return ..()
/datum/wires/holopad/get_status()
var/obj/machinery/holopad/holopad = holder
var/list/status = list()
status += "The purple light is [holopad.loop_mode ? "on" : "off"]."
status += "The red light is [holopad.replay_mode ? "on" : "off"]."
return status
/datum/wires/holopad/on_pulse(wire)
var/obj/machinery/holopad/holopad = holder
switch(wire)
if(WIRE_LOOP_MODE)
holopad.loop_mode = !holopad.loop_mode
if(WIRE_REPLAY_MODE)
if (!holopad.replay_mode)
holopad.replay_start()
holopad.replay_mode = TRUE
else
holopad.replay_stop()
holopad.replay_mode = FALSE
return ..()
/datum/wires/holopad/on_cut(wire, mend, source)
var/obj/machinery/holopad/holopad = holder
if(wire == WIRE_REPLAY_MODE)
if(mend)
holopad.replay_stop()
holopad.replay_mode = FALSE
else
holopad.replay_start()
holopad.replay_mode = TRUE
return ..()

View File

@@ -108,6 +108,7 @@ Possible to do for anyone motivated enough:
)
)
AddElement(/datum/element/contextual_screentip_mob_typechecks, hovering_mob_typechecks)
set_wires(new /datum/wires/holopad(src))
if(on_network)
holopads += src
@@ -621,10 +622,12 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
return TRUE
/obj/machinery/holopad/proc/clear_holo(datum/owner)
qdel(masters[owner]) // Get rid of owner's hologram
if(!disk || !disk.record)
return FALSE
qdel(masters[owner])
unset_holo(owner)
return TRUE
/**
* Called by holocall to inform outgoing_call that the receiver picked up.
*/
@@ -751,6 +754,14 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
return hologram
/obj/machinery/holopad/proc/replay_start()
if(!disk)
say("Please insert the disc to play the recording.")
return
if(!disk.record)
say("There is no record on the disc. Please check the disk.")
return
if(!replay_mode)
replay_mode = TRUE
replay_holo = setup_replay_holo(disk.record)
@@ -758,6 +769,8 @@ For the other part of the code, check silicon say.dm. Particularly robot talk.*/
replay_entry(1)
/obj/machinery/holopad/proc/replay_stop()
if(!disk || !disk.record)
return FALSE
if(replay_mode)
replay_mode = FALSE
offset = FALSE

View File

@@ -2005,6 +2005,7 @@
#include "code\datums\wires\emitter.dm"
#include "code\datums\wires\explosive.dm"
#include "code\datums\wires\fax.dm"
#include "code\datums\wires\holopad.dm"
#include "code\datums\wires\mass_driver.dm"
#include "code\datums\wires\mecha.dm"
#include "code\datums\wires\microwave.dm"