Merge pull request #9050 from Fox-McCloud/weather-subsystem

Converts and Updates Weather Subsystem
This commit is contained in:
tigercat2000
2018-06-13 16:08:02 -07:00
committed by GitHub
51 changed files with 608 additions and 426 deletions
-1
View File
@@ -80,7 +80,6 @@
<A href='?src=[UID()];secretsfun=securitylevel5'>Security Level - Delta</A><BR>
<b>Create Weather</b><BR>
<A href='?src=[UID()];secretsfun=weatherashstorm'>Weather - Ash Storm</A>&nbsp;&nbsp;
<A href='?src=[UID()];secretsfun=weatherdarkness'>Weather - Advanced Darkness</A>&nbsp;&nbsp;
<BR>
</center>"}
+3 -53
View File
@@ -2727,48 +2727,6 @@
for(var/mob/M in player_list)
if(M.stat != 2)
M.show_message(text("<span class='notice'>The chilling wind suddenly stops...</span>"), 1)
/* if("shockwave")
ok = 1
to_chat(world, "<span class='danger'><big>ALERT: STATION STRESS CRITICAL</big></span>")
sleep(60)
to_chat(world, "<span class='danger'><big>ALERT: STATION STRESS CRITICAL. TOLERABLE LEVELS EXCEEDED!</big></span>")
sleep(80)
to_chat(world, "<span class='danger'><big>ALERT: STATION STRUCTURAL STRESS CRITICAL. SAFETY MECHANISMS FAILED!</big></span>")
sleep(40)
for(var/mob/M in world)
shake_camera(M, 400, 1)
for(var/obj/structure/window/W in world)
spawn(0)
sleep(rand(10,400))
W.ex_act(rand(2,1))
for(var/obj/structure/grille/G in world)
spawn(0)
sleep(rand(20,400))
G.ex_act(rand(2,1))
for(var/obj/machinery/door/D in world)
spawn(0)
sleep(rand(20,400))
D.ex_act(rand(2,1))
for(var/turf/station/floor/Floor in world)
spawn(0)
sleep(rand(30,400))
Floor.ex_act(rand(2,1))
for(var/obj/structure/cable/Cable in world)
spawn(0)
sleep(rand(30,400))
Cable.ex_act(rand(2,1))
for(var/obj/structure/closet/Closet in world)
spawn(0)
sleep(rand(30,400))
Closet.ex_act(rand(2,1))
for(var/obj/machinery/Machinery in world)
spawn(0)
sleep(rand(30,400))
Machinery.ex_act(rand(1,3))
for(var/turf/station/wall/Wall in world)
spawn(0)
sleep(rand(30,400))
Wall.ex_act(rand(2,1)) */
if("lightout")
feedback_inc("admin_secrets_fun_used",1)
feedback_add_details("admin_secrets_fun_used","LO")
@@ -2793,7 +2751,7 @@
var/sure = alert(usr, "Are you sure you want to do this?", "Confirmation", "Yes", "No")
if(sure == "No")
return
weather_master.run_weather("the floor is lava")
SSweather.run_weather(/datum/weather/floor_is_lava)
message_admins("[key_name_admin(usr)] made the floor lava")
if("fakelava")
feedback_inc("admin_secrets_fun_used", 1)
@@ -2801,7 +2759,7 @@
var/sure = alert(usr, "Are you sure you want to do this?", "Confirmation", "Yes", "No")
if(sure == "No")
return
weather_master.run_weather("fake lava")
SSweather.run_weather(/datum/weather/floor_is_lava/fake)
message_admins("[key_name_admin(usr)] made aesthetic lava on the floor")
if("weatherashstorm")
feedback_inc("admin_secrets_fun_used", 1)
@@ -2809,16 +2767,8 @@
var/sure = alert(usr, "Are you sure you want to do this?", "Confirmation", "Yes", "No")
if(sure == "No")
return
weather_master.run_weather("ash storm")
SSweather.run_weather(/datum/weather/ash_storm)
message_admins("[key_name_admin(usr)] spawned an ash storm on the mining asteroid")
if("weatherdarkness")
feedback_inc("admin_secrets_fun_used", 1)
feedback_add_details("admin_secrets_fun_used", "WD")
var/sure = alert(usr, "Are you sure you want to do this?", "Confirmation", "Yes", "No")
if(sure == "No")
return
weather_master.run_weather("advanced darkness")
message_admins("[key_name_admin(usr)] made the station go through advanced darkness")
if("retardify")
feedback_inc("admin_secrets_fun_used",1)
feedback_add_details("admin_secrets_fun_used","RET")
+7 -66
View File
@@ -1,70 +1,11 @@
/datum/event/radiation_storm
announceWhen = 1
var/safe_zones = list(
/area/maintenance,
/area/crew_quarters/sleep,
/area/security/brig,
/area/shuttle,
/area/vox_station,
/area/syndicate_station
)
/datum/event/radiation_storm/setup()
startWhen = 3
endWhen = startWhen + 1
announceWhen = 1
/datum/event/radiation_storm/announce()
// Don't do anything, we want to pack the announcement with the actual event
/datum/event/radiation_storm/proc/is_safe_zone(var/area/A)
for(var/szt in safe_zones)
if(istype(A, szt))
return 1
return 0
priority_announcement.Announce("High levels of radiation detected near the station. Maintenance is best shielded from radiation.", "Anomaly Alert", 'sound/ai/radiation.ogg')
//sound not longer matches the text, but an audible warning is probably good
/datum/event/radiation_storm/start()
spawn()
event_announcement.Announce("High levels of radiation detected near the station. Please evacuate into one of the shielded maintenance tunnels.", "Anomaly Alert", new_sound = 'sound/AI/radiation.ogg')
for(var/area/A in world)
if(!is_station_level(A.z) || is_safe_zone(A))
continue
A.radiation_alert()
make_maint_all_access()
sleep(600)
event_announcement.Announce("The station has entered the radiation belt. Please remain in a sheltered area until we have passed the radiation belt.", "Anomaly Alert")
for(var/i = 0, i < 10, i++)
for(var/mob/living/carbon/human/H in living_mob_list)
var/armor = H.getarmor(type = "rad")
if((RADIMMUNE in H.species.species_traits) || armor >= 100) // Leave radiation-immune species/fully rad armored players completely unaffected
continue
var/turf/T = get_turf(H)
if(!T)
continue
if(!is_station_level(T.z) || is_safe_zone(T.loc))
continue
if(istype(H,/mob/living/carbon/human))
H.apply_effect((rand(15,35)),IRRADIATE,0)
if(prob(5))
H.apply_effect((rand(40,70)),IRRADIATE,0)
if(prob(75))
randmutb(H) // Applies bad mutation
domutcheck(H,null,1)
else
randmutg(H) // Applies good mutation
domutcheck(H,null,1)
sleep(100)
event_announcement.Announce("The station has passed the radiation belt. Please report to medbay if you experience any unusual symptoms. Maintenance will lose all access again shortly.", "Anomaly Alert")
for(var/area/A in world)
if(!is_station_level(A.z) || is_safe_zone(A))
continue
A.reset_radiation_alert()
sleep(600) // Want to give them time to get out of maintenance.
revoke_maint_all_access()
SSweather.run_weather(/datum/weather/rad_storm)
@@ -5,7 +5,6 @@
item_state = "staffofstorms"
icon = 'icons/obj/guns/magic.dmi'
slot_flags = SLOT_BACK
item_state = "staffofstorms"
w_class = WEIGHT_CLASS_BULKY
force = 25
damtype = BURN
@@ -19,34 +18,36 @@
return
var/area/user_area = get_area(user)
var/turf/user_turf = get_turf(user)
if(!user_area || !user_turf)
to_chat(user, "<span class='warning'>Something is preventing you from using the staff here.</span>")
return
var/datum/weather/A
var/z_level_name = space_manager.levels_by_name[user.z]
for(var/V in weather_master.existing_weather)
for(var/V in SSweather.processing)
var/datum/weather/W = V
if(W.target_z == z_level_name && W.area_type == user_area.type)
if((user_turf.z in W.impacted_z_levels) && W.area_type == user_area.type)
A = W
break
if(A)
if(A)
if(A.stage != END_STAGE)
if(A.stage == WIND_DOWN_STAGE)
to_chat(user, "<span class='warning'>The storm is already ending! It would be a waste to use the staff now.</span>")
return
user.visible_message("<span class='warning'>[user] holds [src] skywards as an orange beam travels into the sky!</span>", \
"<span class='notice'>You hold [src] skyward, dispelling the storm!</span>")
playsound(user, 'sound/magic/Staff_Change.ogg', 200, 0)
playsound(user, 'sound/magic/staff_change.ogg', 200, 0)
A.wind_down()
return
else
A = new storm_type
A = new storm_type(list(user_turf.z))
A.name = "staff storm"
A.area_type = user_area.type
A.target_z = z_level_name
A.telegraph_duration = 100
A.end_duration = 100
user.visible_message("<span class='warning'>[user] holds [src] skywards as red lightning crackles into the sky!</span>", \
"<span class='notice'>You hold [src] skyward, calling down a terrible storm!</span>")
playsound(user, 'sound/magic/Staff_Change.ogg', 200, 0)
playsound(user, 'sound/magic/staff_change.ogg', 200, 0)
A.telegraph()
storm_cooldown = world.time + 200
+4
View File
@@ -208,3 +208,7 @@
/mob/proc/AdjustWeakened()
return
/mob/proc/adjust_bodytemperature(amount, min_temp = 0, max_temp = INFINITY)
if(bodytemperature > min_temp && bodytemperature < max_temp)
bodytemperature = Clamp(bodytemperature + amount, min_temp, max_temp)
+34 -33
View File
@@ -1,62 +1,63 @@
/proc/is_level_reachable(z)
return check_level_trait(z, REACHABLE)
return check_level_trait(z, REACHABLE)
/proc/is_station_level(z)
return check_level_trait(z, STATION_LEVEL)
return check_level_trait(z, STATION_LEVEL)
/proc/is_station_contact(z)
return check_level_trait(z, STATION_CONTACT)
return check_level_trait(z, STATION_CONTACT)
/proc/is_teleport_allowed(z)
return !check_level_trait(z, BLOCK_TELEPORT)
return !check_level_trait(z, BLOCK_TELEPORT)
/proc/is_admin_level(z)
return check_level_trait(z, ADMIN_LEVEL)
return check_level_trait(z, ADMIN_LEVEL)
/proc/is_away_level(z)
return check_level_trait(z, AWAY_LEVEL)
return check_level_trait(z, AWAY_LEVEL)
/proc/is_mining_level(z)
return check_level_trait(z, ORE_LEVEL)
return check_level_trait(z, ORE_LEVEL)
/proc/is_ai_allowed(z)
return check_level_trait(z, AI_OK)
return check_level_trait(z, AI_OK)
/proc/level_blocks_magic(z)
return check_level_trait(z, IMPEDES_MAGIC)
return check_level_trait(z, IMPEDES_MAGIC)
/proc/level_boosts_signal(z)
return check_level_trait(z, BOOSTS_SIGNAL)
return check_level_trait(z, BOOSTS_SIGNAL)
// Used for the nuke disk, or for checking if players survived through xenos
/proc/is_secure_level(z)
var/secure = check_level_trait(z, STATION_LEVEL)
if(!secure)
// This is to allow further admin levels later, other than centcomm
secure = (z == level_name_to_num(CENTCOMM))
return secure
var/secure = check_level_trait(z, STATION_LEVEL)
if(!secure)
// This is to allow further admin levels later, other than centcomm
secure = (z == level_name_to_num(CENTCOMM))
return secure
var/list/default_map_traits = MAP_TRANSITION_CONFIG
/proc/check_level_trait(z, trait)
if(!z)
return 0 // If you're nowhere, you have no traits
var/list/trait_list
if(space_manager.initialized)
var/datum/space_level/S = space_manager.get_zlev(z)
trait_list = S.flags
else
trait_list = default_map_traits[z]
trait_list = trait_list["attributes"]
return (trait in trait_list)
if(!z)
return 0 // If you're nowhere, you have no traits
var/list/trait_list
if(space_manager.initialized)
var/datum/space_level/S = space_manager.get_zlev(z)
trait_list = S.flags
else
trait_list = default_map_traits[z]
trait_list = trait_list["attributes"]
return (trait in trait_list)
/proc/levels_by_trait(trait)
var/list/result = list()
for(var/A in space_manager.z_list)
var/datum/space_level/S = space_manager.z_list[A]
if(trait in S.flags)
result |= S
return result
var/list/result = list()
for(var/A in space_manager.z_list)
var/datum/space_level/S = space_manager.z_list[A]
if(trait in S.flags)
result |= S.zpos
return result
/proc/level_name_to_num(name)
var/datum/space_level/S = space_manager.get_zlev_by_name(name)
return S.zpos
var/datum/space_level/S = space_manager.get_zlev_by_name(name)
return S.zpos
@@ -12,6 +12,8 @@ var/global/datum/zlev_manager/space_manager = new
var/datum/spacewalk_grid/linkage_map
var/initialized = 0
var/list/areas_in_z = list()
// Populate our space level list
// and prepare space transitions
/datum/zlev_manager/proc/initialize()
@@ -166,4 +168,4 @@ var/global/datum/zlev_manager/space_manager = new
var/datum/space_level/heap/heap = z_list["[C.zpos]"]
if(!istype(heap))
throw EXCEPTION("Attempted to free chunk at invalid z-level ([C.x],[C.y],[C.zpos]) [C.width]x[C.height]")
heap.free(C)
heap.free(C)