yumyum radio go vroom hehe

This commit is contained in:
cadyn
2020-11-24 22:45:41 -08:00
parent 8231cf5f55
commit d260757e91
3 changed files with 31 additions and 2 deletions

View File

@@ -239,7 +239,7 @@ var/mobs_radio_range_fired = 1 //CHOMPEdit
T.temp_check[our_iter] = TRUE //CHOMPEdit T.temp_check[our_iter] = TRUE //CHOMPEdit
speaker_coverage[T] = R speaker_coverage[T] = R
CHECK_TICK //CHOMPEdit
// Try to find all the players who can hear the message // Try to find all the players who can hear the message
//CHOMPEdit Begin //CHOMPEdit Begin
//So, to explain a bit here: The old code that used to be here was pretty slow for a few reasons, most of which have been addressed now. //So, to explain a bit here: The old code that used to be here was pretty slow for a few reasons, most of which have been addressed now.
@@ -251,6 +251,7 @@ var/mobs_radio_range_fired = 1 //CHOMPEdit
var/turf/T = get_turf(M) var/turf/T = get_turf(M)
if(istype(T) && T.temp_check[our_iter]) if(istype(T) && T.temp_check[our_iter])
. += M . += M
CHECK_TICK
for(var/turf/T in speaker_coverage) for(var/turf/T in speaker_coverage)
T.temp_check -= our_iter //Freeing up the memory. T.temp_check -= our_iter //Freeing up the memory.
//CHOMPEdit End //CHOMPEdit End

View File

@@ -121,7 +121,6 @@ SUBSYSTEM_DEF(machines)
while(current_run.len) while(current_run.len)
var/obj/machinery/M = current_run[current_run.len] var/obj/machinery/M = current_run[current_run.len]
current_run.len-- current_run.len--
var/q = QDELETED(M) //CHOMPStation edit
if(!istype(M) || QDELETED(M) || (M.process(wait) == PROCESS_KILL)) if(!istype(M) || QDELETED(M) || (M.process(wait) == PROCESS_KILL))
global.processing_machines.Remove(M) global.processing_machines.Remove(M)
if(!QDELETED(M)) if(!QDELETED(M))

View File

@@ -15,4 +15,33 @@
output += cand_turf output += cand_turf
continue continue
return output return output
/obj/item/device/radio/intercom
var/list/broadcast_tiles
/obj/item/device/radio/intercom/proc/update_broadcast_tiles()
var/list/output = list()
var/turf/T = get_turf(src)
if(!T)
return
var/dnumber = canhear_range*CANBROADCAST_INNERBOX
for(var/cand_x = max(0, T.x - canhear_range), cand_x <= T.x + canhear_range, cand_x++)
for(var/cand_y = max(0, T.y - canhear_range), cand_y <= T.y + canhear_range, cand_y++)
var/turf/cand_turf = locate(cand_x,cand_y,T.z)
if(!cand_turf)
continue
if((abs(T.x - cand_x) < dnumber) || (abs(T.y - cand_y) < dnumber))
output += cand_turf
continue
if(sqrt((T.x - cand_x)**2 + (T.y - cand_y)**2) <= canhear_range)
output += cand_turf
continue
broadcast_tiles = output
/obj/item/device/radio/intercom/Initialize()
update_broadcast_tiles()
/obj/item/device/radio/intercom/can_broadcast_to()
if(!broadcast_tiles)
update_broadcast_tiles()
return broadcast_tiles
#undef CANBROADCAST_INNERBOX #undef CANBROADCAST_INNERBOX