mirror of
https://github.com/PolarisSS13/Polaris.git
synced 2025-12-15 12:42:50 +00:00
Saving more work.
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)
|
||||
|
||||
@@ -23,7 +23,7 @@ var/list/overminds = list()
|
||||
var/ai_controlled = TRUE
|
||||
var/auto_pilot = FALSE // If true, and if a client is attached, the AI routine will continue running.
|
||||
|
||||
/mob/observer/blob/New(var/newloc, pre_placed = 0, starting_points = 60, desired_blob_type = null)
|
||||
/mob/observer/blob/Initialize(newloc, pre_placed = 0, starting_points = 60, desired_blob_type = null)
|
||||
blob_points = starting_points
|
||||
if(pre_placed) //we already have a core!
|
||||
placed = 1
|
||||
@@ -41,10 +41,10 @@ var/list/overminds = list()
|
||||
if(blob_core)
|
||||
blob_core.update_icon()
|
||||
|
||||
..(newloc)
|
||||
return ..(newloc)
|
||||
|
||||
/mob/observer/blob/Destroy()
|
||||
for(var/BL in blobs)
|
||||
for(var/BL in GLOB.all_blobs)
|
||||
var/obj/structure/blob/B = BL
|
||||
if(B && B.overmind == src)
|
||||
B.overmind = null
|
||||
@@ -65,7 +65,7 @@ var/list/overminds = list()
|
||||
if(blob_core)
|
||||
stat(null, "Core Health: [blob_core.integrity]")
|
||||
stat(null, "Power Stored: [blob_points]/[max_blob_points]")
|
||||
stat(null, "Total Blobs: [blobs.len]")
|
||||
stat(null, "Total Blobs: [GLOB.all_blobs.len]")
|
||||
|
||||
/mob/observer/blob/Move(NewLoc, Dir = 0)
|
||||
if(placed)
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
to_chat(src, "<span class='warning'>There is no blob here!</span>")
|
||||
return
|
||||
|
||||
if(B.overmind != src)
|
||||
to_chat(src, span("warning", "This blob isn't controlled by you."))
|
||||
|
||||
if(!istype(B, /obj/structure/blob/normal))
|
||||
to_chat(src, "<span class='warning'>Unable to use this blob, find a normal one.</span>")
|
||||
return
|
||||
@@ -66,7 +69,7 @@
|
||||
return FALSE
|
||||
|
||||
var/obj/structure/blob/B = null
|
||||
var/list/potential_blobs = blobs.Copy()
|
||||
var/list/potential_blobs = GLOB.all_blobs.Copy()
|
||||
while(potential_blobs.len)
|
||||
var/obj/structure/blob/temp = pick(potential_blobs)
|
||||
if(!(locate(/obj/structure/blob/node) in range(temp, BLOB_NODE_PULSE_RANGE) ) && !(locate(/obj/structure/blob/core) in range(temp, BLOB_CORE_PULSE_RANGE) ))
|
||||
@@ -77,6 +80,8 @@
|
||||
potential_blobs -= temp // Don't take up the core's shield spot.
|
||||
else if(!istype(temp, /obj/structure/blob/normal))
|
||||
potential_blobs -= temp // Not a normal blob.
|
||||
else if(temp.overmind != src)
|
||||
potential_blobs -= temp // Not our blob.
|
||||
else
|
||||
B = temp
|
||||
break
|
||||
@@ -107,7 +112,7 @@
|
||||
return FALSE
|
||||
|
||||
var/obj/structure/blob/B = null
|
||||
var/list/potential_blobs = blobs.Copy()
|
||||
var/list/potential_blobs = GLOB.all_blobs.Copy()
|
||||
while(potential_blobs.len)
|
||||
var/obj/structure/blob/temp = pick(potential_blobs)
|
||||
if(!(locate(/obj/structure/blob/node) in range(temp, BLOB_NODE_PULSE_RANGE) ) && !(locate(/obj/structure/blob/core) in range(temp, BLOB_CORE_PULSE_RANGE) ))
|
||||
@@ -118,6 +123,8 @@
|
||||
potential_blobs -= temp // Don't take up the core's shield spot.
|
||||
else if(!istype(temp, /obj/structure/blob/normal))
|
||||
potential_blobs -= temp // Not a normal blob.
|
||||
else if(temp.overmind != src)
|
||||
potential_blobs -= temp // Not our blob.
|
||||
else
|
||||
B = temp
|
||||
break
|
||||
@@ -149,7 +156,7 @@
|
||||
return FALSE
|
||||
|
||||
var/obj/structure/blob/B = null
|
||||
var/list/potential_blobs = blobs.Copy()
|
||||
var/list/potential_blobs = GLOB.all_blobs.Copy()
|
||||
while(potential_blobs.len)
|
||||
var/obj/structure/blob/temp = pick(potential_blobs)
|
||||
if(locate(/obj/structure/blob/node) in range(temp, 5) )
|
||||
@@ -158,6 +165,8 @@
|
||||
potential_blobs -= temp
|
||||
else if(!istype(temp, /obj/structure/blob/normal))
|
||||
potential_blobs -= temp
|
||||
else if(temp.overmind != src)
|
||||
potential_blobs -= temp // Not our blob.
|
||||
else
|
||||
B = temp
|
||||
break
|
||||
@@ -184,7 +193,7 @@
|
||||
other_T = get_step(T, direction)
|
||||
if(other_T)
|
||||
B = locate(/obj/structure/blob) in other_T
|
||||
if(B)
|
||||
if(B && B.overmind == src)
|
||||
break
|
||||
|
||||
if(!B)
|
||||
@@ -216,7 +225,7 @@
|
||||
for(var/direction in cardinal)
|
||||
var/turf/T = get_step(L, direction)
|
||||
B = locate(/obj/structure/blob) in T
|
||||
if(B)
|
||||
if(B && B.overmind == src)
|
||||
break
|
||||
if(!B)
|
||||
continue
|
||||
|
||||
Reference in New Issue
Block a user