Fixes portal storm event (#34725)
This commit is contained in:
committed by
CitadelStationBot
parent
5e1ff26276
commit
dfdf01e79e
@@ -1199,6 +1199,9 @@ B --><-- A
|
|||||||
sleep(duration)
|
sleep(duration)
|
||||||
A.cut_overlay(O)
|
A.cut_overlay(O)
|
||||||
|
|
||||||
|
/proc/get_random_station_turf()
|
||||||
|
return safepick(get_area_turfs(pick(GLOB.the_station_areas)))
|
||||||
|
|
||||||
/proc/get_closest_atom(type, list, source)
|
/proc/get_closest_atom(type, list, source)
|
||||||
var/closest_atom
|
var/closest_atom
|
||||||
var/closest_distance
|
var/closest_distance
|
||||||
|
|||||||
@@ -33,17 +33,12 @@
|
|||||||
var/list/hostiles_spawn = list()
|
var/list/hostiles_spawn = list()
|
||||||
var/list/hostile_types = list()
|
var/list/hostile_types = list()
|
||||||
var/number_of_hostiles
|
var/number_of_hostiles
|
||||||
var/list/station_areas
|
|
||||||
var/mutable_appearance/storm
|
var/mutable_appearance/storm
|
||||||
|
|
||||||
/datum/round_event/portal_storm/setup()
|
/datum/round_event/portal_storm/setup()
|
||||||
storm = mutable_appearance('icons/obj/tesla_engine/energy_ball.dmi', "energy_ball_fast", FLY_LAYER)
|
storm = mutable_appearance('icons/obj/tesla_engine/energy_ball.dmi', "energy_ball_fast", FLY_LAYER)
|
||||||
storm.color = "#00FF00"
|
storm.color = "#00FF00"
|
||||||
|
|
||||||
station_areas = list()
|
|
||||||
for (var/z in SSmapping.levels_by_trait(ZTRAIT_STATION))
|
|
||||||
station_areas |= SSmapping.areas_in_z["[z]"]
|
|
||||||
|
|
||||||
number_of_bosses = 0
|
number_of_bosses = 0
|
||||||
for(var/boss in boss_types)
|
for(var/boss in boss_types)
|
||||||
number_of_bosses += boss_types[boss]
|
number_of_bosses += boss_types[boss]
|
||||||
@@ -52,19 +47,11 @@
|
|||||||
for(var/hostile in hostile_types)
|
for(var/hostile in hostile_types)
|
||||||
number_of_hostiles += hostile_types[hostile]
|
number_of_hostiles += hostile_types[hostile]
|
||||||
|
|
||||||
var/list/b_spawns = GLOB.generic_event_spawns.Copy()
|
|
||||||
while(number_of_bosses > boss_spawn.len)
|
while(number_of_bosses > boss_spawn.len)
|
||||||
var/turf/F = get_turf(pick_n_take(b_spawns))
|
boss_spawn += get_random_station_turf()
|
||||||
if(!F)
|
|
||||||
F = safepick(get_area_turfs(pick(station_areas)))
|
|
||||||
boss_spawn += F
|
|
||||||
|
|
||||||
var/list/h_spawns = GLOB.generic_event_spawns.Copy()
|
|
||||||
while(number_of_hostiles > hostiles_spawn.len)
|
while(number_of_hostiles > hostiles_spawn.len)
|
||||||
var/turf/T = get_turf(pick_n_take(h_spawns))
|
hostiles_spawn += get_random_station_turf()
|
||||||
if(!T)
|
|
||||||
T = safepick(get_area_turfs(pick(station_areas)))
|
|
||||||
hostiles_spawn += T
|
|
||||||
|
|
||||||
next_boss_spawn = startWhen + CEILING(2 * number_of_hostiles / number_of_bosses, 1)
|
next_boss_spawn = startWhen + CEILING(2 * number_of_hostiles / number_of_bosses, 1)
|
||||||
|
|
||||||
@@ -77,7 +64,7 @@
|
|||||||
sound_to_playing_players('sound/magic/lightningbolt.ogg')
|
sound_to_playing_players('sound/magic/lightningbolt.ogg')
|
||||||
|
|
||||||
/datum/round_event/portal_storm/tick()
|
/datum/round_event/portal_storm/tick()
|
||||||
spawn_effects()
|
spawn_effects(get_random_station_turf())
|
||||||
|
|
||||||
if(spawn_hostile())
|
if(spawn_hostile())
|
||||||
var/type = safepick(hostile_types)
|
var/type = safepick(hostile_types)
|
||||||
@@ -105,16 +92,12 @@
|
|||||||
spawn_effects(T)
|
spawn_effects(T)
|
||||||
|
|
||||||
/datum/round_event/portal_storm/proc/spawn_effects(turf/T)
|
/datum/round_event/portal_storm/proc/spawn_effects(turf/T)
|
||||||
if(T)
|
if(!T)
|
||||||
T = get_step(T, SOUTHWEST) //align center of image with turf
|
log_game("Portal Storm failed to spawn effect due to an invalid location.")
|
||||||
flick_overlay_static(storm, T, 15)
|
return
|
||||||
playsound(T, 'sound/magic/lightningbolt.ogg', 100, 1)
|
T = get_step(T, SOUTHWEST) //align center of image with turf
|
||||||
else
|
flick_overlay_static(storm, T, 15)
|
||||||
for(var/V in station_areas)
|
playsound(T, 'sound/magic/lightningbolt.ogg', rand(80, 100), 1)
|
||||||
var/area/A = V
|
|
||||||
var/turf/F = get_turf(pick(A.contents))
|
|
||||||
flick_overlay_static(storm, F, 15)
|
|
||||||
playsound(F, 'sound/magic/lightningbolt.ogg', 80, 1)
|
|
||||||
|
|
||||||
/datum/round_event/portal_storm/proc/spawn_hostile()
|
/datum/round_event/portal_storm/proc/spawn_hostile()
|
||||||
if(!hostile_types || !hostile_types.len)
|
if(!hostile_types || !hostile_types.len)
|
||||||
|
|||||||
Reference in New Issue
Block a user