Skip to content

Commit

Permalink
More circuitry, also known as, "THIS IS NOT ENOUGH" (#71)
Browse files Browse the repository at this point in the history
  • Loading branch information
SandPoot authored Sep 19, 2020
1 parent d2257ab commit 0b7570d
Show file tree
Hide file tree
Showing 12 changed files with 288 additions and 33 deletions.
6 changes: 3 additions & 3 deletions code/modules/integrated_electronics/subtypes/input.dm
Original file line number Diff line number Diff line change
Expand Up @@ -849,11 +849,11 @@
The first activation pin is always pulsed when the circuit hears someone talk, while the second one \
is only triggered if it hears someone speaking a language other than Galactic Common."
icon_state = "recorder"
complexity = 8
complexity = 4 //cuts complexity in half, you'll need to use a ref to string for the name
inputs = list()
flags_1 = CONDUCT_1 | HEAR_1
outputs = list(
"speaker" = IC_PINTYPE_STRING,
"speaker" = IC_PINTYPE_REF,
"message" = IC_PINTYPE_STRING
)
activators = list("on message received" = IC_PINTYPE_PULSE_OUT, "on translation" = IC_PINTYPE_PULSE_OUT)
Expand All @@ -867,7 +867,7 @@
if(raw_message)
if(message_langs != get_selected_language())
translated = TRUE
set_pin_data(IC_OUTPUT, 1, speaker.GetVoice())
set_pin_data(IC_OUTPUT, 1, speaker)
set_pin_data(IC_OUTPUT, 2, raw_message)

push_data()
Expand Down
24 changes: 18 additions & 6 deletions code/modules/mob/mob.dm
Original file line number Diff line number Diff line change
Expand Up @@ -370,10 +370,19 @@ mob/visible_message(message, self_message, blind_message, vision_distance = DEFA
var/msg = "<span class='smallnotice'>[src] makes eye contact with you.</span>"
addtimer(CALLBACK(GLOBAL_PROC, .proc/to_chat, examined_mob, msg), 3)

//same as above
//note: ghosts can point, this is intended
//visible_message will handle invisibility properly
//overridden here and in /mob/dead/observer for different point span classes and sanity checks
/**
* Point at an atom
*
* mob verbs are faster than object verbs. See
* [this byond forum post](https://secure.byond.com/forum/?post=1326139&page=2#comment8198716)
* for why this isn't atom/verb/pointed()
*
* note: ghosts can point, this is intended
*
* visible_message will handle invisibility properly
*
* overridden here and in /mob/dead/observer for different point span classes and sanity checks
*/
/mob/verb/pointed(atom/A as mob|obj|turf in fov_view())
set name = "Point To"
set category = "Object"
Expand All @@ -383,12 +392,15 @@ mob/visible_message(message, self_message, blind_message, vision_distance = DEFA
if(istype(A, /obj/effect/temp_visual/point))
return FALSE

var/tile = get_turf(A)
var/turf/tile = get_turf(A)
if (!tile)
return FALSE

new /obj/effect/temp_visual/point(A,invisibility)
var/turf/our_tile = get_turf(src)
var/obj/visual = new /obj/effect/temp_visual/point(our_tile, invisibility)
animate(visual, pixel_x = (tile.x - our_tile.x) * world.icon_size + A.pixel_x, pixel_y = (tile.y - our_tile.y) * world.icon_size + A.pixel_y, time = 1.7, easing = EASE_OUT)
SEND_SIGNAL(src, COMSIG_MOB_POINTED, A)

return TRUE

/mob/proc/can_resist()
Expand Down
1 change: 1 addition & 0 deletions sandcode/code/_globalvars/lists/misc.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
GLOBAL_VAR_INIT(remote_control, TRUE)
2 changes: 2 additions & 0 deletions sandcode/code/_globalvars/lists/objects.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
GLOBAL_LIST_EMPTY(ic_jammers)
GLOBAL_LIST_EMPTY(ic_speakers)
4 changes: 2 additions & 2 deletions sandcode/code/game/machinery/computer/arcade/tetris.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,8 +33,8 @@
return

if(user.client)
var/datum/asset/simple/C = new/datum/asset/simple/tetris()
SSassets.transport.send_assets(user.client, C.assets)
var/datum/asset/assets = get_asset_datum(/datum/asset/simple/tetris)
assets.send(user)

var/dat = {"
<!DOCTYPE HTML PUBLIC '-//W3C//DTD HTML 4.01 Transitional//EN'>
Expand Down
10 changes: 10 additions & 0 deletions sandcode/code/game/machinery/telecomms/machine_interactions.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// Additional Options for certain machines. Use this when you want to add an option to a specific machine.
// Example of how to use below.

/obj/machinery/telecomms/proc/Options_Menu()
return ""

// The topic for Additional Options. Use this for checking href links for your specific option.
// Example of how to use below.
/obj/machinery/telecomms/proc/Options_Topic(href, href_list)
return
46 changes: 46 additions & 0 deletions sandcode/code/game/machinery/telecomms/machines/receiver.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
//Code for the interceptor circuit
/obj/machinery/telecomms/receiver/Options_Menu()
var/dat = "<br>Remote control: <a href='?src=[REF(src)];toggle_remote_control=1'>[GLOB.remote_control ? "<font color='green'><b>ENABLED</b></font>" : "<font color='red'><b>DISABLED</b></font>"]</a>"
dat += "<br>Broadcasting signals: "
for(var/i in GLOB.ic_speakers)
var/obj/item/integrated_circuit/I = i
var/obj/item/O = I.get_object()
if(get_area(O)) //if it isn't in nullspace, can happen due to printer newing all possible circuits to fetch list data
dat += "<br>[O.name] = [O.x], [O.y], [O.z], [get_area(O)]"
dat += "<br><br>Circuit jammer signals: "
for(var/i in GLOB.ic_jammers)
var/obj/item/integrated_circuit/I = i
var/obj/item/O = I.get_object()
if(get_area(O)) //if it isn't in nullspace, can happen due to printer newing all possible circuits to fetch list data
dat += "<br>[O.name] = [O.x], [O.y], [O.z], [get_area(O)]"
return dat

/obj/machinery/telecomms/receiver/Options_Topic(href, href_list)
if(href_list["toggle_remote_control"])
GLOB.remote_control = !GLOB.remote_control

/obj/machinery/telecomms/receiver/receive_signal(datum/signal/signal)
if(LAZYLEN(GLOB.ic_jammers) && GLOB.remote_control)
for(var/i in GLOB.ic_jammers)
var/obj/item/integrated_circuit/input/tcomm_interceptor/T = i
var/obj/item/O = T.get_object()
if(is_station_level(O.z)&& (!istype(get_area(O), /area/space)))
if(!istype(signal.source, /obj/item/radio/headset/integrated))
signal.data["reject"] = TRUE
break
..()

//makeshift receiver used for the circuit, so that we don't
//have to edit radio.dm and other shit
/obj/machinery/telecomms/receiver/circuit
idle_power_usage = 0
var/obj/item/integrated_circuit/input/tcomm_interceptor/holder

/obj/machinery/telecomms/receiver/circuit/receive_signal(datum/signal/signal)
if(!holder.get_pin_data(IC_INPUT, 1))
return
if(!signal)
return
holder.receive_signal(signal)

// End
88 changes: 88 additions & 0 deletions sandcode/code/modules/integrated_electronics/subtypes/input.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
//Interceptor
//Intercepts a telecomms signal, aka a radio message (;halp getting griff)
//Inputs:
//On (Boolean): If on, the circuit intercepts radio signals. Otherwise it does not. This doesn't affect no pass!
//No pass (Boolean): Decides if the signal will be silently intercepted
// (false) or also blocked from being sent on the radio (true)
//Outputs:
//Source: name of the mob
//Job: job of the mob
//content: the actual message
//spans: a list of spans, there's not much info about this but stuff like robots will have "robot" span
/obj/item/integrated_circuit/input/tcomm_interceptor
name = "telecommunication interceptor"
desc = "This circuit allows for telecomms signals \
to be fetched prior to being broadcasted."
extended_desc = "Similar \
to the old NTSL system of realtime signal modification, \
the circuit connects to telecomms and fetches data \
for each signal, which can be sent normally or blocked, \
for cases such as other circuits modifying certain data. \
Beware, this cannot stop signals from unreachable areas, such \
as space or zlevels other than station's one."
complexity = 30
cooldown_per_use = 0.1
w_class = WEIGHT_CLASS_SMALL
inputs = list(
"intercept" = IC_PINTYPE_BOOLEAN,
"no pass" = IC_PINTYPE_BOOLEAN
)
outputs = list(
"source" = IC_PINTYPE_STRING,
"job" = IC_PINTYPE_STRING,
"content" = IC_PINTYPE_STRING,
"spans" = IC_PINTYPE_LIST,
"frequency" = IC_PINTYPE_NUMBER
)
activators = list(
"on intercept" = IC_PINTYPE_PULSE_OUT
)
power_draw_idle = 0
spawn_flags = IC_SPAWN_RESEARCH
var/obj/machinery/telecomms/receiver/circuit/receiver
var/list/freq_blacklist = list(FREQ_CENTCOM,FREQ_SYNDICATE,FREQ_CTF_RED,FREQ_CTF_BLUE)

/obj/item/integrated_circuit/input/tcomm_interceptor/Initialize()
. = ..()
receiver = new(src)
receiver.holder = src

/obj/item/integrated_circuit/input/tcomm_interceptor/Destroy()
qdel(receiver)
GLOB.ic_jammers -= src
..()

/obj/item/integrated_circuit/input/tcomm_interceptor/receive_signal(datum/signal/signal)
if((signal.transmission_method == TRANSMISSION_SUBSPACE) && get_pin_data(IC_INPUT, 1))
if(signal.frequency in freq_blacklist)
return
set_pin_data(IC_OUTPUT, 1, signal.data["name"])
set_pin_data(IC_OUTPUT, 2, signal.data["job"])
set_pin_data(IC_OUTPUT, 3, signal.data["message"])
set_pin_data(IC_OUTPUT, 4, signal.data["spans"])
set_pin_data(IC_OUTPUT, 5, signal.frequency)
push_data()
activate_pin(1)

/obj/item/integrated_circuit/input/tcomm_interceptor/on_data_written()
if(get_pin_data(IC_INPUT, 2))
GLOB.ic_jammers |= src
if(get_pin_data(IC_INPUT, 1))
power_draw_idle = 200
else
power_draw_idle = 100
else
GLOB.ic_jammers -= src
if(get_pin_data(IC_INPUT, 1))
power_draw_idle = 100
else
power_draw_idle = 0

/obj/item/integrated_circuit/input/tcomm_interceptor/power_fail()
set_pin_data(IC_INPUT, 1, 0)
set_pin_data(IC_INPUT, 2, 0)

/obj/item/integrated_circuit/input/tcomm_interceptor/disconnect_all()
set_pin_data(IC_INPUT, 1, 0)
set_pin_data(IC_INPUT, 2, 0)
..()
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
/obj/item/integrated_circuit/manipulation/activator
name = "activator"
desc = "Circuit which can activate things remotely!"
icon_state = "pull_claw"
extended_desc = "This circuit needs a reference to a thing to activate, it also needs to know who is activating said item."
w_class = WEIGHT_CLASS_SMALL
size = 3
cooldown_per_use = 1
complexity = 10
inputs = list("target" = IC_PINTYPE_REF, "person" = IC_PINTYPE_REF)
activators = list("pulse in" = IC_PINTYPE_PULSE_IN,"pulse out" = IC_PINTYPE_PULSE_OUT)
spawn_flags = IC_SPAWN_RESEARCH
power_draw_per_use = 50
ext_cooldown = 1

/obj/item/integrated_circuit/manipulation/activator/do_work(ord)
var/obj/acting_object = get_pin_data_as_type(IC_INPUT, 1, /obj/)
var/mob/person = get_pin_data_as_type(IC_INPUT, 2, /mob/)
acting_object.interact(person)
activate_pin(1)


/obj/item/integrated_circuit/manipulation/advactivator
name = "advactivator"
desc = "Circuit which can UI elements remotely!"
icon_state = "pull_claw"
extended_desc = "This circuit needs a reference to a to activate, as well as action and parems to pass! Use mode 1 for lists or 0 for single values."
w_class = WEIGHT_CLASS_SMALL
size = 3
cooldown_per_use = 1
complexity = 10

//inputs = list("target" = IC_PINTYPE_REF, "action" = IC_PINTYPE_STRING, "params" = IC_PINTYPE_STRING)
inputs = list("target" = IC_PINTYPE_REF, "action" = IC_PINTYPE_STRING, "mode" = IC_PINTYPE_NUMBER, "params" = IC_PINTYPE_STRING, "listparams" = IC_PINTYPE_LIST)
activators = list("pulse in" = IC_PINTYPE_PULSE_IN,"pulse out" = IC_PINTYPE_PULSE_OUT)
spawn_flags = IC_SPAWN_RESEARCH
power_draw_per_use = 50
ext_cooldown = 1
var/max_grab = GRAB_PASSIVE

/obj/item/integrated_circuit/manipulation/advactivator/do_work(ord)
var/obj/acting_object = get_pin_data_as_type(IC_INPUT, 1, /obj/)
var/action = get_pin_data(IC_INPUT, 2)
var/mode = get_pin_data(IC_INPUT, 3)
var/params = get_pin_data(IC_INPUT, 4)
if(mode == 1)
params = get_pin_data(IC_INPUT, 5)

acting_object.ui_act(action, params)
activate_pin(1)
40 changes: 40 additions & 0 deletions sandcode/code/modules/integrated_electronics/subtypes/output.dm
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
. = ..()
radio = new(src)
radio.frequency = FREQ_COMMON
GLOB.ic_speakers += src

/obj/item/integrated_circuit/output/text_to_radio/Destroy()
qdel(radio)
GLOB.ic_speakers -= src
..()

/obj/item/integrated_circuit/output/text_to_radio/on_data_written()
Expand Down Expand Up @@ -79,3 +81,41 @@
to_chat(user, "<span class='notice'>There are no encryption keys to remove from the mechanism.</span>")

/obj/item/radio/headset/integrated

//sandstorm original - pointer
/obj/item/integrated_circuit/output/pointer
name = "pointer circuit"
desc = "Takes a reference and points to it upon activation."
extended_desc = "This machine points at something for everyone to see."
icon_state = "pull_claw"
complexity = 2
inputs = list("target" = IC_PINTYPE_REF)
activators = list("point" = IC_PINTYPE_PULSE_IN, "on pointed" = IC_PINTYPE_PULSE_OUT, "on failure" = IC_PINTYPE_PULSE_OUT)
spawn_flags = IC_SPAWN_DEFAULT|IC_SPAWN_RESEARCH
power_draw_per_use = 10
cooldown_per_use = 0.1

/obj/item/integrated_circuit/output/pointer/do_work()
if(!get_pin_data(IC_INPUT, 1))
activate_pin(3)
return
else
assembly.point(get_pin_data(IC_INPUT, 1))
activate_pin(2)

/obj/item/electronic_assembly/proc/point(atom/A as mob|obj|turf in view())
if(!src || !(A in view(src.loc)))
return FALSE
if(istype(A, /obj/effect/temp_visual/point))
return FALSE

var/turf/tile = get_turf(A)
if(!tile)
return FALSE

var/turf/our_tile = get_turf(src)
var/obj/visual = new /obj/effect/temp_visual/point(our_tile, invisibility)
animate(visual, pixel_x = (tile.x - our_tile.x) * world.icon_size + A.pixel_x, pixel_y = (tile.y - our_tile.y) * world.icon_size + A.pixel_y, time = 1.7, easing = EASE_OUT)
SEND_SIGNAL(src, COMSIG_MOB_POINTED, A)

return TRUE
6 changes: 6 additions & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -3614,6 +3614,8 @@
#include "sandcode\code\__DEFINES\status_effects.dm"
#include "sandcode\code\__DEFINES\traits.dm"
#include "sandcode\code\__DEFINES\wires.dm"
#include "sandcode\code\_globalvars\lists\misc.dm"
#include "sandcode\code\_globalvars\lists\objects.dm"
#include "sandcode\code\_onclick\hud\screen_objects.dm"
#include "sandcode\code\datums\action.dm"
#include "sandcode\code\datums\ai_laws.dm"
Expand Down Expand Up @@ -3645,6 +3647,8 @@
#include "sandcode\code\game\machinery\posialert.dm"
#include "sandcode\code\game\machinery\computer\arcade\tetris.dm"
#include "sandcode\code\game\machinery\pipe\construction.dm"
#include "sandcode\code\game\machinery\telecomms\machine_interactions.dm"
#include "sandcode\code\game\machinery\telecomms\machines\receiver.dm"
#include "sandcode\code\game\mecha\mecha_construction_paths.dm"
#include "sandcode\code\game\mecha\mecha_parts.dm"
#include "sandcode\code\game\objects\effects\contraband.dm"
Expand Down Expand Up @@ -3684,6 +3688,8 @@
#include "sandcode\code\modules\crafting\recipes\recipes_misc.dm"
#include "sandcode\code\modules\hydroponics\grown\misc.dm"
#include "sandcode\code\modules\integrated_electronics\core\assemblies.dm"
#include "sandcode\code\modules\integrated_electronics\subtypes\input.dm"
#include "sandcode\code\modules\integrated_electronics\subtypes\manipulation.dm"
#include "sandcode\code\modules\integrated_electronics\subtypes\output.dm"
#include "sandcode\code\modules\keybindings\keybind\carbon.dm"
#include "sandcode\code\modules\language\dragon.dm"
Expand Down
Loading

0 comments on commit 0b7570d

Please sign in to comment.