mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
Merge pull request #6884 from Neerti/event_system_fix
Rewrites the Rewritten Event System
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
var/list/blobs = list()
|
||||
GLOBAL_LIST_EMPTY(all_blobs)
|
||||
|
||||
/obj/structure/blob
|
||||
name = "blob"
|
||||
@@ -18,21 +18,21 @@ var/list/blobs = list()
|
||||
var/mob/observer/blob/overmind = null
|
||||
var/base_name = "blob" // The name that gets appended along with the blob_type's name.
|
||||
|
||||
/obj/structure/blob/New(var/newloc, var/new_overmind)
|
||||
..(newloc)
|
||||
/obj/structure/blob/Initialize(newloc, new_overmind)
|
||||
if(new_overmind)
|
||||
overmind = new_overmind
|
||||
update_icon()
|
||||
if(!integrity)
|
||||
integrity = max_integrity
|
||||
set_dir(pick(cardinal))
|
||||
blobs += src
|
||||
GLOB.all_blobs += src
|
||||
consume_tile()
|
||||
return ..()
|
||||
|
||||
|
||||
/obj/structure/blob/Destroy()
|
||||
playsound(src.loc, 'sound/effects/splat.ogg', 50, 1) //Expand() is no longer broken, no check necessary.
|
||||
blobs -= src
|
||||
GLOB.all_blobs -= src
|
||||
overmind = null
|
||||
return ..()
|
||||
|
||||
@@ -112,7 +112,7 @@ var/list/blobs = list()
|
||||
if(overmind)
|
||||
expand_probablity *= overmind.blob_type.spread_modifier
|
||||
if(overmind.blob_type.slow_spread_with_size)
|
||||
expand_probablity /= (blobs.len / 10)
|
||||
expand_probablity /= (GLOB.all_blobs.len / 10)
|
||||
|
||||
if(distance <= expand_range)
|
||||
var/can_expand = TRUE
|
||||
|
||||
@@ -12,6 +12,7 @@ var/list/blob_cores = list()
|
||||
health_regen = 0 //we regen in Life() instead of when pulsed
|
||||
var/datum/blob_type/desired_blob_type = null // If this is set, the core always creates an overmind possessing this blob type.
|
||||
var/difficulty_threshold = null // Otherwise if this is set, it picks a random blob_type that is equal or lower in difficulty.
|
||||
var/difficulty_floor = null // Related to the above var, acts as a floor value to the above, inclusive.
|
||||
var/core_regen = 2
|
||||
var/overmind_get_delay = 0 //we don't want to constantly try to find an overmind, this var tracks when we'll try to get an overmind again
|
||||
var/resource_delay = 0
|
||||
@@ -23,14 +24,18 @@ var/list/blob_cores = list()
|
||||
ai_controlled = FALSE
|
||||
|
||||
// Spawn these if you want a semi-random blob.
|
||||
// Can give a random easy blob.
|
||||
/obj/structure/blob/core/random_easy
|
||||
difficulty_threshold = BLOB_DIFFICULTY_EASY
|
||||
|
||||
// Can give a random easy or medium blob.
|
||||
/obj/structure/blob/core/random_medium
|
||||
difficulty_threshold = BLOB_DIFFICULTY_MEDIUM
|
||||
|
||||
// Can give a random medium or hard blob.
|
||||
/obj/structure/blob/core/random_hard
|
||||
difficulty_threshold = BLOB_DIFFICULTY_HARD
|
||||
difficulty_floor = BLOB_DIFFICULTY_MEDIUM
|
||||
|
||||
// Spawn these if you want a specific blob.
|
||||
/obj/structure/blob/core/blazing_oil
|
||||
@@ -81,8 +86,8 @@ var/list/blob_cores = list()
|
||||
/obj/structure/blob/core/classic
|
||||
desired_blob_type = /datum/blob_type/classic
|
||||
|
||||
/obj/structure/blob/core/New(var/newloc, var/client/new_overmind = null, new_rate = 2, placed = 0)
|
||||
..(newloc)
|
||||
/obj/structure/blob/core/Initialize(newloc, client/new_overmind = null, new_rate = 2, placed = 0)
|
||||
. = ..(newloc)
|
||||
blob_cores += src
|
||||
START_PROCESSING(SSobj, src)
|
||||
update_icon() //so it atleast appears
|
||||
@@ -180,7 +185,9 @@ var/list/blob_cores = list()
|
||||
var/list/valid_types = list()
|
||||
for(var/thing in subtypesof(/datum/blob_type))
|
||||
var/datum/blob_type/BT = thing
|
||||
if(initial(BT.difficulty) > difficulty_threshold)
|
||||
if(initial(BT.difficulty) > difficulty_threshold) // Too hard.
|
||||
continue
|
||||
if(initial(BT.difficulty) < difficulty_floor) // Too easy.
|
||||
continue
|
||||
valid_types += BT
|
||||
return pick(valid_types)
|
||||
@@ -9,10 +9,10 @@
|
||||
var/resource_delay = 0
|
||||
var/resource_cooldown = 4 SECONDS
|
||||
|
||||
/obj/structure/blob/resource/New(var/newloc, var/new_overmind)
|
||||
..(newloc, new_overmind)
|
||||
/obj/structure/blob/resource/Initialize(newloc, new_overmind)
|
||||
if(overmind)
|
||||
overmind.resource_blobs += src
|
||||
return ..()
|
||||
|
||||
/obj/structure/blob/resource/Destroy()
|
||||
if(overmind)
|
||||
|
||||
Reference in New Issue
Block a user