Files
Bubberstation/code/game/objects/items/devices/PDA/radio.dm
Cyberboss 5959ac32cc Refactors atom/Initialize. Fixes ruins being initialized twice (#22778)
* Refactors atom/Initialize

Captialized for compiling correctness and to be more inline with Destroy

Will now be called from atom/New if the world initialization loop in SSobj has already run. Should always call the base.

Now comes with the `roundstart` parameter indicating whether or not it was called by SSobj or atom/New

Other fixes/tweaks:
- Renamed a proc called Initialize in abduction consoles to Setup
- Removed /obj/item/device/radio/headset/headset_sec/department: Broken and referenced literally nowhere in the code
- Removed a spawn from the Initialize of turbine_computer which made literally zero sense
- Generalized the proc which fixes RND servers with no id set

Reasoning: It's better to check roundstart per function than to have to duplicate code in New and Initialize. Think of it as a safer New for atoms. If we move enough stuff to it, initial map load performance will increase due to less New calls

* Fixed a thing

* Actually, fuck the police

* >Expecting a merge without errors

* >Not calling ..() in New

* Sanic

* Fix the headset bug

* Makes sure the map loaders dew it right

* Fixes ruins being initialized twice

* Rename roundstart -> mapload

* Revert "Rename roundstart -> mapload"

This reverts commit 667c327fd2ccfa3ce4f4db52eac03f9e8b0f6812.

* Remove unrelated change

* A more direct solution to map loads

* And now we shouldnt need this warning

* Add the new var to SSobj recovery

* Revert "Revert "Rename roundstart -> mapload""

This reverts commit dee07dbd5e4696554ac43aae5b91cce743b9b9e0.

* Line endings
2017-01-23 09:37:45 +01:00

66 lines
1.7 KiB
Plaintext

/obj/item/radio/integrated
name = "\improper PDA radio module"
desc = "An electronic radio system of nanotrasen origin."
icon = 'icons/obj/module.dmi'
icon_state = "power_mod"
var/obj/item/device/pda/hostpda = null
var/on = 0 //Are we currently active??
var/menu_message = ""
/obj/item/radio/integrated/New()
..()
if (istype(loc.loc, /obj/item/device/pda))
hostpda = loc.loc
/obj/item/radio/integrated/Destroy()
hostpda = null
return ..()
/*
* Radio Cartridge, essentially a signaler.
*/
/obj/item/radio/integrated/signal
var/frequency = 1457
var/code = 30
var/last_transmission
var/datum/radio_frequency/radio_connection
/obj/item/radio/integrated/signal/Destroy()
if(SSradio)
SSradio.remove_object(src, frequency)
radio_connection = null
return ..()
/obj/item/radio/integrated/signal/Initialize()
..()
if (src.frequency < 1200 || src.frequency > 1600)
src.frequency = sanitize_frequency(src.frequency)
set_frequency(frequency)
/obj/item/radio/integrated/signal/proc/set_frequency(new_frequency)
SSradio.remove_object(src, frequency)
frequency = new_frequency
radio_connection = SSradio.add_object(src, frequency)
/obj/item/radio/integrated/signal/proc/send_signal(message="ACTIVATE")
if(last_transmission && world.time < (last_transmission + 5))
return
last_transmission = world.time
var/time = time2text(world.realtime,"hh:mm:ss")
var/turf/T = get_turf(src)
lastsignalers.Add("[time] <B>:</B> [usr.key] used [src] @ location ([T.x],[T.y],[T.z]) <B>:</B> [format_frequency(frequency)]/[code]")
var/datum/signal/signal = new
signal.source = src
signal.encryption = code
signal.data["message"] = message
radio_connection.post_signal(src, signal)
return