This commit is contained in:
Ghommie
2020-02-04 03:54:52 +01:00
631 changed files with 38158 additions and 6475 deletions
+31 -21
View File
@@ -157,20 +157,23 @@
var/input = input(usr, "Enter [codelen] digits. All digits must be unique.", "Deca-Code Lock", "") as text
if(user.canUseTopic(src, BE_CLOSE))
var/list/sanitised = list()
var/sanitycheck = 1
for(var/i=1,i<=length(input),i++) //put the guess into a list
sanitised += text2num(copytext(input,i,i+1))
for(var/i=1,i<=(length(input)-1),i++) //compare each digit in the guess to all those following it
for(var/j=(i+1),j<=length(input),j++)
var/sanitycheck = TRUE
var/char = ""
var/length_input = length(input)
for(var/i = 1, i <= length_input, i += length(char)) //put the guess into a list
char = input[i]
sanitised += text2num(char)
for(var/i = 1, i <= length(sanitised) - 1, i++) //compare each digit in the guess to all those following it
for(var/j = i + 1, j <= length(sanitised), j++)
if(sanitised[i] == sanitised[j])
sanitycheck = null //if a digit is repeated, reject the input
if (input == code)
sanitycheck = FALSE //if a digit is repeated, reject the input
if(input == code)
to_chat(user, "<span class='notice'>The crate unlocks!</span>")
locked = FALSE
cut_overlays()
add_overlay("securecrateg")
tamperproof = 0 // set explosion chance to zero, so we dont accidently hit it with a multitool and instantly die
else if (input == null || sanitycheck == null || length(input) != codelen)
else if(!input || !sanitycheck || length(sanitised) != codelen)
to_chat(user, "<span class='notice'>You leave the crate alone.</span>")
else
to_chat(user, "<span class='warning'>A red light flashes.</span>")
@@ -196,20 +199,27 @@
else
to_chat(user, "<span class='notice'>* Anti-Tamper Bomb will activate after [attempts] failed access attempts.</span>")
if(lastattempt != null)
var/list/guess = list()
var/list/answer = list()
var/bulls = 0
var/cows = 0
for(var/i=1,i<=length(lastattempt),i++)
guess += text2num(copytext(lastattempt,i,i+1))
for(var/i=1,i<=length(lastattempt),i++)
answer += text2num(copytext(code,i,i+1))
for(var/i = 1, i < codelen + 1, i++) // Go through list and count matches
if( answer.Find(guess[i],1,codelen+1))
++cows
if( answer[i] == guess[i])
var/bulls = 0 //right position, right number
var/cows = 0 //wrong position but in the puzzle
var/lastattempt_char = ""
var/length_lastattempt = length(lastattempt)
var/lastattempt_it = 1
var/code_char = ""
var/length_code = length(code)
var/code_it = 1
while(lastattempt_it <= length_lastattempt && code_it <= length_code) // Go through list and count matches
lastattempt_char = lastattempt[lastattempt_it]
code_char = code[code_it]
if(lastattempt_char == code_char)
++bulls
--cows
else if(findtext(code, lastattempt_char))
++cows
lastattempt_it += length(lastattempt_char)
code_it += length(code_char)
to_chat(user, "<span class='notice'>Last code attempt, [lastattempt], had [bulls] correct digits at correct positions and [cows] correct digits at incorrect positions.</span>")
return
+12 -7
View File
@@ -36,7 +36,7 @@ GLOBAL_LIST(labor_sheet_values)
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "labor_claim_console", name, 450, 475, master_ui, state)
ui = new(user, src, ui_key, "labor_claim_console", name, 315, 430, master_ui, state)
ui.open()
/obj/machinery/mineral/labor_claim_console/ui_data(mob/user)
@@ -47,7 +47,6 @@ GLOBAL_LIST(labor_sheet_values)
if(obj_flags & EMAGGED)
can_go_home = TRUE
data["status_info"] = "No Prisoner ID detected."
var/obj/item/card/id/I = user.get_idcard(TRUE)
if(istype(I, /obj/item/card/id/prisoner))
var/obj/item/card/id/prisoner/P = I
@@ -57,6 +56,9 @@ GLOBAL_LIST(labor_sheet_values)
data["status_info"] = "Goal met!"
else
data["status_info"] = "You are [(P.goal - P.points)] points away."
else
data["status_info"] = "No Prisoner ID detected."
data["id_points"] = 0
if(stacking_machine)
data["unclaimed_points"] = stacking_machine.points
@@ -78,24 +80,27 @@ GLOBAL_LIST(labor_sheet_values)
P.points += stacking_machine.points
stacking_machine.points = 0
to_chat(usr, "<span class='notice'>Points transferred.</span>")
. = TRUE
else
to_chat(usr, "<span class='notice'>No valid id for point transfer detected.</span>")
to_chat(usr, "<span class='alert'>No valid id for point transfer detected.</span>")
if("move_shuttle")
if(!alone_in_area(get_area(src), usr))
to_chat(usr, "<span class='warning'>Prisoners are only allowed to be released while alone.</span>")
to_chat(usr, "<span class='alert'>Prisoners are only allowed to be released while alone.</span>")
else
switch(SSshuttle.moveShuttle("laborcamp", "laborcamp_home", TRUE))
if(1)
to_chat(usr, "<span class='notice'>Shuttle not found.</span>")
to_chat(usr, "<span class='alert'>Shuttle not found.</span>")
if(2)
to_chat(usr, "<span class='notice'>Shuttle already at station.</span>")
to_chat(usr, "<span class='alert'>Shuttle already at station.</span>")
if(3)
to_chat(usr, "<span class='notice'>No permission to dock could be granted.</span>")
to_chat(usr, "<span class='alert'>No permission to dock could be granted.</span>")
else
if(!(obj_flags & EMAGGED))
Radio.set_frequency(FREQ_SECURITY)
Radio.talk_into(src, "A prisoner has returned to the station. Minerals and Prisoner ID card ready for retrieval.", FREQ_SECURITY)
to_chat(usr, "<span class='notice'>Shuttle received message and will be sent shortly.</span>")
. = TRUE
/obj/machinery/mineral/labor_claim_console/proc/locate_stacking_machine()
stacking_machine = locate(/obj/machinery/mineral/stacking_machine, get_step(src, machinedir))
@@ -223,6 +223,7 @@
data["disconnected"] = "mineral withdrawal is on hold"
data["diskDesigns"] = list()
data["hasDisk"] = FALSE
if(inserted_disk)
data["hasDisk"] = TRUE
if(inserted_disk.blueprints.len)
+3 -2
View File
@@ -201,7 +201,7 @@ GLOBAL_LIST_EMPTY(silo_access_logs)
var/list/materials
/datum/ore_silo_log/New(obj/machinery/M, _action, _amount, _noun, list/mats=list())
timestamp = STATION_TIME_TIMESTAMP("hh:mm:ss")
timestamp = STATION_TIME_TIMESTAMP("hh:mm:ss", world.time)
machine_name = M.name
area_name = get_area_name(M, TRUE)
action = _action
@@ -231,8 +231,9 @@ GLOBAL_LIST_EMPTY(silo_access_logs)
var/list/msg = list("([timestamp]) <b>[machine_name]</b> in [area_name]<br>[action] [abs(amount)]x [noun]<br>")
var/sep = ""
for(var/key in materials)
var/datum/material/M = key
var/val = round(materials[key]) / MINERAL_MATERIAL_AMOUNT
msg += sep
sep = ", "
msg += "[amount < 0 ? "-" : "+"][val] [copytext(key, 2)]"
msg += "[amount < 0 ? "-" : "+"][val] [M.name]"
formatted = msg.Join()
+30 -21
View File
@@ -32,7 +32,7 @@
/obj/structure/ore_box/examine(mob/living/user)
if(Adjacent(user) && istype(user))
show_contents(user)
ui_interact(user)
return ..()
/obj/structure/ore_box/attack_hand(mob/user)
@@ -40,22 +40,11 @@
if(.)
return
if(Adjacent(user))
show_contents(user)
ui_interact(user)
/obj/structure/ore_box/attack_robot(mob/user)
if(Adjacent(user))
show_contents(user)
/obj/structure/ore_box/proc/show_contents(mob/user)
var/dat = text("<b>The contents of the ore box reveal...</b><br>")
var/list/assembled = list()
for(var/obj/item/stack/ore/O in src)
assembled[O.type] += O.amount
for(var/type in assembled)
var/obj/item/stack/ore/O = type
dat += "[initial(O.name)] - [assembled[type]]<br>"
dat += text("<br><br><A href='?src=[REF(src)];removeall=1'>Empty box</A>")
user << browse(dat, "window=orebox")
ui_interact(user)
/obj/structure/ore_box/proc/dump_box_contents()
var/drop = drop_location()
@@ -69,18 +58,38 @@
stoplag()
drop = drop_location()
/obj/structure/ore_box/Topic(href, href_list)
/obj/structure/ore_box/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = FALSE, \
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
ui = new(user, src, ui_key, "ore_box", name, 335, 415, master_ui, state)
ui.open()
/obj/structure/ore_box/ui_data()
var/contents = list()
for(var/obj/item/stack/ore/O in src)
contents[O.type] += O.amount
var/data = list()
data["materials"] = list()
for(var/type in contents)
var/obj/item/stack/ore/O = type
var/name = initial(O.name)
data["materials"] += list(list("name" = name, "amount" = contents[type], "id" = type))
return data
/obj/structure/ore_box/ui_act(action, params)
if(..())
return
if(!Adjacent(usr))
return
usr.set_machine(src)
add_fingerprint(usr)
if(href_list["removeall"])
dump_box_contents()
to_chat(usr, "<span class='notice'>You open the release hatch on the box..</span>")
updateUsrDialog()
usr.set_machine(src)
switch(action)
if("removeall")
dump_box_contents()
to_chat(usr, "<span class='notice'>You open the release hatch on the box..</span>")
/obj/structure/ore_box/deconstruct(disassembled = TRUE, mob/user)
var/obj/item/stack/sheet/mineral/wood/WD = new (loc, 4)