Ports /tg/ spatial grid system, refactors telecomms, destroys lag (#15140)

This commit is contained in:
Wildkins
2022-12-09 12:35:33 +01:00
committed by GitHub
parent d3f8f12fea
commit 2fcfa8adb7
158 changed files with 4068 additions and 3263 deletions
+2
View File
@@ -4,6 +4,8 @@
var/tmp/isprocessing = 0
var/tmp/gcDestroyed //Time when this object was destroyed.
/// Status traits attached to this datum. associative list of the form: list(trait name (string) = list(source1, source2, source3,...))
var/list/status_traits
/// Components attached to this datum
/// Lazy associated list in the structure of `type:component/list of components`
var/list/datum_components
+3 -3
View File
@@ -53,8 +53,8 @@
if(T.z != AB.z || get_dist(adestination, AB) > 8 || (AB.stat & (NOPOWER | BROKEN)))
continue
AB.use_power_oneoff(AB.active_power_usage)
bad_turfs += circlerangeturfs(get_turf(AB),8)
good_turfs += circlerangeturfs(get_turf(AB),9)
bad_turfs += circle_range_turfs(get_turf(AB),8)
good_turfs += circle_range_turfs(get_turf(AB),9)
if(length(good_turfs) && length(bad_turfs))
good_turfs -= bad_turfs
if(length(good_turfs))
@@ -138,7 +138,7 @@
var/turf/curturf = get_turf(teleatom)
var/area/destarea = get_area(destination)
if(precision)
var/list/posturfs = circlerangeturfs(destination,precision)
var/list/posturfs = circle_range_turfs(destination,precision)
destturf = LAZYPICK(posturfs, null)
else
destturf = get_turf(destination)
+1 -1
View File
@@ -42,7 +42,7 @@
if (!devices_line)
devices_line = new
devices[filter] = devices_line
devices_line+=device
devices_line |= device
// var/list/obj/devices_line___ = devices[filter_str]
// var/l = devices_line___.len
//log_debug("DEBUG: devices_line.len=[devices_line.len]")
-58
View File
@@ -30,61 +30,3 @@
/datum/signal/Destroy()
..()
return QDEL_HINT_IWILLGC
/datum/signal/proc/tcombroadcast(var/message, var/freq, var/source, var/job, var/verb, var/language)
var/datum/signal/newsign = new
var/obj/machinery/telecomms/server/S = data["server"]
var/obj/item/device/radio/hradio = S.server_radio
if(!hradio)
error("[src] has no radio.")
return
if((!message || message == "") && message != 0)
message = "*beep*"
if(!source)
source = "[html_encode(uppertext(S.id))]"
hradio = new // sets the hradio as a radio intercom
if(!freq)
freq = PUB_FREQ
if(findtext(num2text(freq), ".")) // if the frequency has been set as a decimal
freq *= 10 // shift the decimal one place
if(!job)
job = "?"
if(!language || language == "")
language = LANGUAGE_TCB
var/datum/language/L = all_languages[language]
if(!L || !(L.flags & TCOMSSIM))
L = all_languages[LANGUAGE_TCB]
newsign.data["mob"] = null
newsign.data["mobtype"] = /mob/living/carbon/human
newsign.data["name"] = source
newsign.data["realname"] = newsign.data["name"]
newsign.data["job"] = job
newsign.data["compression"] = 0
newsign.data["message"] = message
newsign.data["language"] = L
newsign.data["type"] = 2 // artificial broadcast
if(!isnum(freq))
freq = text2num(freq)
newsign.frequency = freq
var/datum/radio_frequency/connection = SSradio.return_frequency(freq)
newsign.data["connection"] = connection
newsign.data["radio"] = hradio
newsign.data["vmessage"] = message
newsign.data["vname"] = source
newsign.data["vmask"] = 0
newsign.data["level"] = list()
newsign.data["verb"] = verb
var/pass = S.relay_information(newsign, "/obj/machinery/telecomms/hub")
if(!pass)
S.relay_information(newsign, "/obj/machinery/telecomms/broadcaster") // send this simple message to broadcasters
+8 -8
View File
@@ -16,26 +16,26 @@ var/const/WIRE_TRANSMIT = 4
var/obj/item/device/radio/R = holder
switch(index)
if(WIRE_SIGNAL)
R.listening = !R.listening && !IsIndexCut(WIRE_RECEIVE)
R.broadcasting = R.listening && !IsIndexCut(WIRE_TRANSMIT)
R.set_listening(!R.get_listening() && !IsIndexCut(WIRE_RECEIVE))
R.set_broadcasting(R.get_listening() && !IsIndexCut(WIRE_TRANSMIT))
if(WIRE_RECEIVE)
R.listening = !R.listening && !IsIndexCut(WIRE_SIGNAL)
R.set_listening(!R.get_listening() && !IsIndexCut(WIRE_SIGNAL))
if(WIRE_TRANSMIT)
R.broadcasting = !R.broadcasting && !IsIndexCut(WIRE_SIGNAL)
R.set_broadcasting(!R.get_broadcasting() && !IsIndexCut(WIRE_SIGNAL))
SSnanoui.update_uis(holder)
/datum/wires/radio/UpdateCut(var/index, var/mended)
var/obj/item/device/radio/R = holder
switch(index)
if(WIRE_SIGNAL)
R.listening = mended && !IsIndexCut(WIRE_RECEIVE)
R.broadcasting = mended && !IsIndexCut(WIRE_TRANSMIT)
R.set_listening(mended && !IsIndexCut(WIRE_RECEIVE))
R.set_broadcasting(mended && !IsIndexCut(WIRE_TRANSMIT))
if(WIRE_RECEIVE)
R.listening = mended && !IsIndexCut(WIRE_SIGNAL)
R.set_listening(mended && !IsIndexCut(WIRE_SIGNAL))
if(WIRE_TRANSMIT)
R.broadcasting = mended && !IsIndexCut(WIRE_SIGNAL)
R.set_broadcasting(mended && !IsIndexCut(WIRE_SIGNAL))
SSnanoui.update_uis(holder)