Files
Bubberstation/code/game/machinery/embedded_controller/embedded_controller_base.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

95 lines
2.8 KiB
Plaintext

/datum/computer/file/embedded_program
var/list/memory = list()
var/state
var/obj/machinery/embedded_controller/master
/datum/computer/file/embedded_program/proc/post_signal(datum/signal/signal, comm_line)
if(master)
master.post_signal(signal, comm_line)
else
qdel(signal)
/datum/computer/file/embedded_program/proc/receive_user_command(command)
/datum/computer/file/embedded_program/proc/receive_signal(datum/signal/signal, receive_method, receive_param)
return null
/datum/computer/file/embedded_program/process()
return 0
/obj/machinery/embedded_controller
var/datum/computer/file/embedded_program/program
name = "embedded controller"
density = 0
anchored = 1
var/on = 1
/obj/machinery/embedded_controller/interact(mob/user)
user.set_machine(src)
var/datum/browser/popup = new(user, "computer", name) // Set up the popup browser window
popup.set_title_image(user.browse_rsc_icon(src.icon, src.icon_state))
popup.set_content(return_text())
popup.open()
/obj/machinery/embedded_controller/attack_hand(mob/user)
interact(user)
/obj/machinery/embedded_controller/update_icon()
/obj/machinery/embedded_controller/proc/return_text()
/obj/machinery/embedded_controller/proc/post_signal(datum/signal/signal, comm_line)
return 0
/obj/machinery/embedded_controller/receive_signal(datum/signal/signal, receive_method, receive_param)
if(!signal || signal.encryption) return
if(program)
program.receive_signal(signal, receive_method, receive_param)
//spawn(5) program.process() //no, program.process sends some signals and machines respond and we here again and we lag -rastaf0
/obj/machinery/embedded_controller/Topic(href, href_list)
if(..())
return 0
if(program)
program.receive_user_command(href_list["command"])
addtimer(CALLBACK(program, /datum/computer/file/embedded_program.proc/process), 5)
usr.set_machine(src)
addtimer(CALLBACK(src, .proc/updateDialog), 5)
/obj/machinery/embedded_controller/process()
if(program)
program.process()
update_icon()
src.updateDialog()
/obj/machinery/embedded_controller/radio
var/frequency
var/datum/radio_frequency/radio_connection
/obj/machinery/embedded_controller/radio/Destroy()
if(SSradio)
SSradio.remove_object(src,frequency)
return ..()
/obj/machinery/embedded_controller/radio/Initialize()
..()
set_frequency(frequency)
/obj/machinery/embedded_controller/radio/post_signal(datum/signal/signal)
signal.transmission_method = TRANSMISSION_RADIO
if(radio_connection)
return radio_connection.post_signal(src, signal)
else
signal = null
/obj/machinery/embedded_controller/radio/proc/set_frequency(new_frequency)
SSradio.remove_object(src, frequency)
frequency = new_frequency
radio_connection = SSradio.add_object(src, frequency)