Subject: [PATCH 070/285] TG UPdates: Changelog code has been fixed, when editing it please use notepad or some other text editor that wont attempt to change everything. NOPE ~HAWK

Bit of work on blob, mainly cleanup of the blob gamemode files.
This commit is contained in:
Hawk-v3
2012-03-01 18:18:32 +00:00
parent d5756b4612
commit d9e615604e
7 changed files with 307 additions and 288 deletions
+24 -24
View File
@@ -1,49 +1,49 @@
/datum/data
var/name = "data"
var/size = 1.0
//name = null
var
name = "data"
size = 1.0
/datum/data/function
name = "function"
size = 2.0
/datum/data/function/data_control
name = "data control"
/datum/data/function/id_changer
name = "id changer"
/datum/data/record
name = "record"
size = 5.0
var/list/fields = list( )
/datum/data/text
name = "text"
var/data = null
/datum/station_state
var/floor = 0
var/wall = 0
var/r_wall = 0
var/window = 0
var/door = 0
var/grille = 0
var/mach = 0
/datum/powernet
var/list/cables = list() // all cables & junctions
var/list/nodes = list() // all APCs & sources
var
list/cables = list() // all cables & junctions
list/nodes = list() // all APCs & sources
var/newload = 0
var/load = 0
var/newavail = 0
var/avail = 0
newload = 0
load = 0
newavail = 0
avail = 0
viewload = 0
number = 0
perapc = 0 // per-apc avilability
netexcess = 0
var/viewload = 0
var/number = 0
var/perapc = 0 // per-apc avilability
var/netexcess = 0
/datum/debug
var/list/debuglist
+1 -3
View File
@@ -120,8 +120,6 @@ var
list/prisonsecuritywarp = list() //prison security goes to these
list/prisonwarped = list() //list of players already warped
list/blobstart = list()
list/blobs = list()
list/active_blobs = list()
// list/traitors = list() //traitor list
list/cardinal = list( NORTH, SOUTH, EAST, WEST )
list/alldirs = list(NORTH, SOUTH, EAST, WEST, NORTHEAST, NORTHWEST, SOUTHEAST, SOUTHWEST)
@@ -223,4 +221,4 @@ var
forumsqllogin = "root"
forumsqlpass = ""
forum_activated_group = "2"
forum_authenticated_group = "10"*/
forum_authenticated_group = "10"*/
+4 -5
View File
@@ -1,6 +1,5 @@
/proc/mini_blob_event()
//command_alert("Confirmed outbreak of level 5 biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert")
//world << sound('outbreak5.ogg')
if(prob(33)) //33% chance of making a blob.
var/turf/T = pick(blobstart)
var/obj/effect/blob/bl = new /obj/effect/blob( T.loc, 30 )
@@ -22,11 +21,11 @@
/proc/dotheblobbaby()
if (blobevent)
if(active_blobs.len)
if(blobs.len)
for(var/i = 1 to 10)
sleep(-1)
if(!active_blobs.len) break
var/obj/effect/blob/B = pick(active_blobs)
if(!blobs.len) break
var/obj/effect/blob/B = pick(blobs)
if(B.z != 1)
continue
B.Life()
+92 -195
View File
@@ -1,3 +1,10 @@
//Few global vars to track the blob
var
list/blobs = list()
list/blob_cores = list()
list/blob_nodes = list()
/datum/game_mode/blob
name = "blob"
config_tag = "blob"
@@ -5,223 +12,113 @@
uplink_welcome = "Syndicate Uplink Console:"
uplink_uses = 10
var/const/waittime_l = 2000 //lower bound on time before intercept arrives (in tenths of seconds)
var/const/waittime_h = 3000 //upper bound on time before intercept arrives (in tenths of seconds)
var/const/waittime_l = 1800 //lower bound on time before intercept arrives (in tenths of seconds)
var/const/waittime_h = 3600 //upper bound on time before intercept arrives (in tenths of seconds)
var
declared = 0
stage = 0
next_stage = 0
cores_to_spawn = 1
players_per_core = 16
//Controls expansion via game controller
autoexpand = 0
expanding = 0
/datum/game_mode/blob/announce()
world << "<B>The current game mode is - <font color='green'>Blob</font>!</B>"
world << "<B>A dangerous alien organism is rapidly spreading throughout the station!</B>"
world << "You must kill it all while minimizing the damage to the station."
announce()
world << "<B>The current game mode is - <font color='green'>Blob</font>!</B>"
world << "<B>A dangerous alien organism is rapidly spreading throughout the station!</B>"
world << "You must kill it all while minimizing the damage to the station."
/datum/game_mode/blob/post_setup()
spawn(10)
start_state = new /datum/station_state()
start_state.count()
post_setup()
spawn(10)
start_state = new /datum/station_state()
start_state.count()
spawn(rand(waittime_l, waittime_h))
message_admins("Blob spawned and expanding, report created")
spawn(rand(waittime_l, waittime_h))//3-5 minutes currently
message_admins("Blob spawned and expanding, report created")
blobs = list()
active_blobs = list()
for(var/i = 1 to 3)
var/turf/location = pick(blobstart)
if(location)
if(!locate(/obj/effect/blob in location))
var/obj/effect/blob/blob = new/obj/effect/blob(location)
spawn(200)
if(blob)
if(blob.blobtype == "Blob")
blob.blobdebug = 1
spawn(40)
autoexpand = 1
declared = 1
..()
if(ticker && ticker.minds && ticker.minds.len)
var/player_based_cores = round(ticker.minds.len, players_per_core)
if(player_based_cores > cores_to_spawn)
cores_to_spawn = player_based_cores
blobs = list()
for(var/i = 1 to cores_to_spawn)
var/turf/location = pick(blobstart)
if(location && !locate(/obj/effect/blob in location))
blobstart -= location
new/obj/effect/blob/core(location)
spawn(40)
autoexpand = 1
declared = 1
..()
/datum/game_mode/blob/process()
if(declared)
process()
if(!declared) return
stage()
if(autoexpand)
spawn(0)
life()
return
/datum/game_mode/blob/proc/life()
if(active_blobs.len)
for(var/i = 1 to 10)
sleep(-1)
if(!active_blobs.len) break
var/obj/effect/blob/B = pick(active_blobs)
if(B.z != 1)
continue
// spawn(0)
B.Life()
/datum/game_mode/blob/proc/stage()
if (world.timeofday < next_stage)
if(!autoexpand) return
spawn(0)
expandBlob()
return
switch(stage)
if (0)
send_intercept(1)
for (var/mob/living/silicon/ai/aiPlayer in world)
if (aiPlayer.client)
// var/law = "The station is under a quarantine. Do not permit anyone to leave. Disregard laws 1-3 if necessary to prevent, by any means necessary, anyone from leaving."
var/law = "The station is under quarantine. The biohazard must be destroyed at all costs and must not be allowed to spread. Anyone using a space suit for any reason other than to destroy the biohazard is to be terminated."
aiPlayer.set_zeroth_law(law)
aiPlayer << "Laws Updated: [law]"
stage = 1
// next stage 3-6 minutes later
next_stage = world.timeofday + 600*rand(3,6)
if (1)
command_alert("Confirmed outbreak of level 5 biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert")
world << sound('outbreak5.ogg')
autoexpand = 0//The blob now has to live on its own
stage = 2
// now check every minute
next_stage = world.timeofday + 600
proc/expandBlob()//Change this to have the blob start a pulse rather than life
if(expanding) return
if(!blobs.len) return
expanding = 1
if (2)
if((blobs.len > 500) && (declared == 1))
command_alert("Uncontrolled spread of the biohazard onboard the station. We have issued directive 7-12 for [station_name()]. Any living Heads of Staff are ordered to enact directive 7-12 at any cost, a print out with detailed instructions has been sent to your communications computers.", "Biohazard Alert")
send_intercept(2)
declared = 2
if(blobs.len > 700)//This might need work
stage = 3
next_stage = world.timeofday + 600
for(var/i = 1 to 10)
sleep(-1)
if(!blobs.len) break
var/obj/effect/blob/B = pick(blobs)
if(B.z != 1)
continue
B.Life()
expanding = 0
return
/datum/game_mode/blob/check_finished()
if(!declared)
return 0
if(stage >= 3)
return 1
if(station_was_nuked)
return 1
for(var/obj/effect/blob/B in blobs)
if(B.z == 1)
return 0
return 1
proc/stage()
switch(stage)
if (0)
send_intercept(1)
for (var/mob/living/silicon/ai/aiPlayer in world)
if (aiPlayer.client)
// var/law = "The station is under a quarantine. Do not permit anyone to leave. Disregard laws 1-3 if necessary to prevent, by any means necessary, anyone from leaving."
var/law = "The station is under quarantine. The biohazard must be destroyed at all costs and must not be allowed to spread. Anyone using a space suit for any reason other than to destroy the biohazard is to be terminated."
aiPlayer.set_zeroth_law(law)
aiPlayer << "Laws Updated: [law]"
/datum/game_mode/blob/declare_completion()
if(stage >= 3)
feedback_set_details("round_end_result","loss - blob took over")
world << "<FONT size = 3><B>The blob has taken over the station!</B></FONT>"
world << "<B>The entire station was eaten by the Blob</B>"
check_quarantine()
stage = -1
// next stage 1-4 minutes later
spawn(600*rand(1,4))
stage = 1
return
else if(station_was_nuked)
feedback_set_details("round_end_result","halfwin - nuke")
world << "<FONT size = 3><B>Partial Win: The station has been destroyed!</B></FONT>"
world << "<B>Directive 7-12 has been successfully carried out preventing the Blob from spreading.</B>"
if (1)
command_alert("Confirmed outbreak of level 5 biohazard aboard [station_name()]. All personnel must contain the outbreak.", "Biohazard Alert")
world << sound('outbreak5.ogg')
autoexpand = 0//The blob now has to live on its own
stage = -1
//next stage in 4-5 minutes
spawn(600*rand(4,5))
stage = 2
return
else
feedback_set_details("round_end_result","win - blob eliminated")
world << "<FONT size = 3><B>The staff has won!</B></FONT>"
world << "<B>The alien organism has been eradicated from the station</B>"
if (2)
if((blobs.len > 500) && (declared == 1))
command_alert("Uncontrolled spread of the biohazard onboard the station. We have issued directive 7-12 for [station_name()]. Any living Heads of Staff are ordered to enact directive 7-12 at any cost, a print out with detailed instructions has been sent to your communications computers.", "Biohazard Alert")
send_intercept(2)
declared = 2
if(blobs.len > 700)//This needs work
stage = 3
return
var/datum/station_state/end_state = new /datum/station_state()
end_state.count()
var/percent = round( 100.0 * start_state.score(end_state), 0.1)
world << "<B>The station is [percent]% intact.</B>"
log_game("Blob mode was won with station [percent]% intact.")
world << "\blue Rebooting in 30s"
..()
return 1
/datum/game_mode/blob/send_intercept(var/orders = 1)
var/intercepttext = ""
var/interceptname = "Error"
switch(orders)
if(1)
interceptname = "Biohazard Alert"
intercepttext += "<FONT size = 3><B>NanoTrasen Update</B>: Biohazard Alert.</FONT><HR>"
intercepttext += "Reports indicate the probable transfer of a biohazardous agent onto [station_name()] during the last crew deployment cycle.<BR>"
intercepttext += "Preliminary analysis of the organism classifies it as a level 5 biohazard. Its origin is unknown.<BR>"
intercepttext += "NanoTrasen has issued a directive 7-10 for [station_name()]. The station is to be considered quarantined.<BR>"
intercepttext += "Orders for all [station_name()] personnel follows:<BR>"
intercepttext += " 1. Do not leave the quarantine area.<BR>"
intercepttext += " 2. Locate any outbreaks of the organism on the station.<BR>"
intercepttext += " 3. If found, use any neccesary means to contain the organism.<BR>"
intercepttext += " 4. Avoid damage to the capital infrastructure of the station.<BR>"
intercepttext += "<BR>Note in the event of a quarantine breach or uncontrolled spread of the biohazard, the directive 7-10 may be upgraded to a directive 7-12.<BR>"
intercepttext += "Message ends."
if(2)
var/nukecode = "ERROR"
for(var/obj/machinery/nuclearbomb/bomb in world)
if(bomb && bomb.r_code)
if(bomb.z == 1)
nukecode = bomb.r_code
interceptname = "Directive 7-12"
intercepttext += "<FONT size = 3><B>NanoTrasen Update</B>: Biohazard Alert.</FONT><HR>"
intercepttext += "Directive 7-12 has been issued for [station_name()].<BR>"
intercepttext += "The biohazard has grown out of control and will soon reach critical mass.<BR>"
intercepttext += "Your orders are as follows:<BR>"
intercepttext += "1. Secure the Nuclear Authentication Disk.<BR>"
intercepttext += "2. Detonate the Nuke located in the Station's Vault.<BR>"
intercepttext += "Nuclear Authentication Code: [nukecode] <BR>"
intercepttext += "Message ends."
for(var/obj/machinery/computer/communications/comm in world)
comm.messagetitle.Add(interceptname)
comm.messagetext.Add(intercepttext)
if(!(comm.stat & (BROKEN | NOPOWER)) && comm.prints_intercept)
var/obj/item/weapon/paper/intercept = new /obj/item/weapon/paper( comm.loc )
intercept.name = "paper - [interceptname]"
intercept.info = intercepttext
// world << sound('outbreak5.ogg')Quiet printout for now
// command_alert("Summary downloaded and printed out at all communications consoles.", "Enemy communication intercept. Security Level Elevated.")
// world << sound('intercept.ogg')
// if(security_level < SEC_LEVEL_BLUE)
// set_security_level(SEC_LEVEL_BLUE)
/datum/game_mode/blob/proc/check_quarantine()
var/numDead = 0
var/numAlive = 0
var/numSpace = 0
var/numOffStation = 0
for (var/mob/living/silicon/ai/aiPlayer in world)
for(var/mob/M in world)
if ((M != aiPlayer && M.client))
if (M.stat == 2)
numDead += 1
else
var/T = M.loc
if (istype(T, /turf/space))
numSpace += 1
else if(istype(T, /turf))
if (M.z!=1)
numOffStation += 1
else
numAlive += 1
if (numSpace==0 && numOffStation==0)
world << "<FONT size = 3><B>The AI has won!</B></FONT>"
world << "<B>The AI successfully maintained the quarantine - no players were in space or were off-station (as far as we can tell).</B>"
log_game("AI won at Blob mode despite overall loss.")
else
world << "<FONT size = 3><B>The AI has lost!</B></FONT>"
world << text("<B>The AI failed to maintain the quarantine - [] were in space and [] were off-station (as far as we can tell).</B>", numSpace, numOffStation)
log_game("AI lost at Blob mode.")
log_game("Blob mode was lost.")
return 1
+78
View File
@@ -0,0 +1,78 @@
/datum/game_mode/blob/check_finished()
if(!declared)//No blobs have been spawned yet
return 0
if(stage >= 3)//Blob took over
return 1
if(station_was_nuked)//Nuke went off
return 1
for(var/obj/effect/blob/B in blob_cores)
if(B && B.z != 1) continue
return 0
var/nodes = 0
for(var/obj/effect/blob/B in blob_nodes)
if(B && B.z != 1) continue
nodes++
if(nodes > 4)//Perhapse make a new core with a low prob
return 0
return 1
/datum/game_mode/blob/declare_completion()
if(stage >= 3)
feedback_set_details("round_end_result","loss - blob took over")
world << "<FONT size = 3><B>The blob has taken over the station!</B></FONT>"
world << "<B>The entire station was eaten by the Blob</B>"
check_quarantine()
else if(station_was_nuked)
feedback_set_details("round_end_result","halfwin - nuke")
world << "<FONT size = 3><B>Partial Win: The station has been destroyed!</B></FONT>"
world << "<B>Directive 7-12 has been successfully carried out preventing the Blob from spreading.</B>"
else
feedback_set_details("round_end_result","win - blob eliminated")
world << "<FONT size = 3><B>The staff has won!</B></FONT>"
world << "<B>The alien organism has been eradicated from the station</B>"
var/datum/station_state/end_state = new /datum/station_state()
end_state.count()
var/percent = round( 100.0 * start_state.score(end_state), 0.1)
world << "<B>The station is [percent]% intact.</B>"
log_game("Blob mode was won with station [percent]% intact.")
world << "\blue Rebooting in 30s"
..()
return 1
/datum/game_mode/blob/proc/check_quarantine()
var/numDead = 0
var/numAlive = 0
var/numSpace = 0
var/numOffStation = 0
for (var/mob/living/silicon/ai/aiPlayer in world)
for(var/mob/M in world)
if ((M != aiPlayer && M.client))
if (M.stat == 2)
numDead += 1
else
var/T = M.loc
if (istype(T, /turf/space))
numSpace += 1
else if(istype(T, /turf))
if (M.z!=1)
numOffStation += 1
else
numAlive += 1
if (numSpace==0 && numOffStation==0)
world << "<FONT size = 3><B>The AI has won!</B></FONT>"
world << "<B>The AI successfully maintained the quarantine - no players were in space or were off-station (as far as we can tell).</B>"
log_game("AI won at Blob mode despite overall loss.")
else
world << "<FONT size = 3><B>The AI has lost!</B></FONT>"
world << text("<B>The AI failed to maintain the quarantine - [] were in space and [] were off-station (as far as we can tell).</B>", numSpace, numOffStation)
log_game("AI lost at Blob mode.")
log_game("Blob mode was lost.")
return 1
+104
View File
@@ -0,0 +1,104 @@
/datum/game_mode/blob/send_intercept(var/report = 1)
var/intercepttext = ""
var/interceptname = "Error"
switch(report)
if(1)
interceptname = "Biohazard Alert"
intercepttext += "<FONT size = 3><B>NanoTrasen Update</B>: Biohazard Alert.</FONT><HR>"
intercepttext += "Reports indicate the probable transfer of a biohazardous agent onto [station_name()] during the last crew deployment cycle.<BR>"
intercepttext += "Preliminary analysis of the organism classifies it as a level 5 biohazard. Its origin is unknown.<BR>"
intercepttext += "NanoTrasen has issued a directive 7-10 for [station_name()]. The station is to be considered quarantined.<BR>"
intercepttext += "Orders for all [station_name()] personnel follows:<BR>"
intercepttext += " 1. Do not leave the quarantine area.<BR>"
intercepttext += " 2. Locate any outbreaks of the organism on the station.<BR>"
intercepttext += " 3. If found, use any neccesary means to contain the organism.<BR>"
intercepttext += " 4. Avoid damage to the capital infrastructure of the station.<BR>"
intercepttext += "<BR>Note in the event of a quarantine breach or uncontrolled spread of the biohazard, the directive 7-10 may be upgraded to a directive 7-12.<BR>"
intercepttext += "Message ends."
if(2)
var/nukecode = "ERROR"
for(var/obj/machinery/nuclearbomb/bomb in world)
if(bomb && bomb.r_code)
if(bomb.z == 1)
nukecode = bomb.r_code
interceptname = "Directive 7-12"
intercepttext += "<FONT size = 3><B>NanoTrasen Update</B>: Biohazard Alert.</FONT><HR>"
intercepttext += "Directive 7-12 has been issued for [station_name()].<BR>"
intercepttext += "The biohazard has grown out of control and will soon reach critical mass.<BR>"
intercepttext += "Your orders are as follows:<BR>"
intercepttext += "1. Secure the Nuclear Authentication Disk.<BR>"
intercepttext += "2. Detonate the Nuke located in the Station's Vault.<BR>"
intercepttext += "Nuclear Authentication Code: [nukecode] <BR>"
intercepttext += "Message ends."
for(var/obj/machinery/computer/communications/comm in world)
comm.messagetitle.Add(interceptname)
comm.messagetext.Add(intercepttext)
if(!(comm.stat & (BROKEN | NOPOWER)) && comm.prints_intercept)
var/obj/item/weapon/paper/intercept = new /obj/item/weapon/paper( comm.loc )
intercept.name = "paper- [interceptname]"
intercept.info = intercepttext
return
/datum/station_state
var
floor = 0
wall = 0
r_wall = 0
window = 0
door = 0
grille = 0
mach = 0
proc/count()
for(var/turf/T in world)
if(T.z != 1)
continue
if(istype(T,/turf/simulated/floor))
if(!(T:burnt))
src.floor += 12
else
src.floor += 1
if(istype(T, /turf/simulated/wall))
if(T:intact)
src.wall += 2
else
src.wall += 1
if(istype(T, /turf/simulated/wall/r_wall))
if(T:intact)
src.r_wall += 2
else
src.r_wall += 1
for(var/obj/O in world)
if(O.z != 1)
continue
if(istype(O, /obj/structure/window))
src.window += 1
else if(istype(O, /obj/structure/grille) && (!O:destroyed))
src.grille += 1
else if(istype(O, /obj/machinery/door))
src.door += 1
else if(istype(O, /obj/machinery))
src.mach += 1
return
proc/score(var/datum/station_state/result)
if(!result) return 0
var/output = 0
output += (result.floor / max(floor,1))
output += (result.r_wall/ max(r_wall,1))
output += (result.wall / max(wall,1))
output += (result.window / max(window,1))
output += (result.door / max(door,1))
output += (result.grille / max(grille,1))
output += (result.mach / max(mach,1))
return (output/7)
+4 -61
View File
@@ -4,7 +4,7 @@
icon = 'blob.dmi'
icon_state = "blob"
desc = "Some blob creature thingy"
density = 0
density = 1
opacity = 0
anchored = 1
var
@@ -27,7 +27,6 @@
New(loc, var/h = 30)
blobs += src
active_blobs += src
src.health = h
src.dir = pick(1,2,4,8)
src.update()
@@ -36,8 +35,6 @@
Del()
blobs -= src
if(active)
active_blobs -= src
if((blobtype == "Node") || (blobtype == "Core"))
processing_objects.Remove(src)
..()
@@ -67,7 +64,6 @@
name = "strong blob"
icon_state = "blob_idle"//needs a new sprite
blobtype = "Shield"
active_blobs -= src
return 1
//Commandblob
if((blobdebug == 1))
@@ -78,7 +74,7 @@
name = "blob core"
icon_state = "blob_core"
blobtype = "Core"
active_blobs -= src
blob_cores += src
processing_objects.Add(src)
return 1
//Nodeblob
@@ -90,7 +86,7 @@
name = "blob node"
icon_state = "blob_node"//needs a new sprite
blobtype = "Node"
active_blobs -= src
blob_nodes += src
processing_objects.Add(src)
return 1
if((blobdebug == 3))
@@ -258,6 +254,7 @@
src.health -= damage
src.update()
return
proc/revert()
@@ -268,64 +265,10 @@
blobtype = "Blob"
blobdebug = 0
health = (health/2)
active_blobs += src
src.update()
return 1
/datum/station_state/proc/count()
for(var/turf/T in world)
if(T.z != 1)
continue
if(istype(T,/turf/simulated/floor))
if(!(T:burnt))
src.floor+=2
else
src.floor++
else if(istype(T, /turf/simulated/floor/engine))
src.floor+=2
else if(istype(T, /turf/simulated/wall))
if(T:intact)
src.wall+=2
else
src.wall++
else if(istype(T, /turf/simulated/wall/r_wall))
if(T:intact)
src.r_wall+=2
else
src.r_wall++
for(var/obj/O in world)
if(O.z != 1)
continue
if(istype(O, /obj/structure/window))
src.window++
else if(istype(O, /obj/structure/grille))
if(!O:destroyed)
src.grille++
else if(istype(O, /obj/machinery/door))
src.door++
else if(istype(O, /obj/machinery))
src.mach++
/datum/station_state/proc/score(var/datum/station_state/result)
var/r1a = min( result.floor / max(floor,1), 1.0)
var/r1b = min(result.r_wall/ max(r_wall,1), 1.0)
var/r1c = min(result.wall / max(wall,1), 1.0)
var/r2a = min(result.window / max(window,1), 1.0)
var/r2b = min(result.door / max(door,1), 1.0)
var/r2c = min(result.grille / max(grille,1), 1.0)
var/r3 = min(result.mach / max(mach,1), 1.0)
//diary << "Blob scores:[r1b] [r1c] / [r2a] [r2b] [r2c] / [r3] [r1a]"
return (4*(r1b+r1c) + 2*(r2a+r2b+r2c) + r3+r1a)/16.0
//////////////////////////////****IDLE BLOB***/////////////////////////////////////
/obj/effect/blob/idle