Merge remote-tracking branch 'remotes/git-svn' into bs12_with_tgport

Conflicts:
	baystation12.dme
	code/datums/organs/organ_internal.dm
	code/datums/vote.dm
	code/defines/atom.dm
	code/defines/procs/gamehelpers.dm
	code/defines/turf.dm
	code/game/algorithm.dm
	code/game/cellautomata.dm
	code/game/gamemodes/cult/runes.dm
	code/game/gamemodes/events.dm
	code/game/gamemodes/events/ninja_equipment.dm
	code/game/gamemodes/events/space_ninja.dm
	code/game/gamemodes/wizard/rightandwrong.dm
	code/game/jobs/job/captain.dm
	code/game/machinery/computer/ai_core.dm
	code/game/machinery/computer/law.dm
	code/game/machinery/computer/pod.dm
	code/game/machinery/computer/syndicate_shuttle.dm
	code/game/machinery/doors/firedoor.dm
	code/game/machinery/teleporter.dm
	code/game/machinery/wishgranter.dm
	code/game/objects/items/devices/uplinks.dm
	code/game/objects/items/weapons/cigs_lighters.dm
	code/game/objects/structures/electricchair.dm
	code/game/turfs/turf.dm
	code/game/vote.dm
	code/hub.dm
	code/modules/admin/admin_verbs.dm
	code/modules/awaymissions/zlevel.dm
	code/modules/client/client defines.dm
	code/modules/food/food.dm
	code/modules/food/meat.dm
	code/modules/food/recipes_microwave.dm
	code/modules/mob/living/carbon/carbon_defines.dm
	code/modules/mob/living/carbon/human/hud.dm
	code/modules/mob/living/carbon/human/update_icons.dm
	code/modules/mob/living/login.dm
	code/modules/mob/living/simple_animal/life.dm
	code/modules/mob/mob_defines.dm
	code/modules/mob/new_player/login.dm
	code/modules/paperwork/filingcabinet.dm
	code/modules/paperwork/folders.dm
	code/modules/paperwork/photocopier.dm
	code/setup.dm
	icons/effects/genetics.dmi
	interface/interface.dm
	interface/skin.dmf
	maps/RandomZLevels/fileList.txt

various misc mergefixes and todos

Signed-off-by: Cael_Aislinn <cael_aislinn@yahoo.com.au>
This commit is contained in:
Cael_Aislinn
2012-09-22 21:29:04 +10:00
251 changed files with 16290 additions and 13118 deletions

View File

@@ -274,11 +274,11 @@ area
if(!src) return
if(light < 0)
light = 0
luminosity = 0
// luminosity = 0
else
if(light > lighting_controller.lighting_states)
light = lighting_controller.lighting_states
luminosity = 1
// luminosity = 1
if(lighting_overlay)
overlays -= lighting_overlay

View File

@@ -21,8 +21,8 @@
var/allow_admin_jump = 1 // allows admin jumping
var/allow_admin_spawning = 1 // allows admin item spawning
var/allow_admin_rev = 1 // allows admin revives
var/vote_delay = 600 // minimum time between voting sessions (seconds, 10 minute default)
var/vote_period = 60 // length of voting period (seconds, default 1 minute)
var/vote_delay = 6000 // minimum time between voting sessions (deciseconds, 10 minute default)
var/vote_period = 600 // length of voting period (deciseconds, default 1 minute)
var/vote_no_default = 0 // vote does not default to nochange/norestart (tbi)
var/vote_no_dead = 0 // dead people can't vote (tbi)
// var/enable_authentication = 0 // goon authentication
@@ -74,6 +74,12 @@
var/health_threshold_crit = 0
var/health_threshold_dead = -100
var/organ_health_multiplier = 1
var/organ_regeneration_multiplier = 1
var/bones_can_break = 0
var/limbs_can_break = 0
var/revival_pod_plants = 1
var/revival_cloning = 1
var/revival_brain_life = -1
@@ -371,6 +377,14 @@
config.metroid_delay = value
if("animal_delay")
config.animal_delay = value
if("organ_health_multiplier")
config.organ_health_multiplier = value / 100
if("organ_regeneration_multiplier")
config.organ_regeneration_multiplier = value / 100
if("bones_can_break")
config.bones_can_break = value
if("limbs_can_break")
config.limbs_can_break = value
else
diary << "Unknown setting in configuration: '[name]'"

View File

@@ -0,0 +1,72 @@
var/datum/controller/failsafe/Failsafe
/datum/controller/failsafe // This thing pretty much just keeps poking the master controller
var/processing = 0
var/processing_interval = 100 //poke the MC every 10 seconds
var/MC_iteration = 0
var/MC_defcon = 0 //alert level. For every poke that fails this is raised by 1. When it reaches 5 the MC is replaced with a new one. (effectively killing any master_controller.process() and starting a new one)
var/lighting_iteration = 0
var/lighting_defcon = 0 //alert level for lighting controller.
/datum/controller/failsafe/New()
//There can be only one failsafe. Out with the old in with the new (that way we can restart the Failsafe by spawning a new one)
if(Failsafe != src)
if(istype(Failsafe))
del(Failsafe)
Failsafe = src
Failsafe.process()
/datum/controller/failsafe/proc/process()
processing = 1
spawn(0)
set background = 1
while(1) //more efficient than recursivly calling ourself over and over. background = 1 ensures we do not trigger an infinite loop
if(!master_controller) new /datum/controller/game_controller() //replace the missing master_controller! This should never happen.
if(!lighting_controller) new /datum/controller/lighting() //replace the missing lighting_controller
if(processing)
if(master_controller.processing) //only poke if these overrides aren't in effect
if(MC_iteration == controller_iteration) //master_controller hasn't finished processing in the defined interval
switch(MC_defcon)
if(0 to 3)
MC_defcon++
if(4)
for(var/client/C in admin_list)
C << "<font color='red' size='2'><b>Warning. The Master Controller has not fired in the last [MC_defcon*processing_interval] ticks. Automatic restart in [processing_interval] ticks.</b></font>"
MC_defcon = 5
if(5)
for(var/client/C in admin_list)
C << "<font color='red' size='2'><b>Warning. The Master Controller has still not fired within the last [MC_defcon*processing_interval] ticks. Killing and restarting...</b></font>"
new /datum/controller/game_controller() //replace the old master_controller (hence killing the old one's process)
master_controller.process() //Start it rolling again
MC_defcon = 0
else
MC_defcon = 0
MC_iteration = controller_iteration
if(lighting_controller.processing)
if(lighting_iteration == lighting_controller.iteration) //master_controller hasn't finished processing in the defined interval
switch(lighting_defcon)
if(0 to 3)
lighting_defcon++
if(4)
for(var/client/C in admin_list)
C << "<font color='red' size='2'><b>Warning. The Lighting Controller has not fired in the last [lighting_defcon*processing_interval] ticks. Automatic restart in [processing_interval] ticks.</b></font>"
lighting_defcon = 5
if(5)
for(var/client/C in admin_list)
C << "<font color='red' size='2'><b>Warning. The Lighting Controller has still not fired within the last [lighting_defcon*processing_interval] ticks. Killing and restarting...</b></font>"
new /datum/controller/lighting() //replace the old lighting_controller (hence killing the old one's process)
lighting_controller.process() //Start it rolling again
lighting_defcon = 0
else
lighting_defcon = 0
lighting_iteration = lighting_controller.iteration
else
MC_defcon = 0
lighting_defcon = 0
sleep(processing_interval)

View File

@@ -3,7 +3,6 @@
//WIP, needs lots of work still
var/global/datum/controller/game_controller/master_controller //Set in world.New()
var/global/datum/failsafe/Failsafe
var/global/controller_iteration = 0
var/global/last_tick_timeofday = world.timeofday
@@ -30,11 +29,13 @@ datum/controller/game_controller
datum/controller/game_controller/New()
//There can be only one master_controller. Out with the old and in with the new.
if(master_controller != src)
if(istype(master_controller,/datum/controller/game_controller))
if(istype(master_controller))
Recover()
del(master_controller)
master_controller = src
createRandomZlevel()
if(!air_master)
air_master = new /datum/controller/air_system()
air_master.setup()
@@ -54,7 +55,6 @@ datum/controller/game_controller/New()
datum/controller/game_controller/proc/setup()
world.tick_lag = config.Ticklag
createRandomZlevel()
setup_objects()
setupgenetics()
setupfactions()
@@ -96,7 +96,7 @@ datum/controller/game_controller/proc/process()
spawn(0)
set background = 1
while(1) //far more efficient than recursively calling ourself
if(!Failsafe) new /datum/failsafe()
if(!Failsafe) new /datum/controller/failsafe()
var/currenttime = world.timeofday
last_tick_duration = (currenttime - last_tick_timeofday) / 10
@@ -107,6 +107,8 @@ datum/controller/game_controller/proc/process()
var/start_time = world.timeofday
controller_iteration++
vote.process()
//AIR
/*timer = world.timeofday
last_thing_processed = air_master.type
@@ -266,65 +268,3 @@ datum/controller/game_controller/proc/Recover() //Mostly a placeholder for now.
msg += "\t [varname] = [varval]\n"
world.log << msg
/datum/failsafe // This thing pretty much just keeps poking the master controller
var/spinning = 1
var/current_iteration = 0
var/ticks_per_spin = 100 //poke the MC every 10 seconds
var/defcon = 0 //alert level. For every poke that fails this is raised by 1. When it reaches 5 the MC is replaced with a new one. (effectively killing any master_controller.process() and starting a new one)
/datum/failsafe/New()
//There can be only one failsafe. Out with the old in with the new (that way we can restart the Failsafe by spawning a new one)
if(Failsafe && (Failsafe != src))
del(Failsafe)
Failsafe = src
current_iteration = controller_iteration
Failsafe.spin()
/datum/failsafe/proc/spin()
spawn(0)
set background = 1
while(1) //more efficient than recursivly calling ourself over and over. background = 1 ensures we do not trigger an infinite loop
if(master_controller)
if(spinning && master_controller.processing) //only poke if these overrides aren't in effect
if(current_iteration == controller_iteration) //master_controller hasn't finished processing in the defined interval
switch(defcon)
if(0 to 3)
defcon++
if(4)
for(var/client/C in admin_list)
if(C.holder)
C << "<font color='red' size='2'><b>Warning. The Master Controller has not fired in the last [defcon*ticks_per_spin] ticks. Automatic restart in [ticks_per_spin] ticks.</b></font>"
defcon = 5
if(5)
for(var/client/C in admin_list)
if(C.holder)
C << "<font color='red' size='2'><b>Warning. The Master Controller has still not fired within the last [defcon*ticks_per_spin] ticks. Killing and restarting...</b></font>"
new /datum/controller/game_controller() //replace the old master_controller (hence killing the old one's process)
master_controller.process() //Start it rolling again
defcon = 0
else
defcon = 0
current_iteration = controller_iteration
else
defcon = 0
else
new /datum/controller/game_controller() //replace the missing master_controller! This should never happen.
sleep(ticks_per_spin)
//DEBUG VERBS
/*
/client/verb/spawn_MC()
new /datum/controller/game_controller()
/client/verb/spawn_FS()
new /datum/failsafe()
/client/verb/machines_list()
for(var/i=1,i<=machines.len,i++)
var/machine = machines[i]
if(istype(machine,/datum)) world.log << machine:type
else world.log << machine
*/

View File

@@ -1,7 +1,7 @@
//TODO: rewrite and standardise all controller datums to the datum/controller type
//TODO: allow all controllers to be deleted for clean restarts (see WIP master controller stuff) - MC done - lighting done
/client/proc/restart_controller(controller in list("Master","Lighting","Supply Shuttle"))
/client/proc/restart_controller(controller in list("Master","Failsafe","Lighting","Supply Shuttle"))
set category = "Debug"
set name = "Restart Controller"
set desc = "Restart one of the various periodic loop controllers for the game (be careful!)"
@@ -14,6 +14,9 @@
new /datum/controller/game_controller()
master_controller.process()
feedback_add_details("admin_verb","RMC")
if("Failsafe")
new /datum/controller/failsafe()
feedback_add_details("admin_verb","RFailsafe")
if("Lighting")
new /datum/controller/lighting()
lighting_controller.process()
@@ -25,7 +28,7 @@
return
/client/proc/debug_controller(controller in list("Master","Ticker","Lighting","Air","Jobs","Sun","Radio","Supply Shuttle","Emergency Shuttle","Configuration","pAI"))
/client/proc/debug_controller(controller in list("Master","Failsafe","Ticker","Lighting","Air","Jobs","Sun","Radio","Supply Shuttle","Emergency Shuttle","Configuration","pAI"))
set category = "Debug"
set name = "Debug Controller"
set desc = "Debug the various periodic loop controllers for the game (be careful!)"
@@ -35,6 +38,9 @@
if("Master")
debug_variables(master_controller)
feedback_add_details("admin_verb","DMC")
if("Failsafe")
debug_variables(Failsafe)
feedback_add_details("admin_verb","DFailsafe")
if("Ticker")
debug_variables(ticker)
feedback_add_details("admin_verb","DTicker")

233
code/controllers/voting.dm Normal file
View File

@@ -0,0 +1,233 @@
var/datum/controller/vote/vote = new()
datum/controller/vote
var/initiator = null
var/started_timeofday = null
var/time_remaining = 0
var/mode = null
var/question = null
var/list/choices = list()
var/list/voted = list()
var/list/voting = list()
New()
if(vote != src)
if(istype(vote))
del(vote)
vote = src
proc/process() //called by master_controller
if(mode)
time_remaining = started_timeofday + config.vote_period
if(world.timeofday < started_timeofday)
time_remaining -= 864000
time_remaining = round((time_remaining - world.timeofday)/10)
var/i=1
if(time_remaining < 0)
result()
while(i<=voting.len)
var/client/C = voting[i]
if(C)
C << browse(null,"window=vote;can_close=0")
i++
reset()
else
while(i<=voting.len)
var/client/C = voting[i]
if(C)
C << browse(vote.interface(C),"window=vote;can_close=0")
i++
else
voting.Cut(i,i+1)
proc/reset()
initiator = null
time_remaining = 0
mode = null
question = null
choices.Cut()
voted.Cut()
voting.Cut()
proc/get_result()
//get the highest number of votes
var/greatest_votes = 0
for(var/option in choices)
var/votes = choices[option]
if(votes > greatest_votes)
greatest_votes = votes
//get all options with that many votes and return them in a list
. = list()
if(greatest_votes)
for(var/option in choices)
if(choices[option] == greatest_votes)
. += option
return .
proc/announce_result()
var/list/winners = get_result()
var/text
if(winners.len > 0)
if(winners.len > 1)
text = "<b>Vote Tied Between:</b>\n"
for(var/option in winners)
text += "\t[option]\n"
. = pick(winners)
text += "<b>Vote Result: [.]</b>"
else
text += "<b>Vote Result: Inconclusive - No Votes!</b>"
log_vote(text)
world << "<font color='purple'>[text]</font>"
return .
proc/result()
. = announce_result()
var/restart = 0
if(.)
switch(mode)
if("restart")
if(. == "Restart Round")
restart = 1
if("gamemode")
if(master_mode != .)
world.save_mode(.)
if(ticker && ticker.mode)
restart = 1
else
master_mode = .
if(restart)
world << "World restarting due to vote..."
feedback_set_details("end_error","restart vote")
if(blackbox) blackbox.save_all_data_to_sql()
sleep(50)
log_game("Rebooting due to restart vote")
world.Reboot()
return .
proc/submit_vote(var/vote)
if(mode)
if(config.vote_no_dead && usr.stat == DEAD && !usr.client.holder)
return 0
if(!(usr.ckey in voted))
if(vote && 1<=vote && vote<=choices.len)
voted += usr.ckey
choices[choices[vote]]++ //check this
return vote
return 0
proc/initiate_vote(var/vote_type, var/initiator_key)
if(!mode)
if(started_timeofday != null)
var/next_allowed_timeofday = (started_timeofday + config.vote_delay)
if(world.timeofday < started_timeofday)
next_allowed_timeofday -= 864000
if(next_allowed_timeofday > world.timeofday)
return 0
reset()
switch(vote_type)
if("restart") choices.Add("Restart Round","Continue Playing")
if("gamemode") choices.Add(config.votable_modes)
if("custom")
question = html_encode(input(usr,"What is the vote for?") as text|null)
if(!question) return 0
for(var/i=1,i<=10,i++)
var/option = capitalize(html_encode(input(usr,"Please enter an option or hit cancel to finish") as text|null))
if(!option || mode || !usr.client) break
choices.Add(option)
else return 0
mode = vote_type
initiator = initiator_key
started_timeofday = world.timeofday
var/text = "[capitalize(mode)] vote started by [initiator]."
log_vote(text)
world << "<font color='purple'><b>[text]</b>\nType vote to place your votes.\nYou have [config.vote_period/10] seconds to vote.</font>"
time_remaining = round(config.vote_period/10)
return 1
return 0
proc/interface(var/client/C)
if(!C) return
var/admin = 0
if(C.holder)
admin = 1
voting |= C
. = "<html><head><title>Voting Panel</title></head><body>"
if(mode)
if(question) . += "<h2>Vote: '[question]'</h2>"
else . += "<h2>Vote: [capitalize(mode)]</h2>"
. += "Time Left: [time_remaining] s<hr><ul>"
for(var/i=1,i<=choices.len,i++)
var/votes = choices[choices[i]]
if(!votes) votes = 0
. += "<li><a href='?src=\ref[src];vote=[i]'>[choices[i]]</a> ([votes] votes)</li>"
. += "</ul><hr>"
if(admin)
. += "(<a href='?src=\ref[src];vote=cancel'>Cancel Vote</a>) "
else
. += "<h2>Start a vote:</h2><hr><ul><li>"
//restart
if(admin || config.allow_vote_restart)
. += "<a href='?src=\ref[src];vote=restart'>Restart</a>"
else
. += "<font color='grey'>Restart (Disallowed)</font>"
if(admin)
. += "\t(<a href='?src=\ref[src];vote=toggle_restart'>[config.allow_vote_restart?"Allowed":"Disallowed"]</a>)"
. += "</li><li>"
//gamemode
if(admin || config.allow_vote_mode)
. += "<a href='?src=\ref[src];vote=gamemode'>GameMode</a>"
else
. += "<font color='grey'>GameMode (Disallowed)</font>"
if(admin)
. += "\t(<a href='?src=\ref[src];vote=toggle_gamemode'>[config.allow_vote_mode?"Allowed":"Disallowed"]</a>)"
. += "</li>"
//custom
if(admin)
. += "<li><a href='?src=\ref[src];vote=custom'>Custom</a></li>"
. += "</ul><hr>"
. += "<a href='?src=\ref[src];vote=close' style='position:absolute;right:50px'>Close</a></body></html>"
return .
Topic(href,href_list[],hsrc)
if(!usr || !usr.client) return //not necessary but meh...just in-case somebody does something stupid
switch(href_list["vote"])
if("close")
voting -= usr.ckey
usr << browse(null, "window=vote")
return
if("cancel")
if(usr.client.holder)
reset()
if("toggle_restart")
if(usr.client.holder)
config.allow_vote_restart = !config.allow_vote_restart
if("toggle_gamemode")
if(usr.client.holder)
config.allow_vote_mode = !config.allow_vote_mode
if("restart")
if(config.allow_vote_restart || usr.client.holder)
initiate_vote("restart",usr.key)
if("gamemode")
if(config.allow_vote_mode || usr.client.holder)
initiate_vote("gamemode",usr.key)
if("custom")
if(usr.client.holder)
initiate_vote("custom",usr.key)
else
submit_vote(round(text2num(href_list["vote"])))
usr.vote()
/mob/verb/vote()
set category = "OOC"
set name = "Vote"
if(vote)
src << browse(vote.interface(client),"window=vote;can_close=0")