mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-18 03:26:31 +01:00
NTOS Signaler Modular App and hardware part (#58895)
Co-authored-by: Aleksej Komarov <stylemistake@gmail.com>
This commit is contained in:
@@ -62,6 +62,7 @@
|
||||
#define MC_CHARGE "CHARGE"
|
||||
#define MC_AI "AI"
|
||||
#define MC_SENSORS "SENSORS"
|
||||
#define MC_SIGNALER "SIGNALER"
|
||||
|
||||
//NTNet stuff, for modular computers
|
||||
// NTNet module-configuration values. Do not change these. If you need to add another use larger number (5..6..7 etc)
|
||||
|
||||
@@ -44,6 +44,7 @@
|
||||
backpack = /obj/item/storage/backpack/science
|
||||
satchel = /obj/item/storage/backpack/satchel/tox
|
||||
duffelbag = /obj/item/storage/backpack/duffelbag/toxins
|
||||
backpack_contents = list(/obj/item/modular_computer/tablet/preset/science=1)
|
||||
|
||||
pda_slot = ITEM_SLOT_LPOCKET
|
||||
|
||||
|
||||
@@ -40,6 +40,7 @@
|
||||
backpack = /obj/item/storage/backpack/science
|
||||
satchel = /obj/item/storage/backpack/satchel/tox
|
||||
duffelbag = /obj/item/storage/backpack/duffelbag/toxins
|
||||
backpack_contents = list(/obj/item/modular_computer/tablet/preset/science=1)
|
||||
|
||||
id_trim = /datum/id_trim/job/scientist
|
||||
|
||||
|
||||
@@ -20,6 +20,17 @@
|
||||
install_component(new /obj/item/computer_hardware/card_slot)
|
||||
install_component(new /obj/item/computer_hardware/printer/mini)
|
||||
|
||||
/obj/item/modular_computer/tablet/preset/science/Initialize()
|
||||
. = ..()
|
||||
var/obj/item/computer_hardware/hard_drive/small/hard_drive = new
|
||||
install_component(new /obj/item/computer_hardware/processor_unit/small)
|
||||
install_component(new /obj/item/computer_hardware/battery(src, /obj/item/stock_parts/cell/computer))
|
||||
install_component(hard_drive)
|
||||
install_component(new /obj/item/computer_hardware/card_slot)
|
||||
install_component(new /obj/item/computer_hardware/network_card)
|
||||
install_component(new /obj/item/computer_hardware/radio_card)
|
||||
hard_drive.store_file(new /datum/computer_file/program/signaler)
|
||||
|
||||
/obj/item/modular_computer/tablet/preset/cargo/Initialize()
|
||||
. = ..()
|
||||
var/obj/item/computer_hardware/hard_drive/small/hard_drive = new
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
/datum/computer_file/program/signaler
|
||||
filename = "signaler"
|
||||
filedesc = "SignalCommander"
|
||||
category = PROGRAM_CATEGORY_MISC
|
||||
program_icon_state = "signal"
|
||||
extended_desc = "A small built-in frequency app that sends out signaller signals with the appropriate hardware."
|
||||
size = 2
|
||||
tgui_id = "NtosSignaler"
|
||||
program_icon = "satellite-dish"
|
||||
usage_flags = PROGRAM_TABLET | PROGRAM_LAPTOP
|
||||
///What is the saved signal frequency?
|
||||
var/signal_frequency = FREQ_SIGNALER
|
||||
/// What is the saved signal code?
|
||||
var/signal_code = DEFAULT_SIGNALER_CODE
|
||||
/// Radio connection datum used by signalers.
|
||||
var/datum/radio_frequency/radio_connection
|
||||
|
||||
/datum/computer_file/program/signaler/run_program(mob/living/user)
|
||||
. = ..()
|
||||
if (!.)
|
||||
return
|
||||
if(!computer?.get_modular_computer_part(MC_SIGNALER)) //Giving a clue to users why the program is spitting out zeros.
|
||||
to_chat(user, "<span class='warning'>\The [computer] flashes an error: \"hardware\\signal_hardware\\startup.bin -- file not found\".</span>")
|
||||
|
||||
|
||||
/datum/computer_file/program/signaler/ui_data(mob/user)
|
||||
var/list/data = get_header_data()
|
||||
var/obj/item/computer_hardware/radio_card/sensor = computer?.get_modular_computer_part(MC_SIGNALER)
|
||||
if(sensor?.check_functionality())
|
||||
data["frequency"] = signal_frequency
|
||||
data["code"] = signal_code
|
||||
data["minFrequency"] = MIN_FREE_FREQ
|
||||
data["maxFrequency"] = MAX_FREE_FREQ
|
||||
return data
|
||||
|
||||
/datum/computer_file/program/signaler/ui_act(action, list/params)
|
||||
. = ..()
|
||||
if(.)
|
||||
return
|
||||
var/obj/item/computer_hardware/radio_card/sensor = computer?.get_modular_computer_part(MC_SIGNALER)
|
||||
if(!(sensor?.check_functionality()))
|
||||
playsound(src, 'sound/machines/scanbuzz.ogg', 100, FALSE)
|
||||
return
|
||||
switch(action)
|
||||
if("signal")
|
||||
INVOKE_ASYNC(src, .proc/signal)
|
||||
. = TRUE
|
||||
if("freq")
|
||||
signal_frequency = unformat_frequency(params["freq"])
|
||||
signal_frequency = sanitize_frequency(signal_frequency, TRUE)
|
||||
set_frequency(signal_frequency)
|
||||
. = TRUE
|
||||
if("code")
|
||||
signal_code = text2num(params["code"])
|
||||
signal_code = round(signal_code)
|
||||
. = TRUE
|
||||
if("reset")
|
||||
if(params["reset"] == "freq")
|
||||
signal_frequency = initial(signal_frequency)
|
||||
else
|
||||
signal_code = initial(signal_code)
|
||||
. = TRUE
|
||||
|
||||
/datum/computer_file/program/signaler/proc/signal()
|
||||
if(!radio_connection)
|
||||
return
|
||||
|
||||
var/time = time2text(world.realtime,"hh:mm:ss")
|
||||
var/turf/T = get_turf(src)
|
||||
|
||||
var/logging_data
|
||||
if(usr)
|
||||
logging_data = "[time] <B>:</B> [usr.key] used [src] @ location ([T.x],[T.y],[T.z]) <B>:</B> [format_frequency(signal_frequency)]/[signal_code]"
|
||||
GLOB.lastsignalers.Add(logging_data)
|
||||
|
||||
var/datum/signal/signal = new(list("code" = signal_code), logging_data = logging_data)
|
||||
radio_connection.post_signal(src, signal)
|
||||
|
||||
/datum/computer_file/program/signaler/proc/set_frequency(new_frequency)
|
||||
SSradio.remove_object(src, signal_frequency)
|
||||
signal_frequency = new_frequency
|
||||
radio_connection = SSradio.add_object(src, signal_frequency, RADIO_SIGNALER)
|
||||
return
|
||||
@@ -9,17 +9,29 @@
|
||||
var/obj/item/modular_computer/holder = null
|
||||
// Computer that holds this hardware, if any.
|
||||
|
||||
var/power_usage = 0 // If the hardware uses extra power, change this.
|
||||
var/enabled = TRUE // If the hardware is turned off set this to 0.
|
||||
var/critical = FALSE // Prevent disabling for important component, like the CPU.
|
||||
var/can_install = TRUE // Prevents direct installation of removable media.
|
||||
var/expansion_hw = FALSE // Hardware that fits into expansion bays.
|
||||
var/removable = TRUE // Whether the hardware is removable or not.
|
||||
var/damage = 0 // Current damage level
|
||||
var/max_damage = 100 // Maximal damage level.
|
||||
var/damage_malfunction = 20 // "Malfunction" threshold. When damage exceeds this value the hardware piece will semi-randomly fail and do !!FUN!! things
|
||||
var/damage_failure = 50 // "Failure" threshold. When damage exceeds this value the hardware piece will not work at all.
|
||||
var/malfunction_probability = 10// Chance of malfunction when the component is damaged
|
||||
// If the hardware uses extra power, change this.
|
||||
var/power_usage = 0
|
||||
// If the hardware is turned off set this to 0.
|
||||
var/enabled = TRUE
|
||||
// Prevent disabling for important component, like the CPU.
|
||||
var/critical = FALSE
|
||||
// Prevents direct installation of removable media.
|
||||
var/can_install = TRUE
|
||||
// Hardware that fits into expansion bays.
|
||||
var/expansion_hw = FALSE
|
||||
// Whether the hardware is removable or not.
|
||||
var/removable = TRUE
|
||||
// Current damage level
|
||||
var/damage = 0
|
||||
// Maximal damage level.
|
||||
var/max_damage = 100
|
||||
// "Malfunction" threshold. When damage exceeds this value the hardware piece will semi-randomly fail and do !!FUN!! things
|
||||
var/damage_malfunction = 20
|
||||
// "Failure" threshold. When damage exceeds this value the hardware piece will not work at all.
|
||||
var/damage_failure = 50
|
||||
// Chance of malfunction when the component is damaged
|
||||
var/malfunction_probability = 10
|
||||
// What define is used to qualify this piece of hardware? Important for upgraded versions of the same hardware.
|
||||
var/device_type
|
||||
|
||||
/obj/item/computer_hardware/New(obj/L)
|
||||
|
||||
@@ -6,3 +6,12 @@
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
device_type = MC_SENSORS
|
||||
expansion_hw = TRUE
|
||||
|
||||
/obj/item/computer_hardware/radio_card
|
||||
name = "integrated radio card"
|
||||
desc = "An integrated signaling assembly for computers to send an outgoing frequency signal. Required by certain programs."
|
||||
icon_state = "signal_card"
|
||||
w_class = WEIGHT_CLASS_TINY
|
||||
device_type = MC_SIGNALER
|
||||
expansion_hw = TRUE
|
||||
power_usage = 10
|
||||
|
||||
@@ -252,3 +252,12 @@
|
||||
build_path = /obj/item/computer_hardware/sensorpackage
|
||||
category = list("Computer Parts")
|
||||
departmental_flags = DEPARTMENTAL_FLAG_SCIENCE | DEPARTMENTAL_FLAG_ENGINEERING
|
||||
|
||||
/datum/design/signaler_part
|
||||
name = "Integrated Signaler"
|
||||
id = "signalpart"
|
||||
build_type = PROTOLATHE | AWAY_LATHE
|
||||
materials = list(/datum/material/iron = 400, /datum/material/glass = 100)
|
||||
build_path = /obj/item/computer_hardware/radio_card
|
||||
category = list("Computer Parts")
|
||||
departmental_flags = DEPARTMENTAL_FLAG_SCIENCE | DEPARTMENTAL_FLAG_ENGINEERING
|
||||
|
||||
@@ -21,7 +21,8 @@
|
||||
/obj/item/computer_hardware/ai_slot = 2,
|
||||
/obj/item/computer_hardware/printer/mini = 2,
|
||||
/obj/item/computer_hardware/recharger/apc_recharger = 2,
|
||||
/obj/item/paicard = 2)
|
||||
/obj/item/paicard = 2,
|
||||
/obj/item/computer_hardware/radio_card = 1)
|
||||
refill_canister = /obj/item/vending_refill/modularpc
|
||||
default_price = PAYCHECK_MEDIUM
|
||||
extra_price = PAYCHECK_HARD
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 31 KiB After Width: | Height: | Size: 31 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 20 KiB After Width: | Height: | Size: 20 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 17 KiB After Width: | Height: | Size: 17 KiB |
@@ -2825,6 +2825,7 @@
|
||||
#include "code\modules\modular_computers\file_system\programs\robocontrol.dm"
|
||||
#include "code\modules\modular_computers\file_system\programs\robotact.dm"
|
||||
#include "code\modules\modular_computers\file_system\programs\secureye.dm"
|
||||
#include "code\modules\modular_computers\file_system\programs\signaler.dm"
|
||||
#include "code\modules\modular_computers\file_system\programs\sm_monitor.dm"
|
||||
#include "code\modules\modular_computers\file_system\programs\techweb.dm"
|
||||
#include "code\modules\modular_computers\file_system\programs\antagonist\contract_uplink.dm"
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
import { SignalerContent } from './Signaler';
|
||||
import { NtosWindow } from '../layouts';
|
||||
|
||||
export const NtosSignaler = (props, context) => {
|
||||
return (
|
||||
<NtosWindow
|
||||
width={400}
|
||||
height={300}>
|
||||
<NtosWindow.Content>
|
||||
<SignalerContent />
|
||||
</NtosWindow.Content>
|
||||
</NtosWindow>
|
||||
);
|
||||
};
|
||||
@@ -4,6 +4,19 @@ import { Button, Grid, NumberInput, Section } from '../components';
|
||||
import { Window } from '../layouts';
|
||||
|
||||
export const Signaler = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
return (
|
||||
<Window
|
||||
width={280}
|
||||
height={132}>
|
||||
<Window.Content>
|
||||
<SignalerContent />
|
||||
</Window.Content>
|
||||
</Window>
|
||||
);
|
||||
};
|
||||
|
||||
export const SignalerContent = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
const {
|
||||
code,
|
||||
@@ -11,81 +24,77 @@ export const Signaler = (props, context) => {
|
||||
minFrequency,
|
||||
maxFrequency,
|
||||
} = data;
|
||||
const color = 'rgba(13, 13, 213, 0.7)';
|
||||
const backColor = 'rgba(0, 0, 69, 0.5)';
|
||||
return (
|
||||
<Window
|
||||
width={280}
|
||||
height={132}>
|
||||
<Window.Content>
|
||||
<Section>
|
||||
<Grid>
|
||||
<Grid.Column size={1.4} color="label">
|
||||
Frequency:
|
||||
</Grid.Column>
|
||||
<Grid.Column>
|
||||
<NumberInput
|
||||
animate
|
||||
unit="kHz"
|
||||
step={0.2}
|
||||
stepPixelSize={6}
|
||||
minValue={minFrequency / 10}
|
||||
maxValue={maxFrequency / 10}
|
||||
value={frequency / 10}
|
||||
format={value => toFixed(value, 1)}
|
||||
width="80px"
|
||||
onDrag={(e, value) => act('freq', {
|
||||
freq: value,
|
||||
})} />
|
||||
</Grid.Column>
|
||||
<Grid.Column>
|
||||
<Button
|
||||
ml={1.3}
|
||||
icon="sync"
|
||||
content="Reset"
|
||||
onClick={() => act('reset', {
|
||||
reset: "freq",
|
||||
})} />
|
||||
</Grid.Column>
|
||||
</Grid>
|
||||
<Grid mt={0.6}>
|
||||
<Grid.Column size={1.4} color="label">
|
||||
Code:
|
||||
</Grid.Column>
|
||||
<Grid.Column>
|
||||
<NumberInput
|
||||
animate
|
||||
step={1}
|
||||
stepPixelSize={6}
|
||||
minValue={1}
|
||||
maxValue={100}
|
||||
value={code}
|
||||
width="80px"
|
||||
onDrag={(e, value) => act('code', {
|
||||
code: value,
|
||||
})} />
|
||||
</Grid.Column>
|
||||
<Grid.Column>
|
||||
<Button
|
||||
ml={1.3}
|
||||
icon="sync"
|
||||
content="Reset"
|
||||
onClick={() => act('reset', {
|
||||
reset: "code",
|
||||
})} />
|
||||
</Grid.Column>
|
||||
</Grid>
|
||||
<Grid mt={0.8}>
|
||||
<Grid.Column>
|
||||
<Button
|
||||
mb={-0.1}
|
||||
fluid
|
||||
icon="arrow-up"
|
||||
content="Send Signal"
|
||||
textAlign="center"
|
||||
onClick={() => act('signal')} />
|
||||
</Grid.Column>
|
||||
</Grid>
|
||||
</Section>
|
||||
</Window.Content>
|
||||
</Window>
|
||||
<Section>
|
||||
<Grid>
|
||||
<Grid.Column size={1.4} color="label">
|
||||
Frequency:
|
||||
</Grid.Column>
|
||||
<Grid.Column>
|
||||
<NumberInput
|
||||
animate
|
||||
unit="kHz"
|
||||
step={0.2}
|
||||
stepPixelSize={6}
|
||||
minValue={minFrequency / 10}
|
||||
maxValue={maxFrequency / 10}
|
||||
value={frequency / 10}
|
||||
format={value => toFixed(value, 1)}
|
||||
width="80px"
|
||||
onDrag={(e, value) => act('freq', {
|
||||
freq: value,
|
||||
})} />
|
||||
</Grid.Column>
|
||||
<Grid.Column>
|
||||
<Button
|
||||
ml={1.3}
|
||||
icon="sync"
|
||||
content="Reset"
|
||||
onClick={() => act('reset', {
|
||||
reset: "freq",
|
||||
})} />
|
||||
</Grid.Column>
|
||||
</Grid>
|
||||
<Grid mt={0.6}>
|
||||
<Grid.Column size={1.4} color="label">
|
||||
Code:
|
||||
</Grid.Column>
|
||||
<Grid.Column>
|
||||
<NumberInput
|
||||
animate
|
||||
step={1}
|
||||
stepPixelSize={6}
|
||||
minValue={1}
|
||||
maxValue={100}
|
||||
value={code}
|
||||
width="80px"
|
||||
onDrag={(e, value) => act('code', {
|
||||
code: value,
|
||||
})} />
|
||||
</Grid.Column>
|
||||
<Grid.Column>
|
||||
<Button
|
||||
ml={1.3}
|
||||
icon="sync"
|
||||
content="Reset"
|
||||
onClick={() => act('reset', {
|
||||
reset: "code",
|
||||
})} />
|
||||
</Grid.Column>
|
||||
</Grid>
|
||||
<Grid mt={0.8}>
|
||||
<Grid.Column>
|
||||
<Button
|
||||
mb={-0.1}
|
||||
fluid
|
||||
icon="arrow-up"
|
||||
content="Send Signal"
|
||||
textAlign="center"
|
||||
onClick={() => act('signal')} />
|
||||
</Grid.Column>
|
||||
</Grid>
|
||||
</Section>
|
||||
);
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user