Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/tgstation/-tg-station int…
Browse files Browse the repository at this point in the history
…o hudicons
  • Loading branch information
Ikarrus committed May 16, 2013
2 parents 283c6b4 + 7e4730c commit 9a77def
Show file tree
Hide file tree
Showing 45 changed files with 575 additions and 349 deletions.
4 changes: 4 additions & 0 deletions code/controllers/configuration.dm
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,8 @@
var/silent_ai = 0
var/silent_borg = 0

var/sandbox_autoclose = 0 // close the sandbox panel after spawning an item, potentially reducing griff


/datum/configuration/New()
var/list/L = typesof(/datum/game_mode) - /datum/game_mode
Expand Down Expand Up @@ -340,6 +342,8 @@
config.silent_ai = 1
if("silent_borg")
config.silent_borg = 1
if("sandbox_autoclose")
config.sandbox_autoclose = 1
else
diary << "Unknown setting in configuration: '[name]'"

Expand Down
138 changes: 138 additions & 0 deletions code/game/gamemodes/sandbox/airlock_maker.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
/*
This is for the sandbox for now,
maybe useful later for an actual thing?
-Sayu
*/

obj/structure/door_assembly
var/datum/airlock_maker/maker = null

attack_hand()
..()
if(maker)
maker.interact()

datum/airlock_maker
var/obj/structure/door_assembly/linked = null

var/list/access_used = null
var/require_all = 1

var/paintjob = "none"
var/glassdoor = 0

var/doorname = "Airlock"

New(var/atom/target_loc)
linked = new(target_loc)
linked.maker = src
linked.anchored = 0
access_used = list()

interact()

proc/linkpretty(href,desc,active)
if(!desc)
var/static/list/defaults = list("No","Yes")
desc = defaults[active+1]
if(active)
return "<a href='?src=\ref[src];[href]'><b>[desc]</b></a>"
return "<a href='?src=\ref[src];[href]'><i>[desc]</i></a>"

proc/interact()
var/list/leftcolumn = list()
var/list/rightcolumn = list()
leftcolumn += "<u><b>Required Access</b></u>"
for(var/access in get_all_accesses())
leftcolumn += linkpretty("access=[access]",get_access_desc(access),access in access_used)
leftcolumn += "Require all listed accesses: [linkpretty("reqall",null,require_all)]"

rightcolumn += "<u><b>Paintjob</b></u>"
for(var/option in list("none","engineering","atmos","security","command","medical","research","mining","maintenance","external","highsecurity"))
rightcolumn += linkpretty("paint=[option]",option,option == paintjob)
rightcolumn += "Glass door: " + linkpretty("glass",null,glassdoor) + "<br><br>"
var/length = max(leftcolumn.len,rightcolumn.len)

var/dat = "You may move the model airlock around. A new airlock will be built in its space when you click done, below.<hr><br>"
dat += "<a href='?src=\ref[src];rename'>Door name</a>: \"[doorname]\""
dat += "<table>"
for(var/i=1; i<=length; i++)
dat += "<tr><td>"
if(i<=leftcolumn.len)
dat += leftcolumn[i]
dat += "</td><td>"
if(i<=rightcolumn.len)
dat += rightcolumn[i]
dat += "</td></tr>"

dat += "</table><hr><a href='?src=\ref[src];done'>Finalize Airlock Construction</a> | <a href='?src=\ref[src];cancel'>Cancel and Destroy Airlock</a>"
usr << browse(dat,"window=airlockmaker")

Topic(var/href,var/list/href_list)
if(!usr) return
if(!src || !linked || !linked.loc)
usr << browse(null,"window=airlockmaker")
return

if("rename" in href_list)
var/newname = input(usr,"New airlock name:","Name the airlock",doorname) as null|text
if(newname)
doorname = newname
if("access" in href_list)
var/value = text2num(href_list["access"])
access_used ^= value
if("reqall" in href_list)
require_all = !require_all
if("paint" in href_list)
paintjob = href_list["paint"]
if("glass" in href_list)
glassdoor = !glassdoor

if("cancel" in href_list)
usr << browse(null,"window=airlockmaker")
del linked
del src
return

if("done" in href_list)
usr << browse(null,"window=airlockmaker")
var/turf/t_loc = linked.loc
del linked
if(!istype(t_loc))
return

var/target_type = "/obj/machinery/door/airlock"
if(glassdoor)
if(paintjob != "none")
if(paintjob in list("external","highsecurity","maintenance")) // no glass version
target_type += "/[paintjob]"
else
target_type += "/glass_[paintjob]"
else
target_type += "/glass"
else if(paintjob != "none")
target_type += "/[paintjob]"
var/final = target_type
target_type = text2path(final)
if(!target_type)
usr << "Didn't work, contact Sayu with this: [final]"
usr << browse(null,"window=airlockmaker")
return

var/obj/machinery/door/D = new target_type(t_loc)

D.name = doorname

if(access_used.len == 0)
D.req_access = null
D.req_one_access = null
else if(require_all)
D.req_access = access_used.Copy()
D.req_one_access = null
else
D.req_access = null
D.req_one_access = access_used.Copy()

return

interact()
Loading

0 comments on commit 9a77def

Please sign in to comment.