Merge branch 'master' of git://github.com/Baystation12/Baystation12

This commit is contained in:
Ren Erthilo
2012-04-11 20:49:14 +01:00
64 changed files with 1951 additions and 1481 deletions

View File

@@ -258,13 +258,17 @@ var/global/BSACooldown = 0
jobban_unban(M, job)
href_list["jobban2"] = 1
else
ban_unban_log_save("[key_name(usr)] jobbanned [key_name(M)] from [job]")
var/reason = input(usr,"Reason?","reason","griefer") as text|null
if(!reason)
return
ban_unban_log_save("[key_name(usr)] jobbanned [key_name(M)] from [job]. reason: [reason]")
log_admin("[key_name(usr)] banned [key_name(M)] from [job]")
feedback_inc("ban_job",1)
M << "\red<BIG><B>You have been jobbanned by [usr.client.ckey] from [job].</B></BIG>"
M << "\red <B>The reason is: [reason]</B>"
M << "\red Jooban can be lifted only on demand."
message_admins("\blue [key_name_admin(usr)] banned [key_name_admin(M)] from [job]", 1)
jobban_fullban(M, job)
jobban_fullban(M, job, reason)
href_list["jobban2"] = 1 // lets it fall through and refresh
@@ -2024,10 +2028,14 @@ var/global/BSACooldown = 0
return
/obj/admins/proc/Jobbans()
if ((src.rank in list( "Game Admin", "Game Master" )))
var/dat = "<B>Job Bans!</B><HR><table>"
for(var/t in jobban_keylist)
dat += text("<tr><td><A href='?src=\ref[src];removejobban=[t]'>[t]</A></td></tr>")
var/r = t
if( findtext(r,"##") )
r = copytext( r, 1, findtext(r,"##") )//removes the description
dat += text("<tr><td>[t] (<A href='?src=\ref[src];removejobban=[r]'>unban</A>)</td></tr>")
dat += "</table>"
usr << browse(dat, "window=ban;size=400x400")
@@ -2734,6 +2742,25 @@ var/global/BSACooldown = 0
onclose(usr,"server_logfile")
return
/obj/admins/proc/view_atk_log()
set category = "Admin"
set desc="Shows todays server attack log in new window"
set name="Show Server Attack Log"
var/path = "data/logs/[time2text(world.realtime,"YYYY")]/[time2text(world.realtime,"MM")]-[time2text(world.realtime,"Month")]/[time2text(world.realtime,"DD")]-[time2text(world.realtime,"Day")] Attack.log"
var/output = {"<html>
<head>
<title>[time2text(world.realtime,"Day, MMM DD, YYYY")] - Attack Log</title>
</head>
<body>
<pre>
[file2text(path)]
</pre>
</body>
</html>"}
usr << browse(output,"window=server_logfile")
onclose(usr,"server_logfile")
return
/*/client/proc/unjobban_panel()
set name = "Unjobban Panel"
set category = "Admin"

View File

@@ -25,7 +25,7 @@
holder.rank = rank
if(!holder.state)
var/state = alert("Which state do you the admin to begin in?", "Admin-state", "Play", "Observe", "Neither")
var/state = alert("Which state do you want the admin to begin in?", "Admin-state", "Play", "Observe", "Neither")
if(state == "Play")
holder.state = 1
admin_play()
@@ -145,6 +145,7 @@
if (holder.level >= 5)//Game Admin********************************************************************
verbs += /obj/admins/proc/view_txt_log
verbs += /obj/admins/proc/view_atk_log
//verbs += /client/proc/cmd_mass_modify_object_variables --Merged with view variables
verbs += /client/proc/cmd_admin_list_open_jobs
verbs += /client/proc/cmd_admin_direct_narrate
@@ -169,6 +170,8 @@
verbs += /client/proc/restartcontroller //Can call via aproccall --I_hate_easy_things.jpg, Mport --Agouri
verbs += /client/proc/Blobize//I need to remember to move/remove this later
verbs += /client/proc/toggle_clickproc //TODO ERRORAGE (Temporary proc while the enw clickproc is being tested)
verbs += /client/proc/toggle_gravity_on
verbs += /client/proc/toggle_gravity_off
// Moved over from tg's Game Master:
verbs += /client/proc/colorooc
verbs += /obj/admins/proc/toggle_aliens //toggle aliens
@@ -419,6 +422,8 @@
verbs -= /client/proc/toggle_hear_deadcast
verbs -= /client/proc/toggle_hear_radio
verbs -= /client/proc/tension_report
verbs -= /client/proc/toggle_gravity_on
verbs -= /client/proc/toggle_gravity_off
verbs -= /client/proc/cmd_admin_change_custom_event
verbs -= /client/proc/admin_invis
verbs -= /client/proc/callprocgen

View File

@@ -1,10 +1,15 @@
var
jobban_runonce // Updates legacy bans with new info
jobban_runonce // Updates legacy bans with new info
jobban_keylist[0] //to store the keys & ranks
/proc/jobban_fullban(mob/M, rank)
/proc/jobban_fullban(mob/M, rank, reason)
if (!M || !M.key || !M.client) return
jobban_keylist.Add(text("[M.ckey] - [rank]"))
jobban_keylist.Add(text("[M.ckey] - [rank] ## [reason]"))
jobban_savebanfile()
/proc/jobban_client_fullban(ckey, rank)
if (!ckey || !rank) return
jobban_keylist.Add(text("[ckey] - [rank]"))
jobban_savebanfile()
/proc/jobban_isbanned(mob/M, rank)
@@ -15,17 +20,41 @@ var
return 1
if(config.usewhitelist && !check_whitelist(M))
return 1
if (jobban_keylist.Find(text("[M.ckey] - [rank]")))
return 1
else
return 0
for (var/s in jobban_keylist)
if( findtext(s,"[M.ckey] - [rank]") )
return 1
return 0
/*
DEBUG
/mob/verb/list_all_jobbans()
set name = "list all jobbans"
for(var/s in jobban_keylist)
world << s
/mob/verb/reload_jobbans()
set name = "reload jobbans"
jobban_loadbanfile()
*/
/proc/jobban_loadbanfile()
var/savefile/S=new("data/job_full.ban")
S["keys[0]"] >> jobban_keylist
log_admin("Loading jobban_rank")
S["runonce"] >> jobban_runonce
/*
for(var/i = 1; i <= length(jobban_keylist); i++)
if( findtext(jobban_keylist[i],"##") )
var/index = findtext(jobban_keylist[i],"##")
var/s = jobban_keylist[i]
s = copytext( s , 1 , index ) //Removes the reason for the ban from this list
jobban_keylist[i] = s
world << "DEBUG: index: [index] - s: [s] - jobban_keylist\[[i]\] = [jobban_keylist[i]]"*/
if (!length(jobban_keylist))
jobban_keylist=list()
log_admin("jobban_keylist was empty")
@@ -36,7 +65,7 @@ var
S["keys[0]"] << jobban_keylist
/proc/jobban_unban(mob/M, rank)
jobban_keylist.Remove(text("[M.ckey] - [rank]"))
jobban_remove("[M.ckey] - [rank]")
jobban_savebanfile()
@@ -54,8 +83,9 @@ var
/proc/jobban_remove(X)
if(jobban_keylist.Find(X))
jobban_keylist.Remove(X)
jobban_savebanfile()
return 1
return 0
for (var/i = 1; i <= length(jobban_keylist); i++)
if( findtext(jobban_keylist[i], "[X]") )
jobban_keylist.Remove(jobban_keylist[i])
jobban_savebanfile()
return 1
return 0

View File

@@ -612,13 +612,13 @@ But you can call procs that are of type /mob/living/carbon/human/proc/ for that
M.equip_if_possible(new /obj/item/weapon/chem_grenade/cleaner(M), M.slot_r_store)
M.equip_if_possible(new /obj/item/weapon/chem_grenade/cleaner(M), M.slot_l_store)
M.equip_if_possible(new /obj/item/stack/tile/steel(M), M.slot_in_backpack)
M.equip_if_possible(new /obj/item/stack/tile/steel(M), M.slot_in_backpack)
M.equip_if_possible(new /obj/item/stack/tile/steel(M), M.slot_in_backpack)
M.equip_if_possible(new /obj/item/stack/tile/steel(M), M.slot_in_backpack)
M.equip_if_possible(new /obj/item/stack/tile/steel(M), M.slot_in_backpack)
M.equip_if_possible(new /obj/item/stack/tile/steel(M), M.slot_in_backpack)
M.equip_if_possible(new /obj/item/stack/tile/steel(M), M.slot_in_backpack)
M.equip_if_possible(new /obj/item/stack/tile/plasteel(M), M.slot_in_backpack)
M.equip_if_possible(new /obj/item/stack/tile/plasteel(M), M.slot_in_backpack)
M.equip_if_possible(new /obj/item/stack/tile/plasteel(M), M.slot_in_backpack)
M.equip_if_possible(new /obj/item/stack/tile/plasteel(M), M.slot_in_backpack)
M.equip_if_possible(new /obj/item/stack/tile/plasteel(M), M.slot_in_backpack)
M.equip_if_possible(new /obj/item/stack/tile/plasteel(M), M.slot_in_backpack)
M.equip_if_possible(new /obj/item/stack/tile/plasteel(M), M.slot_in_backpack)
if ("pirate")
M.equip_if_possible(new /obj/item/clothing/under/pirate(M), M.slot_w_uniform)

View File

@@ -650,12 +650,14 @@ Traitors and the like can also be revived with the previous role mostly intact.
var/confirm = alert(src, "You sure?", "Confirm", "Yes", "No")
if(confirm != "Yes") return
//Due to the delay here its easy for something to have happened to the mob
if(!M) return
if(usr.key != M.key && M.client)
log_admin("[key_name(usr)] has gibbed [key_name(M)]")
message_admins("[key_name_admin(usr)] has gibbed [key_name_admin(M)]", 1)
if (istype(M, /mob/dead/observer))
if(istype(M, /mob/dead/observer))
gibs(M.loc, M.viruses)
return
@@ -871,6 +873,36 @@ Traitors and the like can also be revived with the previous role mostly intact.
ticker.random_players = 1
/client/proc/toggle_gravity_on()
set category = "Debug"
set name = "Toggle station gravity on"
set desc = "Toggles all gravity to active on the station."
if (!(ticker && ticker.mode))
usr << "Please wait until the game starts! Not sure how it will work otherwise."
return
for(var/area/A in world)
A.gravitychange(1,A)
command_alert("CentComm is now beaming gravitons to your station. We appoligize for any inconvience.")
/client/proc/toggle_gravity_off()
set category = "Debug"
set name = "Toggle station gravity off"
set desc = "Toggles all gravity to inactive on the station."
if (!(ticker && ticker.mode))
usr << "Please wait until the game starts! Not sure how it will work otherwise."
return
for(var/area/A in world)
A.gravitychange(0,A)
command_alert("For budget reasons, Centcomm is no longer beaming gravitons to your station. We appoligize for any inconvience.")
/client/proc/rnd_check_designs()
set category = "Debug"
set name = "Check RnD Designs"

View File

@@ -99,11 +99,19 @@
flags = FPRINT|TABLEPASS|HEADCOVERSEYES
item_state = "helmet"
/obj/item/clothing/head/cargosoft
name = "cargo cap"
desc = "It's a baseball hat in a tasteless yellow colour."
icon_state = "cargosoft"
flags = FPRINT|TABLEPASS|HEADCOVERSEYES
item_state = "helmet"
var/flipped = 0
/obj/item/clothing/head/syndicatefake
name = "red space helmet replica"
desc = "A plastic replica of a red space space helmet. This is a toy, it is not made for use in space!"
icon_state = "syndicate"
item_state = "syndicate"
desc = "A plastic replica of a syndicate agent's space helmet, you'll look just like a real murderous syndicate agent in this! This is a toy, it is not made for use in space!"
see_face = 0.0
flags = FPRINT | TABLEPASS | BLOCKHAIR

View File

@@ -298,7 +298,7 @@
if (ore_iron > 0 && ore_plasma > 0)
ore_iron--;
ore_plasma--;
new /obj/item/stack/sheet/r_metal(output.loc)
new /obj/item/stack/sheet/plasteel(output.loc)
else
on = 0
continue

View File

@@ -27,8 +27,8 @@
if(machine.ore_iron)
dat += text("Iron: [machine.ore_iron] <A href='?src=\ref[src];release=iron'>Release</A><br>")
if(machine.ore_steel)
dat += text("Steel: [machine.ore_steel] <A href='?src=\ref[src];release=steel'>Release</A><br>")
if(machine.ore_plasteel)
dat += text("Plasteel: [machine.ore_plasteel] <A href='?src=\ref[src];release=plasteel'>Release</A><br>")
if(machine.ore_glass)
dat += text("Glass: [machine.ore_glass] <A href='?src=\ref[src];release=glass'>Release</A><br>")
if(machine.ore_rglass)
@@ -107,12 +107,12 @@
G.amount = machine.ore_iron
G.loc = machine.output.loc
machine.ore_iron = 0
if ("steel")
if (machine.ore_steel > 0)
var/obj/item/stack/sheet/r_metal/G = new /obj/item/stack/sheet/r_metal
G.amount = machine.ore_steel
if ("plasteel")
if (machine.ore_plasteel > 0)
var/obj/item/stack/sheet/plasteel/G = new /obj/item/stack/sheet/plasteel
G.amount = machine.ore_plasteel
G.loc = machine.output.loc
machine.ore_steel = 0
machine.ore_plasteel = 0
if ("clown")
if (machine.ore_clown > 0)
var/obj/item/stack/sheet/clown/G = new /obj/item/stack/sheet/clown
@@ -153,7 +153,7 @@
var/ore_clown = 0;
var/ore_glass = 0;
var/ore_rglass = 0;
var/ore_steel = 0;
var/ore_plasteel = 0;
var/ore_adamantine = 0;
var/stack_amt = 50; //ammount to stack before releassing
@@ -211,8 +211,8 @@
ore_rglass+= O:amount
del(O)
continue
if (istype(O,/obj/item/stack/sheet/r_metal))
ore_steel+= O:amount
if (istype(O,/obj/item/stack/sheet/plasteel))
ore_plasteel+= O:amount
del(O)
continue
if (istype(O,/obj/item/stack/sheet/adamantine))
@@ -277,11 +277,11 @@
G.loc = output.loc
ore_rglass -= stack_amt
return
if (ore_steel >= stack_amt)
var/obj/item/stack/sheet/r_metal/G = new /obj/item/stack/sheet/r_metal
if (ore_plasteel >= stack_amt)
var/obj/item/stack/sheet/plasteel/G = new /obj/item/stack/sheet/plasteel
G.amount = stack_amt
G.loc = output.loc
ore_steel -= stack_amt
ore_plasteel -= stack_amt
return
if (ore_adamantine >= stack_amt)
var/obj/item/stack/sheet/adamantine/G = new /obj/item/stack/sheet/adamantine

View File

@@ -2563,6 +2563,9 @@ It can still be worn/put on as normal.
src.stat = 0
return
src.health = 100 - src.getOxyLoss() - src.getToxLoss() - src.getFireLoss() - src.getBruteLoss() - src.getCloneLoss() -src.halloss
if(getFireLoss() > (100 - config.health_threshold_dead) && stat == DEAD) //100 only being used as the magic human max health number, feel free to change it if you add a var for it -- Urist
ChangeToHusk()
return
/mob/living/carbon/human/abiotic(var/full_body = 0)
if(full_body && ((src.l_hand && !( src.l_hand.abstract )) || (src.r_hand && !( src.r_hand.abstract )) || (src.back || src.wear_mask)))

View File

@@ -975,85 +975,43 @@ note dizziness decrements automatically in the mob's Life() proc.
statpanel("Spells","[S.charge_counter]/[S.charge_max]",S)
if("holdervar")
statpanel("Spells","[S.holder_var_type] [S.holder_var_amount]",S)
#if 1
/client/proc/station_explosion_cinematic(var/derp)
if(mob)
var/mob/M = mob
M.loc = null // HACK, but whatever, this works
if (M.client&&M.hud_used)//They may some times not have a hud, apparently.
var/obj/screen/boom = M.hud_used.station_explosion
M.client.screen += boom
if(ticker)
switch(ticker.mode.name)
if("nuclear emergency")
flick("start_nuke", boom)
if("AI malfunction")
flick("start_malf", boom)
else
boom.icon_state = "start"
sleep(40)
M << sound('explosionfar.ogg')
boom.icon_state = "end"
if(!derp) flick("explode", boom)
else flick("explode2", boom)
sleep(40)
if(ticker)
switch(ticker.mode.name)
if("nuclear emergency")
if (!derp) boom.icon_state = "loss_nuke"
else boom.icon_state = "loss_nuke2"
if("malfunction")
boom.icon_state = "loss_malf"
if("blob")
return//Nothin here yet and the general one does not fit.
else
boom.icon_state = "loss_general"
#elif
/client/proc/station_explosion_cinematic(var/derp)
if(!mob)
return
var/mob/M = mob
M.loc = null // HACK, but whatever, this works
/client/proc/station_explosion_cinematic(var/station_missed)
if(!mob || !ticker) return
if(!mob.client || !mob.hud_used || !ticker.mode) return
// M.loc = null this might make it act weird but fuck putting them in nullspace, it causes issues.
var/obj/screen/boom = mob.hud_used.station_explosion
if(!istype(boom)) return
if(!M.hud_used)
return
mob.client.screen += boom
switch(ticker.mode.name)
if("nuclear emergency")
flick("start_nuke", boom)
if("AI malfunction")
flick("start_malf", boom)
else
boom.icon_state = "start"
var/obj/screen/boom = M.hud_used.station_explosion
screen += boom
if(ticker)
switch(ticker.mode.name)
if("nuclear emergency")
flick("start_nuke", boom)
if("AI malfunction")
flick("start_malf", boom)
else
boom.icon_state = "start"
sleep(40)
M << sound('explosionfar.ogg')
mob << sound('explosionfar.ogg')
boom.icon_state = "end"
if(!derp)
flick("explode", boom)
else
flick("explode2", boom)
if(!station_missed) flick("explode", boom)
else flick("explode2", boom)
sleep(40)
if(ticker)
switch(ticker.mode.name)
if("nuclear emergency")
if (!derp)
boom.icon_state = "loss_nuke"
else
boom.icon_state = "loss_nuke2"
if("AI malfunction")
boom.icon_state = "loss_malf"
else
boom.icon_state = "loss_general"
#endif
switch(ticker.mode.name)
if("nuclear emergency")
if(!station_missed) boom.icon_state = "loss_nuke"
else boom.icon_state = "loss_nuke2"
if("malfunction")
boom.icon_state = "loss_malf"
if("blob")
return//Nothin here yet and the general one does not fit.
else
boom.icon_state = "loss_general"
return
// facing verbs

View File

@@ -133,6 +133,7 @@
/client/Move(n, direct)
if(mob.control_object) Move_object(direct)
if(isobserver(mob)) return mob.Move(n,direct)
@@ -143,6 +144,11 @@
if(!mob) return
if(locate(/obj/effect/stop/, mob.loc))
for(var/obj/effect/stop/S in mob.loc)
if(S.victim == mob)
return
if(mob.stat==2) return
if(isAI(mob)) return AIMove(n,direct,mob)
@@ -162,9 +168,15 @@
else
mob.canmove = 1
if(istype(mob.loc, /turf/space) || (mob.flags & NOGRAV))
//if(istype(mob.loc, /turf/space) || (mob.flags & NOGRAV))
// if(!mob.Process_Spacemove(0)) return 0
var/area/a = get_area(mob.loc)
if((istype(mob.loc, /turf/space)) || (a.has_gravity == 0))
if(!mob.Process_Spacemove(0)) return 0
if(isobj(mob.loc) || ismob(mob.loc))//Inside an object, tell it we moved
var/atom/O = mob.loc
return O.relaymove(mob, direct)
@@ -328,12 +340,35 @@
//First check to see if we can do things
if(restrained()) return 0
/*
if(istype(src,/mob/living/carbon))
if(src.l_hand && src.r_hand)
return 0
*/
var/dense_object = 0
for(var/turf/turf in oview(1,src))
if(istype(turf,/turf/space))
continue
if(istype(turf,/turf/simulated/floor) && (flags & NOGRAV))
var/area/a = get_area(turf)
if(istype(src,/mob/living/carbon/human/)) // Only humans can wear magboots, so we give them a chance to.
if((istype(turf,/turf/simulated/floor)) && (a.has_gravity == 0) && !(istype(src:shoes, /obj/item/clothing/shoes/magboots) && (src:shoes:flags & NOSLIP)))
continue
else
if((istype(turf,/turf/simulated/floor)) && (a.has_gravity == 0)) // No one else gets a chance.
continue
/*
if(istype(turf,/turf/simulated/floor) && (src.flags & NOGRAV))
continue
*/
dense_object++
break

View File

@@ -265,6 +265,7 @@
job_master.EquipRank(character, rank, 1)
EquipCustomItems(character)
character.loc = pick(latejoin)
character.lastarea = get_area(loc)
if(character.client)
character.client.be_syndicate = preferences.be_special
ticker.mode.latespawn(character)
@@ -369,6 +370,7 @@
proc/create_character()
spawning = 1
var/mob/living/carbon/human/new_character = new(loc)
new_character.lastarea = get_area(loc)
close_spawn_windows()

View File

@@ -21,26 +21,31 @@
max_co2 = 0
max_tox = 0
/mob/living/simple_animal/shade/Life()
..()
if (stat == 2)
new /obj/item/weapon/ectoplasm (src.loc)
for(var/mob/M in viewers(src, null))
if ((M.client && !( M.blinded )))
M.show_message("\red [src] lets out a contented sigh as their form unwinds. ")
del src
/mob/living/simple_animal/shade/attackby(var/obj/item/O as obj, var/mob/user as mob) //Marker -Agouri
if(istype(O, /obj/item/device/soulstone))
O.transfer_soul("SHADE", src, user)
else
if(O.force)
health -= O.force
Life()
..()
if(stat == 2)
new /obj/item/weapon/ectoplasm (src.loc)
for(var/mob/M in viewers(src, null))
if ((M.client && !( M.blinded )))
M.show_message("\red \b [src] has been attacked with the [O] by [user]. ")
if((M.client && !( M.blinded )))
M.show_message("\red [src] lets out a contented sigh as their form unwinds. ")
ghostize(0)
del src
return
attackby(var/obj/item/O as obj, var/mob/user as mob) //Marker -Agouri
if(istype(O, /obj/item/device/soulstone))
O.transfer_soul("SHADE", src, user)
else
usr << "\red This weapon is ineffective, it does no damage."
for(var/mob/M in viewers(src, null))
if ((M.client && !( M.blinded )))
M.show_message("\red [user] gently taps [src] with the [O]. ")
if(O.force)
health -= O.force
for(var/mob/M in viewers(src, null))
if ((M.client && !( M.blinded )))
M.show_message("\red \b [src] has been attacked with the [O] by [user]. ")
else
usr << "\red This weapon is ineffective, it does no damage."
for(var/mob/M in viewers(src, null))
if ((M.client && !( M.blinded )))
M.show_message("\red [user] gently taps [src] with the [O]. ")
return

View File

@@ -0,0 +1,144 @@
// It.. uses a lot of power. Everything under power is engineering stuff, at least.
/obj/machinery/computer/gravity_control_computer
name = "Gravity Generator Control"
desc = "A computer to control a local gravity generator. Qualified personnel only."
icon = 'computer.dmi'
icon_state = "airtunnel0e"
anchored = 1
density = 1
var/obj/machinery/gravity_generator = null
/obj/machinery/gravity_generator/
name = "Gravitational Generator"
desc = "A device which produces a gravaton field when set up."
icon = 'singularity.dmi'
icon_state = "TheSingGen"
anchored = 1
density = 1
use_power = 1
idle_power_usage = 200
active_power_usage = 1000
var/on = 1
var/list/localareas = list()
var/effectiverange = 25
// Borrows code from cloning computer
/obj/machinery/computer/gravity_control_computer/New()
..()
spawn(5)
updatemodules()
return
return
/obj/machinery/gravity_generator/New()
..()
spawn(5)
locatelocalareas()
return
return
/obj/machinery/computer/gravity_control_computer/proc/updatemodules()
src.gravity_generator = findgenerator()
/obj/machinery/gravity_generator/proc/locatelocalareas()
for(var/area/A in range(src,effectiverange))
if(A.name == "Space")
continue // No (de)gravitizing space.
if(A.master && !( A.master in localareas) )
localareas += A.master
/obj/machinery/computer/gravity_control_computer/proc/findgenerator()
var/obj/machinery/gravity_generator/foundgenerator = null
for(dir in list(NORTH,EAST,SOUTH,WEST))
//world << "SEARCHING IN [dir]"
foundgenerator = locate(/obj/machinery/gravity_generator/, get_step(src, dir))
if (!isnull(foundgenerator))
//world << "FOUND"
break
return foundgenerator
/obj/machinery/computer/gravity_control_computer/attack_paw(mob/user as mob)
return attack_hand(user)
/obj/machinery/computer/gravity_control_computer/attack_ai(mob/user as mob)
return attack_hand(user)
/obj/machinery/computer/gravity_control_computer/attack_hand(mob/user as mob)
user.machine = src
add_fingerprint(user)
if(stat & (BROKEN|NOPOWER))
return
updatemodules()
var/dat = "<h3>Generator Control System</h3>"
//dat += "<font size=-1><a href='byond://?src=\ref[src];refresh=1'>Refresh</a></font>"
if(gravity_generator)
if(gravity_generator:on)
dat += "<font color=green><br><tt>Gravity Status: ON</tt></font><br>"
else
dat += "<font color=red><br><tt>Gravity Status: OFF</tt></font><br>"
dat += "<br><tt>Currently Supplying Gravitons To:</tt><br>"
for(var/area/A in gravity_generator:localareas)
if(A.has_gravity && gravity_generator:on)
dat += "<tt><font color=green>[A]</tt></font><br>"
else if (A.has_gravity)
dat += "<tt><font color=yellow>[A]</tt></font><br>"
else
dat += "<tt><font color=red>[A]</tt></font><br>"
dat += "<br><tt>Maintainence Functions:</tt><br>"
if(gravity_generator:on)
dat += "<a href='byond://?src=\ref[src];gentoggle=1'><font color=red> TURN GRAVITY GENERATOR OFF. </font></a>"
else
dat += "<a href='byond://?src=\ref[src];gentoggle=1'><font color=green> TURN GRAVITY GENERATOR ON. </font></a>"
else
dat += "No local gravity generator detected!"
user << browse(dat, "window=gravgen")
onclose(user, "gravgen")
/obj/machinery/computer/gravity_control_computer/Topic(href, href_list)
set background = 1
..()
if ( (get_dist(src, usr) > 1 ))
if (!istype(usr, /mob/living/silicon))
usr.machine = null
usr << browse(null, "window=air_alarm")
return
if(href_list["gentoggle"])
if(gravity_generator:on)
gravity_generator:on = 0
for(var/area/A in gravity_generator:localareas)
var/obj/machinery/gravity_generator/G
for(G in world)
if((A.master in G.localareas) && (G.on))
break
if(!G)
A.gravitychange(0,A)
else
for(var/area/A in gravity_generator:localareas)
gravity_generator:on = 1
A.gravitychange(1,A)
src.updateUsrDialog()
return

View File

@@ -1,8 +1,6 @@
var/global/list/uneatable = list(
/turf/space,
/obj/effect,
/obj/effect/overlay,
/obj/effect/rune,
/mob/aiEye
)

View File

@@ -4,14 +4,6 @@
#define SMESMAXCHARGELEVEL 200000
#define SMESMAXOUTPUT 200000
/obj/machinery/power/smes/magical
name = "magical power storage unit"
desc = "A high-capacity superconducting magnetic energy storage (SMES) unit. Magically produces power."
process()
capacity = INFINITY
charge = INFINITY
..()
/obj/machinery/power/smes
name = "power storage unit"
desc = "A high-capacity superconducting magnetic energy storage (SMES) unit."
@@ -32,336 +24,345 @@
var/obj/machinery/power/terminal/terminal = null
/obj/machinery/power/smes/New()
..()
spawn(5)
dir_loop:
for(var/d in cardinal)
var/turf/T = get_step(src, d)
for(var/obj/machinery/power/terminal/term in T)
if(term && term.dir == turn(d, 180))
terminal = term
break dir_loop
if(!terminal)
stat |= BROKEN
return
terminal.master = src
updateicon()
/obj/machinery/power/smes/proc/updateicon()
overlays = null
if(stat & BROKEN)
New()
..()
spawn(5)
dir_loop:
for(var/d in cardinal)
var/turf/T = get_step(src, d)
for(var/obj/machinery/power/terminal/term in T)
if(term && term.dir == turn(d, 180))
terminal = term
break dir_loop
if(!terminal)
stat |= BROKEN
return
terminal.master = src
updateicon()
return
overlays += image('power.dmi', "smes-op[online]")
proc/updateicon()
overlays = null
if(stat & BROKEN) return
if(charging)
overlays += image('power.dmi', "smes-oc1")
else
if(chargemode)
overlays += image('power.dmi', "smes-oc0")
overlays += image('power.dmi', "smes-op[online]")
var/clevel = chargedisplay()
if(clevel>0)
overlays += image('power.dmi', "smes-og[clevel]")
if(charging)
overlays += image('power.dmi', "smes-oc1")
else
if(chargemode)
overlays += image('power.dmi', "smes-oc0")
/obj/machinery/power/smes/proc/chargedisplay()
return round(5.5*charge/capacity)
var/clevel = chargedisplay()
if(clevel>0)
overlays += image('power.dmi', "smes-og[clevel]")
return
proc/chargedisplay()
return round(5.5*charge/capacity)
#define SMESRATE 0.05 // rate of internal charge to external power
/obj/machinery/power/smes/process()
process()
if(stat & BROKEN)
return
if(stat & BROKEN) return
//store machine state to see if we need to update the icon overlays
var/last_disp = chargedisplay()
var/last_chrg = charging
var/last_onln = online
//store machine state to see if we need to update the icon overlays
var/last_disp = chargedisplay()
var/last_chrg = charging
var/last_onln = online
if(terminal)
var/excess = terminal.surplus()
if(terminal)
var/excess = terminal.surplus()
if(charging)
if(excess >= 0) // if there's power available, try to charge
if(charging)
if(excess >= 0) // if there's power available, try to charge
var/load = min((capacity-charge)/SMESRATE, chargelevel) // charge at set rate, limited to spare capacity
var/load = min((capacity-charge)/SMESRATE, chargelevel) // charge at set rate, limited to spare capacity
charge += load * SMESRATE // increase the charge
charge += load * SMESRATE // increase the charge
add_load(load) // add the load to the terminal side network
add_load(load) // add the load to the terminal side network
else // if not enough capcity
charging = 0 // stop charging
chargecount = 0
else // if not enough capcity
charging = 0 // stop charging
chargecount = 0
else
if(chargemode)
if(chargecount > rand(3,6))
charging = 1
chargecount = 0
else
if(chargemode)
if(chargecount > rand(3,6))
charging = 1
chargecount = 0
if(excess > chargelevel)
chargecount++
if(excess > chargelevel)
chargecount++
else
chargecount = 0
else
chargecount = 0
else
chargecount = 0
if(online) // if outputting
lastout = min( charge/SMESRATE, output) //limit output to that stored
if(online) // if outputting
lastout = min( charge/SMESRATE, output) //limit output to that stored
charge -= lastout*SMESRATE // reduce the storage (may be recovered in /restore() if excessive)
charge -= lastout*SMESRATE // reduce the storage (may be recovered in /restore() if excessive)
add_avail(lastout) // add output to powernet (smes side)
add_avail(lastout) // add output to powernet (smes side)
if(charge < 0.0001)
online = 0 // stop output if charge falls to zero
if(charge < 0.0001)
online = 0 // stop output if charge falls to zero
// only update icon if state changed
if(last_disp != chargedisplay() || last_chrg != charging || last_onln != online)
updateicon()
// only update icon if state changed
if(last_disp != chargedisplay() || last_chrg != charging || last_onln != online)
updateicon()
for(var/mob/M in viewers(1, src))
if ((M.client && M.machine == src))
src.interact(M)
AutoUpdateAI(src)
for(var/mob/M in viewers(1, src))
if ((M.client && M.machine == src))
src.interact(M)
AutoUpdateAI(src)
return
// called after all power processes are finished
// restores charge level to smes if there was excess this ptick
/obj/machinery/power/smes/proc/restore()
if(stat & BROKEN)
return
if(!online)
loaddemand = 0
return
var/excess = powernet.netexcess // this was how much wasn't used on the network last ptick, minus any removed by other SMESes
excess = min(lastout, excess) // clamp it to how much was actually output by this SMES last ptick
excess = min((capacity-charge)/SMESRATE, excess) // for safety, also limit recharge by space capacity of SMES (shouldn't happen)
// now recharge this amount
var/clev = chargedisplay()
charge += excess * SMESRATE
powernet.netexcess -= excess // remove the excess from the powernet, so later SMESes don't try to use it
loaddemand = lastout-excess
if(clev != chargedisplay() )
updateicon()
/obj/machinery/power/smes/add_load(var/amount)
if(terminal && terminal.powernet)
terminal.powernet.newload += amount
/obj/machinery/power/smes/attack_ai(mob/user)
add_fingerprint(user)
if(stat & BROKEN) return
interact(user)
/obj/machinery/power/smes/attack_hand(mob/user)
add_fingerprint(user)
if(stat & BROKEN) return
if(ishuman(user))
if(istype(user:gloves, /obj/item/clothing/gloves/space_ninja)&&user:gloves:candrain&&!user:gloves:draining)
call(/obj/item/clothing/gloves/space_ninja/proc/drain)("SMES",src,user:wear_suit)
proc/restore()
if(stat & BROKEN)
return
interact(user)
if(!online)
loaddemand = 0
return
/obj/machinery/power/smes/proc/interact(mob/user)
var/excess = powernet.netexcess // this was how much wasn't used on the network last ptick, minus any removed by other SMESes
if ( (get_dist(src, user) > 1 ))
if (!istype(user, /mob/living/silicon/ai))
excess = min(lastout, excess) // clamp it to how much was actually output by this SMES last ptick
excess = min((capacity-charge)/SMESRATE, excess) // for safety, also limit recharge by space capacity of SMES (shouldn't happen)
// now recharge this amount
var/clev = chargedisplay()
charge += excess * SMESRATE
powernet.netexcess -= excess // remove the excess from the powernet, so later SMESes don't try to use it
loaddemand = lastout-excess
if(clev != chargedisplay() )
updateicon()
return
add_load(var/amount)
if(terminal && terminal.powernet)
terminal.powernet.newload += amount
attack_ai(mob/user)
add_fingerprint(user)
if(stat & BROKEN) return
interact(user)
attack_hand(mob/user)
add_fingerprint(user)
if(stat & BROKEN) return
if(ishuman(user))
if(istype(user:gloves, /obj/item/clothing/gloves/space_ninja)&&user:gloves:candrain&&!user:gloves:draining)
call(/obj/item/clothing/gloves/space_ninja/proc/drain)("SMES",src,user:wear_suit)
return
interact(user)
proc/interact(mob/user)
if(get_dist(src, user) > 1 && !istype(user, /mob/living/silicon/ai))
user.machine = null
user << browse(null, "window=smes")
return
user.machine = src
user.machine = src
var/t = "<TT><B>SMES Power Storage Unit</B> [n_tag? "([n_tag])" : null]<HR><PRE>"
t += "Stored capacity : [round(100.0*charge/capacity, 0.1)]%<BR><BR>"
t += "Input: [charging ? "Charging" : "Not Charging"] [chargemode ? "<B>Auto</B> <A href = '?src=\ref[src];cmode=1'>Off</A>" : "<A href = '?src=\ref[src];cmode=1'>Auto</A> <B>Off</B> "]<BR>"
var/t = "<TT><B>SMES Power Storage Unit</B> [n_tag? "([n_tag])" : null]<HR><PRE>"
t += "Input level: <A href = '?src=\ref[src];input=-4'>M</A> <A href = '?src=\ref[src];input=-3'>-</A> <A href = '?src=\ref[src];input=-2'>-</A> <A href = '?src=\ref[src];input=-1'>-</A> [add_lspace(chargelevel,5)] <A href = '?src=\ref[src];input=1'>+</A> <A href = '?src=\ref[src];input=2'>+</A> <A href = '?src=\ref[src];input=3'>+</A> <A href = '?src=\ref[src];input=4'>M</A><BR>"
t += "Stored capacity : [round(100.0*charge/capacity, 0.1)]%<BR><BR>"
t += "<BR><BR>"
t += "Input: [charging ? "Charging" : "Not Charging"] [chargemode ? "<B>Auto</B> <A href = '?src=\ref[src];cmode=1'>Off</A>" : "<A href = '?src=\ref[src];cmode=1'>Auto</A> <B>Off</B> "]<BR>"
t += "Output: [online ? "<B>Online</B> <A href = '?src=\ref[src];online=1'>Offline</A>" : "<A href = '?src=\ref[src];online=1'>Online</A> <B>Offline</B> "]<BR>"
t += "Output level: <A href = '?src=\ref[src];output=-4'>M</A> <A href = '?src=\ref[src];output=-3'>-</A> <A href = '?src=\ref[src];output=-2'>-</A> <A href = '?src=\ref[src];output=-1'>-</A> [add_lspace(output,5)] <A href = '?src=\ref[src];output=1'>+</A> <A href = '?src=\ref[src];output=2'>+</A> <A href = '?src=\ref[src];output=3'>+</A> <A href = '?src=\ref[src];output=4'>M</A><BR>"
t += "Input level: <A href = '?src=\ref[src];input=-4'>M</A> <A href = '?src=\ref[src];input=-3'>-</A> <A href = '?src=\ref[src];input=-2'>-</A> <A href = '?src=\ref[src];input=-1'>-</A> [add_lspace(chargelevel,5)] <A href = '?src=\ref[src];input=1'>+</A> <A href = '?src=\ref[src];input=2'>+</A> <A href = '?src=\ref[src];input=3'>+</A> <A href = '?src=\ref[src];input=4'>M</A><BR>"
t += "Output load: [round(loaddemand)] W<BR>"
t += "<BR><BR>"
t += "<BR></PRE><HR><A href='?src=\ref[src];close=1'>Close</A>"
t += "Output: [online ? "<B>Online</B> <A href = '?src=\ref[src];online=1'>Offline</A>" : "<A href = '?src=\ref[src];online=1'>Online</A> <B>Offline</B> "]<BR>"
t += "Output level: <A href = '?src=\ref[src];output=-4'>M</A> <A href = '?src=\ref[src];output=-3'>-</A> <A href = '?src=\ref[src];output=-2'>-</A> <A href = '?src=\ref[src];output=-1'>-</A> [add_lspace(output,5)] <A href = '?src=\ref[src];output=1'>+</A> <A href = '?src=\ref[src];output=2'>+</A> <A href = '?src=\ref[src];output=3'>+</A> <A href = '?src=\ref[src];output=4'>M</A><BR>"
t += "Output load: [round(loaddemand)] W<BR>"
t += "<BR></PRE><HR><A href='?src=\ref[src];close=1'>Close</A>"
t += "</TT>"
user << browse(t, "window=smes;size=460x300")
onclose(user, "smes")
return
/obj/machinery/power/smes/Topic(href, href_list)
..()
if (usr.stat || usr.restrained() )
t += "</TT>"
user << browse(t, "window=smes;size=460x300")
onclose(user, "smes")
return
if (!(istype(usr, /mob/living/carbon/human) || ticker) && ticker.mode.name != "monkey")
if(!istype(usr, /mob/living/silicon/ai))
usr << "\red You don't have the dexterity to do this!"
Topic(href, href_list)
..()
if (usr.stat || usr.restrained() )
return
if (!(istype(usr, /mob/living/carbon/human) || ticker) && ticker.mode.name != "monkey")
if(!istype(usr, /mob/living/silicon/ai))
usr << "\red You don't have the dexterity to do this!"
return
//world << "[href] ; [href_list[href]]"
if (( usr.machine==src && ((get_dist(src, usr) <= 1) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon/ai)))
if (( usr.machine==src && ((get_dist(src, usr) <= 1) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon/ai)))
if( href_list["close"] )
if( href_list["close"] )
usr << browse(null, "window=smes")
usr.machine = null
return
else if( href_list["cmode"] )
chargemode = !chargemode
if(!chargemode)
charging = 0
updateicon()
else if( href_list["online"] )
online = !online
updateicon()
else if( href_list["input"] )
var/i = text2num(href_list["input"])
var/d = 0
switch(i)
if(-4)
chargelevel = 0
if(4)
chargelevel = SMESMAXCHARGELEVEL //30000
if(1)
d = 100
if(-1)
d = -100
if(2)
d = 1000
if(-2)
d = -1000
if(3)
d = 10000
if(-3)
d = -10000
chargelevel += d
chargelevel = max(0, min(SMESMAXCHARGELEVEL, chargelevel)) // clamp to range
else if( href_list["output"] )
var/i = text2num(href_list["output"])
var/d = 0
switch(i)
if(-4)
output = 0
if(4)
output = SMESMAXOUTPUT //30000
if(1)
d = 100
if(-1)
d = -100
if(2)
d = 1000
if(-2)
d = -1000
if(3)
d = 10000
if(-3)
d = -10000
output += d
output = max(0, min(SMESMAXOUTPUT, output)) // clamp to range
src.updateUsrDialog()
else
usr << browse(null, "window=smes")
usr.machine = null
return
else if( href_list["cmode"] )
chargemode = !chargemode
if(!chargemode)
charging = 0
updateicon()
else if( href_list["online"] )
online = !online
updateicon()
else if( href_list["input"] )
var/i = text2num(href_list["input"])
var/d = 0
switch(i)
if(-4)
chargelevel = 0
if(4)
chargelevel = SMESMAXCHARGELEVEL //30000
if(1)
d = 100
if(-1)
d = -100
if(2)
d = 1000
if(-2)
d = -1000
if(3)
d = 10000
if(-3)
d = -10000
chargelevel += d
chargelevel = max(0, min(SMESMAXCHARGELEVEL, chargelevel)) // clamp to range
else if( href_list["output"] )
var/i = text2num(href_list["output"])
var/d = 0
switch(i)
if(-4)
output = 0
if(4)
output = SMESMAXOUTPUT //30000
if(1)
d = 100
if(-1)
d = -100
if(2)
d = 1000
if(-2)
d = -1000
if(3)
d = 10000
if(-3)
d = -10000
output += d
output = max(0, min(SMESMAXOUTPUT, output)) // clamp to range
return
src.updateUsrDialog()
proc/ion_act()
if(src.z == 1)
if(prob(1)) //explosion
world << "\red SMES explosion in [src.loc.loc]"
for(var/mob/M in viewers(src))
M.show_message("\red The [src.name] is making strange noises!", 3, "\red You hear sizzling electronics.", 2)
sleep(10*pick(4,5,6,7,10,14))
var/datum/effect/effect/system/harmless_smoke_spread/smoke = new /datum/effect/effect/system/harmless_smoke_spread()
smoke.set_up(3, 0, src.loc)
smoke.attach(src)
smoke.start()
explosion(src.loc, -1, 0, 1, 3, 0)
del(src)
return
if(prob(15)) //Power drain
world << "\red SMES power drain in [src.loc.loc]"
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(3, 1, src)
s.start()
if(prob(50))
emp_act(1)
else
emp_act(2)
if(prob(5)) //smoke only
world << "\red SMES smoke in [src.loc.loc]"
var/datum/effect/effect/system/harmless_smoke_spread/smoke = new /datum/effect/effect/system/harmless_smoke_spread()
smoke.set_up(3, 0, src.loc)
smoke.attach(src)
smoke.start()
else
usr << browse(null, "window=smes")
usr.machine = null
return
emp_act(severity)
online = 0
charging = 0
output = 0
charge -= 1e6/severity
if (charge < 0)
charge = 0
spawn(100)
output = initial(output)
charging = initial(charging)
online = initial(online)
..()
/obj/machinery/power/smes/magical
name = "magical power storage unit"
desc = "A high-capacity superconducting magnetic energy storage (SMES) unit. Magically produces power."
process()
capacity = INFINITY
charge = INFINITY
..()
/obj/machinery/power/smes/proc/ion_act()
if(src.z == 1)
if(prob(1)) //explosion
world << "\red SMES explosion in [src.loc.loc]"
for(var/mob/M in viewers(src))
M.show_message("\red The [src.name] is making strange noises!", 3, "\red You hear sizzling electronics.", 2)
sleep(10*pick(4,5,6,7,10,14))
var/datum/effect/effect/system/harmless_smoke_spread/smoke = new /datum/effect/effect/system/harmless_smoke_spread()
smoke.set_up(3, 0, src.loc)
smoke.attach(src)
smoke.start()
explosion(src.loc, -1, 0, 1, 3, 0)
del(src)
return
if(prob(15)) //Power drain
world << "\red SMES power drain in [src.loc.loc]"
var/datum/effect/effect/system/spark_spread/s = new /datum/effect/effect/system/spark_spread
s.set_up(3, 1, src)
s.start()
if(prob(50))
emp_act(1)
else
emp_act(2)
if(prob(5)) //smoke only
world << "\red SMES smoke in [src.loc.loc]"
var/datum/effect/effect/system/harmless_smoke_spread/smoke = new /datum/effect/effect/system/harmless_smoke_spread()
smoke.set_up(3, 0, src.loc)
smoke.attach(src)
smoke.start()
/obj/machinery/power/smes/emp_act(severity)
online = 0
charging = 0
output = 0
charge -= 1e6/severity
if (charge < 0)
charge = 0
spawn(100)
output = initial(output)
charging = initial(charging)
online = initial(online)
..()
/proc/rate_control(var/S, var/V, var/C, var/Min=1, var/Max=5, var/Limit=null)
var/href = "<A href='?src=\ref[S];rate control=1;[V]"
var/rate = "[href]=-[Max]'>-</A>[href]=-[Min]'>-</A> [(C?C : 0)] [href]=[Min]'>+</A>[href]=[Max]'>+</A>"
if(Limit) return "[href]=-[Limit]'>-</A>"+rate+"[href]=[Limit]'>+</A>"
return rate