Bluespace artillery computer update, accounts database computer update, ghost machinery interaction update

This commit is contained in:
Markolie
2015-08-14 06:26:40 +02:00
parent eea1921897
commit 5e95ae82b4
23 changed files with 228 additions and 175 deletions
+54 -54
View File
@@ -1,15 +1,59 @@
/obj/machinery/artillerycontrol
var/reload = 180
/obj/machinery/computer/artillerycontrol
name = "bluespace artillery control"
icon_state = "control_boxp1"
icon = 'icons/obj/machines/particle_accelerator.dmi'
density = 1
anchored = 1
icon_screen = "accelerator"
icon_keyboard = "accelerator_key"
icon_state = "computer_wires"
req_access = list(access_cent_commander)
var/last_fire = 0
var/reload_cooldown = 180 // 3 minute cooldown
light_color = LIGHT_COLOR_LIGHTBLUE
/obj/machinery/artillerycontrol/process()
if(src.reload<180)
src.reload++
/obj/machinery/computer/artillerycontrol/attack_ai(user as mob)
user << "<span class='warning'>Access denied.</span>"
return
/obj/machinery/computer/artillerycontrol/attack_hand(user as mob)
ui_interact(user)
/obj/machinery/computer/artillerycontrol/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
var/data[0]
var/time_to_wait = round(reload_cooldown - ((world.time / 10) - last_fire), 1)
var/mins = round(time_to_wait / 60)
var/seconds = time_to_wait - (60*mins)
data["reloadtime_mins"] = mins
data["reloadtime_secs"] = (seconds < 10) ? "0[seconds]" : seconds
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "bluespace_artillery.tmpl", "Bluespace Control", 400, 260)
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
/obj/machinery/computer/artillerycontrol/Topic(href, href_list)
if(..())
return 1
var/A
A = input("Area to jump bombard", "Open Fire", A) in teleportlocs
var/area/thearea = teleportlocs[A]
if(..() || !istype(thearea))
return
var/delta = (world.time / 10) - last_fire
if(reload_cooldown > delta)
return 1
command_announcement.Announce("Bluespace artillery fire detected. Brace for impact.")
message_admins("[key_name_admin(usr)] has launched an artillery strike.", 1)
var/list/L = list()
for(var/turf/T in get_area_turfs(thearea.type))
L+=T
var/loc = pick(L)
explosion(loc,2,5,11)
last_fire = world.time / 10
/obj/structure/artilleryplaceholder
name = "artillery"
@@ -19,47 +63,3 @@
/obj/structure/artilleryplaceholder/decorative
density = 0
/obj/machinery/artillerycontrol/attack_hand(mob/user as mob)
user.set_machine(src)
var/dat = "<B>Bluespace Artillery Control:</B><BR>"
dat += "Locked on<BR>"
dat += "<B>Charge progress: [reload]/180:</B><BR>"
dat += "<A href='byond://?src=\ref[src];fire=1'>Open Fire</A><BR>"
dat += "Deployment of weapon authorized by <br>Nanotrasen Naval Command<br><br>Remember, friendly fire is grounds for termination of your contract and life.<HR>"
user << browse(dat, "window=scroll")
onclose(user, "scroll")
return
/obj/machinery/artillerycontrol/Topic(href, href_list)
..()
if (usr.stat || usr.restrained())
return
if ((usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon)))
var/A
A = input("Area to jump bombard", "Open Fire", A) in teleportlocs
var/area/thearea = teleportlocs[A]
if (usr.stat || usr.restrained()) return
if(src.reload < 180) return
if ((usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf))) || (istype(usr, /mob/living/silicon)))
command_announcement.Announce("Bluespace artillery fire detected. Brace for impact.")
message_admins("[key_name_admin(usr)] has launched an artillery strike.", 1)
var/list/L = list()
for(var/turf/T in get_area_turfs(thearea.type))
L+=T
var/loc = pick(L)
explosion(loc,2,5,11)
reload = 0
/*mob/proc/openfire()
var/A
A = input("Area to jump bombard", "Open Fire", A) in teleportlocs
var/area/thearea = teleportlocs[A]
command_announcement.Announce("Bluespace artillery fire detected. Brace for impact.")
spawn(30)
var/list/L = list()
for(var/turf/T in get_area_turfs(thearea.type))
L+=T
var/loc = pick(L)
explosion(loc,2,5,11)*/
+2 -2
View File
@@ -23,7 +23,7 @@ log transactions
anchored = 1
use_power = 1
idle_power_usage = 10
var/obj/machinery/account_database/linked_db
var/obj/machinery/computer/account_database/linked_db
var/datum/money_account/authenticated_account
var/number_incorrect_tries = 0
var/previous_account_number = 0
@@ -80,7 +80,7 @@ log transactions
authenticated_account.charge(-amount,null,"Credit deposit",terminal_id=machine_id,dest_name = "Terminal")
/obj/machinery/atm/proc/reconnect_database()
for(var/obj/machinery/account_database/DB in world) //Hotfix until someone finds out why it isn't in 'machines'
for(var/obj/machinery/computer/account_database/DB in world) //Hotfix until someone finds out why it isn't in 'machines'
if( DB.z == src.z && !(DB.stat & NOPOWER) && DB.activated )
linked_db = DB
break
+4 -4
View File
@@ -3,7 +3,7 @@ var/global/num_financial_terminals = 1
var/global/datum/money_account/station_account
var/global/list/datum/money_account/department_accounts = list()
var/global/next_account_number = 0
var/global/obj/machinery/account_database/centcomm_account_db
var/global/obj/machinery/computer/account_database/centcomm_account_db
var/global/datum/money_account/vendor_account
var/global/list/all_money_accounts = list()
@@ -57,7 +57,7 @@ var/global/list/all_money_accounts = list()
//the current ingame time (hh:mm) can be obtained by calling:
//worldtime2text()
/proc/create_account(var/new_owner_name = "Default user", var/starting_funds = 0, var/obj/machinery/account_database/source_db)
/proc/create_account(var/new_owner_name = "Default user", var/starting_funds = 0, var/obj/machinery/computer/account_database/source_db)
//create a new account
var/datum/money_account/M = new()
@@ -336,7 +336,7 @@ var/global/list/all_money_accounts = list()
src.attack_hand(usr)
*/
/obj/machinery/account_database/proc/charge_to_account(var/attempt_account_number, var/source_name, var/purpose, var/terminal_id, var/amount)
/obj/machinery/computer/account_database/proc/charge_to_account(var/attempt_account_number, var/source_name, var/purpose, var/terminal_id, var/amount)
if(!activated)
return 0
for(var/datum/money_account/D in all_money_accounts)
@@ -367,7 +367,7 @@ var/global/list/all_money_accounts = list()
if( D.security_level <= security_level_passed && (!D.security_level || D.remote_access_pin == attempt_pin_number || !pin_needed) )
return D
/obj/machinery/account_database/proc/get_account(var/account_number)
/obj/machinery/computer/account_database/proc/get_account(var/account_number)
for(var/datum/money_account/D in all_money_accounts)
if(D.account_number == account_number)
return D
+56 -50
View File
@@ -1,9 +1,8 @@
/obj/machinery/account_database
name = "Accounts uplink terminal"
/obj/machinery/computer/account_database
name = "Accounts Uplink Terminal"
desc = "Access transaction logs, account data and all kinds of other financial records."
icon = 'icons/obj/computer.dmi'
icon_state = "aiupload"
icon_screen = "accounts"
density = 1
req_one_access = list(access_hop, access_captain, access_cent_commander)
var/receipt_num
@@ -12,34 +11,38 @@
var/datum/money_account/detailed_account_view
var/creating_new_account = 0
var/activated = 1
light_color = LIGHT_COLOR_GREEN
proc/get_access_level()
if (!held_card)
return 0
if(access_cent_commander in held_card.access)
return 2
else if(access_hop in held_card.access || access_captain in held_card.access)
return 1
/obj/machinery/computer/account_database/proc/get_access_level(user as mob)
if(isobserver(user) && check_rights(R_ADMIN, 0, user))
return 2
if (!held_card)
return 0
if(access_cent_commander in held_card.access)
return 2
else if(access_hop in held_card.access || access_captain in held_card.access)
return 1
proc/create_transation(target, reason, amount)
var/datum/transaction/T = new()
T.target_name = target
T.purpose = reason
T.amount = amount
T.date = current_date_string
T.time = worldtime2text()
T.source_terminal = machine_id
return T
/obj/machinery/computer/account_database/proc/create_transation(target, reason, amount)
var/datum/transaction/T = new()
T.target_name = target
T.purpose = reason
T.amount = amount
T.date = current_date_string
T.time = worldtime2text()
T.source_terminal = machine_id
return T
proc/accounting_letterhead(report_name)
return {"
<center><h1><b>[report_name]</b></h1></center>
<center><small><i>[station_name()] Accounting Report</i></small></center>
<hr>
<u>Generated By:</u> [held_card.registered_name], [held_card.assignment]<br>
"}
/obj/machinery/computer/account_database/proc/accounting_letterhead(report_name)
return {"
<center><h1><b>[report_name]</b></h1></center>
<center><small><i>[station_name()] Accounting Report</i></small></center>
<hr>
<u>Generated By:</u> [held_card.registered_name], [held_card.assignment]<br>
"}
/obj/machinery/account_database/New()
/obj/machinery/computer/account_database/New()
if(!station_account)
create_station_account()
@@ -56,7 +59,7 @@
machine_id = "[station_name()] Acc. DB #[num_financial_terminals++]"
..()
/obj/machinery/account_database/attackby(obj/O, mob/user, params)
/obj/machinery/computer/account_database/attackby(obj/O, mob/user, params)
if(!istype(O, /obj/item/weapon/card/id))
return ..()
@@ -69,18 +72,17 @@
attack_hand(user)
/obj/machinery/account_database/attack_hand(mob/user as mob)
if(stat & (NOPOWER|BROKEN)) return
/obj/machinery/computer/account_database/attack_hand(mob/user as mob)
ui_interact(user)
/obj/machinery/account_database/ui_interact(mob/user, ui_key="main", var/datum/nanoui/ui = null, var/force_open = 1)
/obj/machinery/computer/account_database/ui_interact(mob/user, ui_key="main", var/datum/nanoui/ui = null, var/force_open = 1)
user.set_machine(src)
var/data[0]
data["src"] = "\ref[src]"
data["id_inserted"] = !!held_card
data["id_card"] = held_card ? text("[held_card.registered_name], [held_card.assignment]") : "-----"
data["access_level"] = get_access_level()
data["access_level"] = get_access_level(user)
data["machine_id"] = machine_id
data["creating_new_account"] = creating_new_account
data["detailed_account_view"] = !!detailed_account_view
@@ -124,10 +126,29 @@
ui = new(user, src, ui_key, "accounts_terminal.tmpl", src.name, 400, 640)
ui.set_initial_data(data)
ui.open()
/obj/machinery/account_database/Topic(href, href_list)
/obj/machinery/computer/account_database/Topic(href, href_list)
if(..())
return 1
if("insert_card")
if(held_card)
held_card.loc = src.loc
if(ishuman(usr) && !usr.get_active_hand())
usr.put_in_hands(held_card)
held_card = null
else
var/obj/item/I = usr.get_active_hand()
if (istype(I, /obj/item/weapon/card/id))
var/obj/item/weapon/card/id/C = I
usr.drop_item()
C.loc = src
held_card = C
if(!get_access_level(usr))
return 1
var/datum/nanoui/ui = nanomanager.get_open_ui(usr, src, "main")
@@ -167,21 +188,6 @@
ui.close()
creating_new_account = 0
if("insert_card")
if(held_card)
held_card.loc = src.loc
if(ishuman(usr) && !usr.get_active_hand())
usr.put_in_hands(held_card)
held_card = null
else
var/obj/item/I = usr.get_active_hand()
if (istype(I, /obj/item/weapon/card/id))
var/obj/item/weapon/card/id/C = I
usr.drop_item()
C.loc = src
held_card = C
if("view_account_detail")
var/index = text2num(href_list["account_index"])
+2 -2
View File
@@ -10,7 +10,7 @@
var/transaction_amount = 0
var/transaction_purpose = "Default charge"
var/access_code = 0
var/obj/machinery/account_database/linked_db
var/obj/machinery/computer/account_database/linked_db
var/datum/money_account/linked_account
/obj/item/device/eftpos/New()
@@ -53,7 +53,7 @@
if(!location)
return
for(var/obj/machinery/account_database/DB in world) //Hotfix until someone finds out why it isn't in 'machines'
for(var/obj/machinery/computer/account_database/DB in world) //Hotfix until someone finds out why it isn't in 'machines'
if(DB.z == location.z)
linked_db = DB
break
+1 -1
View File
@@ -5,7 +5,7 @@
////////////////////////
/proc/get_money_account(var/account_number, var/from_z=-1)
for(var/obj/machinery/account_database/DB in world)
for(var/obj/machinery/computer/account_database/DB in world)
if(from_z > -1 && DB.z != from_z) continue
if((DB.stat & NOPOWER) || !DB.activated ) continue
var/datum/money_account/acct = DB.get_account(account_number)
+16 -22
View File
@@ -750,7 +750,7 @@
return
var/list/data = list(
"locked" = locked,
"locked" = is_locked(user),
"isOperating" = operating,
"externalPower" = main_status,
"powerCellStatus" = cell ? cell.percent() : null,
@@ -799,7 +799,7 @@
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
// the ui does not exist, so we'll create a new one
ui = new(user, src, ui_key, "apc.tmpl", "[area.name] - APC", 500, data["siliconUser"] ? 465 : 390)
ui = new(user, src, ui_key, "apc.tmpl", "[area.name] - APC", 510, data["siliconUser"] ? 465 : 390)
// When the UI is first opened this is the data it will use
ui.set_initial_data(data)
ui.open()
@@ -834,25 +834,9 @@
/obj/machinery/power/apc/proc/can_use(mob/user as mob, var/loud = 0) //used by attack_hand() and Topic()
if (user.stat && !isobserver(user))
user << "<span class='warning'>You must be conscious to use this [src]!</span>"
return 0
if(stat & (NOPOWER|BROKEN))
return 0
if(!user.client)
return 0
if(!user.IsAdvancedToolUser())
return 0
if ( ! (istype(user, /mob/living/carbon/human) || \
istype(user, /mob/living/silicon)))
user << "<span class='warning'>You don't have the dexterity to use this [src]!</span>"
return 0
if(user.restrained())
user << "<span class='warning'>You must have free hands to use this [src]</span>"
return 0
if(user.lying)
user << "<span class='warning'>You must stand to use this [src]!</span>"
return 0
if(isobserver(user) && check_rights(R_ADMIN, 0, user))
return 1
autoflag = 5
if (istype(user, /mob/living/silicon))
var/mob/living/silicon/ai/AI = user
@@ -886,10 +870,20 @@
return 1
/obj/machinery/power/apc/proc/is_authenticated(mob/user as mob)
if(isAI(user) || isrobot(user))
if(isobserver(user) && check_rights(R_ADMIN, 0, user))
return 1
if(isAI(user))
return 1
else
return !locked
/obj/machinery/power/apc/proc/is_locked(mob/user as mob)
if(isobserver(user) && check_rights(R_ADMIN, 0, user))
return 0
if(isAI(user))
return 0
else
return locked
/obj/machinery/power/apc/Topic(href, href_list, var/usingUI = 1)
if(..())
+1 -1
View File
@@ -262,7 +262,7 @@
ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
if (!ui)
ui = new(user, src, ui_key, "disposal_bin.tmpl", "Waste Disposal Unit", 375, 250)
ui = new(user, src, ui_key, "disposal_bin.tmpl", "Waste Disposal Unit", 395, 250)
ui.set_initial_data(data)
ui.open()
ui.set_auto_update(1)
+2 -2
View File
@@ -13,8 +13,8 @@
if(..(user))
return
if(!allowed(user))
user << "\red Access Denied."
if(!allowed(user) && !isobserver(user))
user << "<span class='warning'>Access Denied.</span>"
return 1
ui_interact(user)
+2 -2
View File
@@ -56,8 +56,8 @@
if(..(user))
return 1
if(!allowed(user))
user << "\red Access Denied."
if(!allowed(user) && !isobserver(user))
user << "<span class='warning'>Access Denied.</span>"
return 1
ui_interact(user)
+2 -2
View File
@@ -22,7 +22,7 @@ var/global/datum/store/centcomm_store=new
var/list/datum/storeitem/items=list()
var/list/datum/storeorder/orders=list()
var/obj/machinery/account_database/linked_db
var/obj/machinery/computer/account_database/linked_db
/datum/store/New()
for(var/itempath in subtypesof(/datum/storeitem))
@@ -47,7 +47,7 @@ var/global/datum/store/centcomm_store=new
return 1
/datum/store/proc/reconnect_database()
for(var/obj/machinery/account_database/DB in world)
for(var/obj/machinery/computer/account_database/DB in world)
if((DB.z in config.station_levels))
linked_db = DB
break