Fixes a server-crashing issue from woofs (#18172)

* optimizes woof code

prevents server crashes

* static

* maximum

* woof

* moved

* Update softdog.dm
This commit is contained in:
Cameron Lennox
2025-08-07 05:54:06 -04:00
committed by GitHub
parent d407b93147
commit fcc211552a
@@ -265,38 +265,37 @@
M.visible_message("The petting was interrupted!!!", runemessage = "The petting was interrupted")
return
GLOBAL_VAR_INIT(woof_maximum, 0)
GLOBAL_VAR_INIT(woof_current, 0)
/mob/living/simple_mob/vore/woof/hostile/aweful
maxHealth = 100
health = 100
var/killswitch = FALSE
var/static/killswitch = FALSE
/mob/living/simple_mob/vore/woof/hostile/aweful/Initialize(mapload)
. = ..()
var/thismany = (rand(25,500)) / 100
resize(thismany, animate = FALSE, uncapped = TRUE, ignore_prefs = TRUE)
if(!GLOB.woof_current) //all our previous brothers have gone to valhallah
GLOB.woof_maximum = 0 //Let's start duplicating again
GLOB.woof_current++
/mob/living/simple_mob/vore/woof/hostile/aweful/Destroy()
GLOB.woof_current--
. = ..()
/mob/living/simple_mob/vore/woof/hostile/aweful/death()
. = ..()
if(killswitch)
var/thismany = rand(0,3)
if(!thismany || killswitch || GLOB.woof_maximum >= 20)
visible_message(span_notice("\The [src] evaporates into nothing..."))
qdel(src)
return
var/thismany = rand(0,3)
var/list/possiblewoofs = list(/mob/living/simple_mob/vore/woof/hostile/aweful/melee, /mob/living/simple_mob/vore/woof/hostile/aweful/ranged)
if(thismany == 0)
visible_message(span_notice("\The [src] evaporates into nothing..."))
if(thismany >= 1)
var/thiswoof = pick(possiblewoofs)
new thiswoof(loc, src)
visible_message(span_warning("Another [src] appears!"))
if(thismany >= 2)
var/thiswoof = pick(possiblewoofs)
new thiswoof(loc, src)
visible_message(span_warning("Another [src] appears!"))
if(thismany >= 3)
var/thiswoof = pick(possiblewoofs)
new thiswoof(loc, src)
for(var/i = 1 to thismany)
var/mob/living/simple_mob/vore/woof/hostile/aweful/woof = pick(possiblewoofs)
new woof(loc, src)
GLOB.woof_maximum++
visible_message(span_warning("Another [src] appears!"))
qdel(src)