Skip to content

Commit

Permalink
Mimites, final fixes(hopefully) - Requested by EvilDragon (#11207)
Browse files Browse the repository at this point in the history
* Lazyadd/LazyRemove fixes, stuck threshold define, Destroy()

* adds Undefine

* swaps length for lazylen

* reverts lazyadd/remove and lazylen
  • Loading branch information
ro5490 authored Jul 18, 2024
1 parent 1fe4ef7 commit b8967ed
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
2 changes: 1 addition & 1 deletion code/modules/events/mimite_infestation.dm
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@


/datum/round_event/mimite_infestation/end()
if(LAZYLEN(GLOB.all_mimites) >= 1) //If they're still around at the end of 60 min, turn of replication permanently
if(length(GLOB.all_mimites)) //If they're still around at the end of 60 min, turn of replication permanently
for(var/mob/living/simple_animal/hostile/mimite/M in GLOB.all_mimites)
M.eventongoing = FALSE
else
Expand Down
14 changes: 11 additions & 3 deletions code/modules/mob/living/simple_animal/hostile/mimite.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#define MIMITE_COOLDOWN 60
#define MIMITE_VENT_COOLDOWN 100
#define MIMITE_STUCK_THRESHOLD 10

/mob/living/simple_animal/hostile/mimite
name = "Mimite"
Expand Down Expand Up @@ -68,7 +69,6 @@
var/venthunt = TRUE
var/mimite_lastmove = null //Updates/Stores position of the mimite while it's moving
var/mimite_stuck = 0 //If mimite_lastmove hasn't changed, this will increment until it reaches mimite_stuck_threshold
var/mimite_stuck_threshold = 10 //if this == mimite_stuck, it'll force the mimite to stop moving
var/attemptingventcrawl = FALSE
var/eventongoing = TRUE
var/remaining_replications = 4
Expand Down Expand Up @@ -293,7 +293,7 @@
//Check to see if the mimite is stuck due to things like windows or doors or windowdoors
if(mimite_lastmove)
if(mimite_lastmove == src.loc)
if(mimite_stuck_threshold >= ++mimite_stuck)
if(MIMITE_STUCK_THRESHOLD >= ++mimite_stuck)
mimite_stuck = 0
mimite_lastmove = null
return 1
Expand All @@ -304,10 +304,13 @@
return 0

/mob/living/simple_animal/hostile/mimite/death(gibbed)
GLOB.all_mimites -= src
new /obj/effect/decal/cleanable/oil(get_turf(src))
..()

/mob/living/simple_animal/hostile/mimite/Destroy()
GLOB.all_mimites -= src
..()

/mob/living/simple_animal/hostile/mimite/crate
name = "crate"
desc = "A rectangular steel crate."
Expand Down Expand Up @@ -375,3 +378,8 @@
minimum_distance = 1
melee_queue_distance = 1
projectiletype = /obj/projectile/beam/disabler


#undef MIMITE_COOLDOWN
#undef MIMITE_VENT_COOLDOWN
#undef MIMITE_STUCK_THRESHOLD

0 comments on commit b8967ed

Please sign in to comment.