Merge pull request #6756 from Neerti/lightning_fixes

Fixes various lightning strike bugs
This commit is contained in:
Atermonera
2020-02-27 20:57:41 -08:00
committed by VirgoBot
parent 790130edd9
commit 1d4d3afd45
6 changed files with 34 additions and 27 deletions

View File

@@ -638,13 +638,14 @@
return
var/datum/planet/planet = input(usr, "Which planet do you want to modify the weather on?", "Change Weather") in SSplanets.planets
var/datum/weather/new_weather = input(usr, "What weather do you want to change to?", "Change Weather") as null|anything in planet.weather_holder.allowed_weather_types
if(new_weather)
planet.weather_holder.change_weather(new_weather)
planet.weather_holder.rebuild_forecast()
var/log = "[key_name(src)] changed [planet.name]'s weather to [new_weather]."
message_admins(log)
log_admin(log)
if(istype(planet))
var/datum/weather/new_weather = input(usr, "What weather do you want to change to?", "Change Weather") as null|anything in planet.weather_holder.allowed_weather_types
if(new_weather)
planet.weather_holder.change_weather(new_weather)
planet.weather_holder.rebuild_forecast()
var/log = "[key_name(src)] changed [planet.name]'s weather to [new_weather]."
message_admins(log)
log_admin(log)
/datum/admins/proc/change_time()
set category = "Debug"
@@ -655,20 +656,20 @@
return
var/datum/planet/planet = input(usr, "Which planet do you want to modify time on?", "Change Time") in SSplanets.planets
if(istype(planet))
var/datum/time/current_time_datum = planet.current_time
var/new_hour = input(usr, "What hour do you want to change to?", "Change Time", text2num(current_time_datum.show_time("hh"))) as null|num
if(!isnull(new_hour))
var/new_minute = input(usr, "What minute do you want to change to?", "Change Time", text2num(current_time_datum.show_time("mm")) ) as null|num
if(!isnull(new_minute))
var/type_needed = current_time_datum.type
var/datum/time/new_time = new type_needed()
new_time = new_time.add_hours(new_hour)
new_time = new_time.add_minutes(new_minute)
planet.current_time = new_time
spawn(1)
planet.update_sun()
var/datum/time/current_time_datum = planet.current_time
var/new_hour = input(usr, "What hour do you want to change to?", "Change Time", text2num(current_time_datum.show_time("hh"))) as null|num
if(!isnull(new_hour))
var/new_minute = input(usr, "What minute do you want to change to?", "Change Time", text2num(current_time_datum.show_time("mm")) ) as null|num
if(!isnull(new_minute))
var/type_needed = current_time_datum.type
var/datum/time/new_time = new type_needed()
new_time = new_time.add_hours(new_hour)
new_time = new_time.add_minutes(new_minute)
planet.current_time = new_time
spawn(1)
planet.update_sun()
var/log = "[key_name(src)] changed [planet.name]'s time to [planet.current_time.show_time("hh:mm")]."
message_admins(log)
log_admin(log)
var/log = "[key_name(src)] changed [planet.name]'s time to [planet.current_time.show_time("hh:mm")]."
message_admins(log)
log_admin(log)

View File

@@ -1,6 +1,6 @@
/client/proc/admin_lightning_strike()
set name = "Lightning Strike"
set desc = "Causes lightning to strike on your tile. This will hurt things on or nearby it severely."
set desc = "Causes lightning to strike on your tile. This can be made to hurt things on or nearby it severely."
set category = "Fun"
if(!check_rights(R_FUN))
@@ -28,7 +28,7 @@
// Do a lightning flash for the whole planet, if the turf belongs to a planet.
var/datum/planet/P = null
P = SSplanets.z_to_planet[T.z]
P = LAZYACCESS(SSplanets.z_to_planet, T.z)
if(P)
var/datum/weather_holder/holder = P.weather_holder
flick("lightning_flash", holder.special_visuals)
@@ -64,7 +64,7 @@
// Otherwise only those on the current z-level will hear it.
var/sound = get_sfx("thunder")
for(var/mob/M in player_list)
if((P && M.z in P.expected_z_levels) || M.z == T.z)
if( (P && (M.z in P.expected_z_levels)) || M.z == T.z)
if(M.is_preference_enabled(/datum/client_preference/weather_sounds))
M.playsound_local(get_turf(M), soundin = sound, vol = 70, vary = FALSE, is_global = TRUE)