mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-13 19:52:40 +00:00
Radio wires.
This commit is contained in:
@@ -171,6 +171,7 @@
|
|||||||
#include "code\datums\wires\camera.dm"
|
#include "code\datums\wires\camera.dm"
|
||||||
#include "code\datums\wires\mulebot.dm"
|
#include "code\datums\wires\mulebot.dm"
|
||||||
#include "code\datums\wires\particle_accelerator.dm"
|
#include "code\datums\wires\particle_accelerator.dm"
|
||||||
|
#include "code\datums\wires\radio.dm"
|
||||||
#include "code\datums\wires\robot.dm"
|
#include "code\datums\wires\robot.dm"
|
||||||
#include "code\datums\wires\smartfridge.dm"
|
#include "code\datums\wires\smartfridge.dm"
|
||||||
#include "code\datums\wires\suit_storage_unit.dm"
|
#include "code\datums\wires\suit_storage_unit.dm"
|
||||||
|
|||||||
31
code/datums/wires/radio.dm
Normal file
31
code/datums/wires/radio.dm
Normal file
@@ -0,0 +1,31 @@
|
|||||||
|
/datum/wires/radio
|
||||||
|
holder_type = /obj/item/device/radio
|
||||||
|
wire_count = 3
|
||||||
|
|
||||||
|
var/const/WIRE_SIGNAL = 1
|
||||||
|
var/const/WIRE_RECEIVE = 2
|
||||||
|
var/const/WIRE_TRANSMIT = 4
|
||||||
|
|
||||||
|
/datum/wires/radio/CanUse(var/mob/living/L)
|
||||||
|
var/obj/item/device/radio/R = holder
|
||||||
|
if(R.b_stat)
|
||||||
|
return 1
|
||||||
|
return 0
|
||||||
|
|
||||||
|
/datum/wires/radio/Interact(var/mob/living/user)
|
||||||
|
if(CanUse(user))
|
||||||
|
var/obj/item/device/radio/R = holder
|
||||||
|
R.interact(user)
|
||||||
|
|
||||||
|
/datum/wires/radio/UpdatePulsed(var/index)
|
||||||
|
var/obj/item/device/radio/R = holder
|
||||||
|
switch(index)
|
||||||
|
if(WIRE_SIGNAL)
|
||||||
|
R.listening = !R.listening
|
||||||
|
R.broadcasting = R.listening
|
||||||
|
|
||||||
|
if(WIRE_RECEIVE)
|
||||||
|
R.listening = !R.listening
|
||||||
|
|
||||||
|
if(WIRE_TRANSMIT)
|
||||||
|
R.broadcasting = !R.broadcasting
|
||||||
@@ -1,5 +1,3 @@
|
|||||||
|
|
||||||
|
|
||||||
/obj/item/device/radio
|
/obj/item/device/radio
|
||||||
icon = 'icons/obj/radio.dmi'
|
icon = 'icons/obj/radio.dmi'
|
||||||
name = "station bounced radio"
|
name = "station bounced radio"
|
||||||
@@ -12,7 +10,7 @@
|
|||||||
var/traitor_frequency = 0 //tune to frequency to unlock traitor supplies
|
var/traitor_frequency = 0 //tune to frequency to unlock traitor supplies
|
||||||
var/canhear_range = 3 // the range which mobs can hear this radio from
|
var/canhear_range = 3 // the range which mobs can hear this radio from
|
||||||
var/obj/item/device/radio/patch_link = null
|
var/obj/item/device/radio/patch_link = null
|
||||||
var/wires = WIRE_SIGNAL | WIRE_RECEIVE | WIRE_TRANSMIT
|
var/datum/wires/radio/wires = null
|
||||||
var/b_stat = 0
|
var/b_stat = 0
|
||||||
var/broadcasting = 0
|
var/broadcasting = 0
|
||||||
var/listening = 1
|
var/listening = 1
|
||||||
@@ -29,13 +27,8 @@
|
|||||||
w_class = 2
|
w_class = 2
|
||||||
|
|
||||||
matter = list("glass" = 25,"metal" = 75)
|
matter = list("glass" = 25,"metal" = 75)
|
||||||
|
|
||||||
var/const/WIRE_SIGNAL = 1 //sends a signal, like to set off a bomb or electrocute someone
|
|
||||||
var/const/WIRE_RECEIVE = 2
|
|
||||||
var/const/WIRE_TRANSMIT = 4
|
|
||||||
var/const/TRANSMISSION_DELAY = 5 // only 2/second/radio
|
|
||||||
var/const/FREQ_LISTENING = 1
|
var/const/FREQ_LISTENING = 1
|
||||||
//FREQ_BROADCASTING = 2
|
|
||||||
|
|
||||||
/obj/item/device/radio
|
/obj/item/device/radio
|
||||||
var/datum/radio_frequency/radio_connection
|
var/datum/radio_frequency/radio_connection
|
||||||
@@ -48,6 +41,7 @@
|
|||||||
|
|
||||||
/obj/item/device/radio/New()
|
/obj/item/device/radio/New()
|
||||||
..()
|
..()
|
||||||
|
wires = new(src)
|
||||||
if(radio_controller)
|
if(radio_controller)
|
||||||
initialize()
|
initialize()
|
||||||
|
|
||||||
@@ -102,14 +96,9 @@
|
|||||||
return
|
return
|
||||||
|
|
||||||
/obj/item/device/radio/proc/text_wires()
|
/obj/item/device/radio/proc/text_wires()
|
||||||
if (!b_stat)
|
if (b_stat)
|
||||||
return ""
|
return wires.GetInteractWindow()
|
||||||
return {"
|
return
|
||||||
<hr>
|
|
||||||
Green Wire: <A href='byond://?src=\ref[src];wires=4'>[(wires & 4) ? "Cut" : "Mend"] Wire</A><BR>
|
|
||||||
Red Wire: <A href='byond://?src=\ref[src];wires=2'>[(wires & 2) ? "Cut" : "Mend"] Wire</A><BR>
|
|
||||||
Blue Wire: <A href='byond://?src=\ref[src];wires=1'>[(wires & 1) ? "Cut" : "Mend"] Wire</A><BR>
|
|
||||||
"}
|
|
||||||
|
|
||||||
|
|
||||||
/obj/item/device/radio/proc/text_sec_channel(var/chan_name, var/chan_stat)
|
/obj/item/device/radio/proc/text_sec_channel(var/chan_name, var/chan_stat)
|
||||||
@@ -156,14 +145,7 @@
|
|||||||
channels[chan_name] &= ~FREQ_LISTENING
|
channels[chan_name] &= ~FREQ_LISTENING
|
||||||
else
|
else
|
||||||
channels[chan_name] |= FREQ_LISTENING
|
channels[chan_name] |= FREQ_LISTENING
|
||||||
else if (href_list["wires"])
|
|
||||||
var/t1 = text2num(href_list["wires"])
|
|
||||||
if (!( istype(usr.get_active_hand(), /obj/item/weapon/wirecutters) ))
|
|
||||||
return
|
|
||||||
if (wires & t1)
|
|
||||||
wires &= ~t1
|
|
||||||
else
|
|
||||||
wires |= t1
|
|
||||||
if (!( master ))
|
if (!( master ))
|
||||||
if (istype(loc, /mob))
|
if (istype(loc, /mob))
|
||||||
interact(loc)
|
interact(loc)
|
||||||
@@ -223,7 +205,7 @@
|
|||||||
|
|
||||||
// Uncommenting this. To the above comment:
|
// Uncommenting this. To the above comment:
|
||||||
// The permacell radios aren't suppose to be able to transmit, this isn't a bug and this "fix" is just making radio wires useless. -Giacom
|
// The permacell radios aren't suppose to be able to transmit, this isn't a bug and this "fix" is just making radio wires useless. -Giacom
|
||||||
if(!(src.wires & WIRE_TRANSMIT)) // The device has to have all its wires and shit intact
|
if(wires.IsIndexCut(WIRE_TRANSMIT)) // The device has to have all its wires and shit intact
|
||||||
return 0
|
return 0
|
||||||
|
|
||||||
M.last_target_click = world.time
|
M.last_target_click = world.time
|
||||||
@@ -438,7 +420,7 @@
|
|||||||
// what the range is in which mobs will hear the radio
|
// what the range is in which mobs will hear the radio
|
||||||
// returns: -1 if can't receive, range otherwise
|
// returns: -1 if can't receive, range otherwise
|
||||||
|
|
||||||
if (!(wires & WIRE_RECEIVE))
|
if (wires.IsIndexCut(WIRE_RECEIVE))
|
||||||
return -1
|
return -1
|
||||||
if(!listening)
|
if(!listening)
|
||||||
return -1
|
return -1
|
||||||
|
|||||||
Reference in New Issue
Block a user