mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-20 19:43:13 +01:00
Lag War 2: Revengeance (#21950)
<img width="750" height="449" alt="image" src="https://github.com/user-attachments/assets/29c06609-eb62-42be-9b9c-334f9fe88636" /> Ports: tgstation/tgstation#75769, tgstation/tgstation#72572, tgstation/tgstation#93054 Fixes the holodeck causing 800 trillion hard dels that brings the server to its knees. Stops turrets, weather system, and overmap contacts from generating 500+ timers every tick by just using vars instead. --------- Signed-off-by: Wildkins <john.wildkins@gmail.com>
This commit is contained in:
@@ -315,6 +315,8 @@ GLOBAL_LIST_EMPTY_TYPED(holodeck_controls, /obj/machinery/computer/holodeck_cont
|
||||
active = 1
|
||||
update_use_power(POWER_USE_ACTIVE)
|
||||
|
||||
QDEL_LIST(holodeck_landmarks)
|
||||
|
||||
for(var/item in holographic_objs)
|
||||
derez(item)
|
||||
|
||||
|
||||
@@ -220,7 +220,8 @@
|
||||
// Handle physical effects of weather.
|
||||
var/singleton/state/weather/weather_state
|
||||
var/obj/abstract/weather_system/weather = get_affecting_weather()
|
||||
if(weather)
|
||||
if(weather_cooldown_time <= world.time && weather)
|
||||
weather_cooldown_time = world.time + WEATHER_COOLDOWN_TIME
|
||||
weather_state = weather.weather_system.current_state
|
||||
if(istype(weather_state))
|
||||
weather_state.handle_exposure(src, get_weather_exposure(weather), weather)
|
||||
|
||||
@@ -103,3 +103,6 @@
|
||||
|
||||
/// If true, ignores weather effects
|
||||
var/resists_weather = FALSE
|
||||
|
||||
/// Time since last weather effect
|
||||
var/weather_cooldown_time = 0
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
var/name = "Unknown" // Contact name.
|
||||
var/image/marker // Image overlay attached to the contact.
|
||||
var/pinged = FALSE // Used to animate overmap effects.
|
||||
var/pinged_until = 0 // Used to animate overmap effects.
|
||||
var/list/images = list() // Our list of images to cast to users.
|
||||
var/image/radar // Radar image for sonar esque effect
|
||||
|
||||
@@ -70,18 +70,15 @@
|
||||
M.client.images |= images
|
||||
|
||||
|
||||
/datum/overmap_contact/proc/ping()
|
||||
if(pinged)
|
||||
/datum/overmap_contact/proc/ping(time_delay = 0)
|
||||
if(pinged_until > world.time)
|
||||
return
|
||||
pinged = TRUE
|
||||
pinged_until = world.time + time_delay + 1 SECOND
|
||||
effect.opacity = initial(effect.opacity)
|
||||
show()
|
||||
animate(marker, alpha=255, 0.5 SECOND, 1, LINEAR_EASING)
|
||||
addtimer(CALLBACK(src, PROC_REF(unping)), 1 SECOND)
|
||||
|
||||
/datum/overmap_contact/proc/unping()
|
||||
animate(marker, alpha=75, 2 SECOND, 1, LINEAR_EASING)
|
||||
pinged = FALSE
|
||||
animate(marker, alpha=75, time_delay, 1, flags = ANIMATION_END_NOW)
|
||||
animate(alpha=255, 1 SECOND, 1)
|
||||
animate(alpha=75, 2 SECOND, 1)
|
||||
|
||||
/datum/overmap_contact/Destroy()
|
||||
if(owner)
|
||||
|
||||
@@ -139,10 +139,9 @@
|
||||
continue
|
||||
// Update identification information for this record.
|
||||
record.update_marker_icon()
|
||||
|
||||
var/time_delay = max((SENSOR_TIME_DELAY * get_dist(linked, contact)),1)
|
||||
if(!record.pinged)
|
||||
addtimer(CALLBACK(record, PROC_REF(ping)), time_delay)
|
||||
if(record.pinged_until <= world.time)
|
||||
var/time_delay = max((SENSOR_TIME_DELAY * get_dist(linked, contact)), 1 SECOND)
|
||||
record.ping(time_delay)
|
||||
|
||||
/**
|
||||
* Adds an overmap object to the known contacts.
|
||||
|
||||
@@ -70,7 +70,7 @@ ABSTRACT_TYPE(/singleton/state/weather)
|
||||
if(!weather.show_weather(M))
|
||||
weather.show_wind(M)
|
||||
|
||||
if(exposure != WEATHER_IGNORE && weather.set_cooldown(M))
|
||||
if(exposure != WEATHER_IGNORE)
|
||||
if(exposure == WEATHER_EXPOSED)
|
||||
handle_exposure_effects(M, weather)
|
||||
else if(exposure == WEATHER_ROOFED)
|
||||
|
||||
@@ -1,23 +1,9 @@
|
||||
|
||||
GLOBAL_LIST_EMPTY(current_mob_ambience)
|
||||
/obj/abstract/weather_system
|
||||
|
||||
// Weakref lists used to track mobs within our weather
|
||||
// system; alternative to keeping big lists of actual mobs or
|
||||
// having mobs constantly poked by weather systems.
|
||||
|
||||
var/tmp/list/mobs_on_cooldown = list() // Has this mob recently been messed with by the weather?
|
||||
var/tmp/list/mob_shown_weather = list() // Has this mob been sent the summary message about the current weather?
|
||||
var/tmp/list/mob_shown_wind = list() // Has this mob been sent the summary message about the current wind?
|
||||
|
||||
// 'cooldown' in this context refers to weather effects like hail damage or being shown cosmetic messages.
|
||||
/obj/abstract/weather_system/proc/set_cooldown(var/mob/living/M, var/delay = 5 SECONDS)
|
||||
var/mobref = WEAKREF(M)
|
||||
if(!(mobref in mobs_on_cooldown))
|
||||
mobs_on_cooldown[mobref] = TRUE
|
||||
addtimer(CALLBACK(src, PROC_REF(clear_cooldown), mobref), delay)
|
||||
return TRUE
|
||||
return FALSE
|
||||
|
||||
/obj/abstract/weather_system/proc/clear_cooldown(var/mobref)
|
||||
mobs_on_cooldown -= mobref
|
||||
|
||||
Reference in New Issue
Block a user