mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-20 20:45:28 +01:00
improvements and fixes.
This commit is contained in:
@@ -491,7 +491,10 @@
|
||||
if(!battery_module.check_functionality())
|
||||
power_failure(1)
|
||||
return
|
||||
battery_module.battery.use(power_usage * CELLRATE)
|
||||
if(!battery_module.battery.use(power_usage * CELLRATE))
|
||||
battery_module.battery.charge = 0
|
||||
power_failure()
|
||||
return 0
|
||||
|
||||
last_power_usage = power_usage
|
||||
|
||||
|
||||
@@ -121,12 +121,13 @@ var/list/global_modular_computers = list()
|
||||
|
||||
// Called by cpu item's process() automatically, handles our power interaction.
|
||||
/obj/machinery/modular_computer/proc/handle_power()
|
||||
if(cpu.battery_module && cpu.battery_module.battery.charge <= 0) // Battery-run but battery is depleted.
|
||||
power_failure()
|
||||
return 0
|
||||
else if(!cpu.battery_module && (!powered() || !tesla_link || !tesla_link.enabled || !tesla_link.check_functionality())) // Not battery run, but lacking APC connection.
|
||||
power_failure()
|
||||
return 0
|
||||
if(!check_external_power())
|
||||
if(cpu.battery_module && cpu.battery_module.battery.charge <= 0)// Battery-run but battery is depleted.
|
||||
power_failure()
|
||||
return 0
|
||||
else if(!cpu.battery_module) // Not battery run, but lacking APC connection.
|
||||
power_failure()
|
||||
return 0
|
||||
else if(stat & NOPOWER)
|
||||
stat &= ~NOPOWER
|
||||
|
||||
@@ -153,7 +154,9 @@ var/list/global_modular_computers = list()
|
||||
if(cpu.battery_module && powered() && (use_power == 2)) // Battery charging itself
|
||||
cpu.battery_module.battery.give(100 * CELLRATE)
|
||||
else if(cpu.battery_module && !powered()) // Unpowered, but battery covers the usage.
|
||||
cpu.battery_module.battery.use(idle_power_usage * CELLRATE)
|
||||
if(!cpu.battery_module.battery.use(idle_power_usage * CELLRATE))
|
||||
cpu.battery_module.battery.charge = 0
|
||||
power_failure()
|
||||
|
||||
else // No wireless connection run only on battery.
|
||||
use_power = 0
|
||||
@@ -161,7 +164,9 @@ var/list/global_modular_computers = list()
|
||||
if(!cpu.battery_module.check_functionality())
|
||||
power_failure(1)
|
||||
return
|
||||
cpu.battery_module.battery.use(power_usage * CELLRATE)
|
||||
if(!cpu.battery_module.battery.use(power_usage * CELLRATE))
|
||||
cpu.battery_module.battery.charge = 0
|
||||
power_failure()
|
||||
cpu.last_power_usage = power_usage
|
||||
|
||||
// Modular computers can have battery in them, we handle power in previous proc, so prevent this from messing it up for us.
|
||||
@@ -195,4 +200,8 @@ var/list/global_modular_computers = list()
|
||||
cpu.bullet_act(Proj)
|
||||
|
||||
|
||||
|
||||
/obj/machinery/modular_computer/proc/check_external_power()
|
||||
if((!powered() || !tesla_link || !tesla_link.enabled || !tesla_link.check_functionality()))
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
@@ -68,7 +68,7 @@
|
||||
// Check if the user can run program. Only humans can operate computer. Automatically called in run_program()
|
||||
// User has to wear their ID for ID Scan to work.
|
||||
// Can also be called manually, with optional parameter being access_to_check to scan the user's ID
|
||||
/datum/computer_file/program/proc/can_run(mob/living/user, loud = 0, access_to_check, transfer = 0)
|
||||
/datum/computer_file/program/proc/can_run(mob/user, loud = 0, access_to_check, transfer = 0)
|
||||
// Defaults to required_access
|
||||
if(!access_to_check)
|
||||
if(transfer && transfer_access)
|
||||
@@ -81,6 +81,9 @@
|
||||
if(computer_emagged && !transfer) //emags can bypass the execution locks but not the download ones.
|
||||
return 1
|
||||
|
||||
if(IsAdminGhost(user))
|
||||
return 1
|
||||
|
||||
if(issilicon(user))
|
||||
return 1
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@
|
||||
var/show_assignments = 0
|
||||
var/minor = 0
|
||||
var/authenticated = 0
|
||||
var/list/reg_ids = list()
|
||||
var/list/region_access = null
|
||||
var/list/head_subordinates = null
|
||||
var/target_dept = 0 //Which department this computer has access to. 0=all departments
|
||||
@@ -266,6 +267,14 @@
|
||||
time_last_changed_position = world.time / 10
|
||||
j.total_positions--
|
||||
opened_positions[edit_job_target]--
|
||||
if("PRG_regsel")
|
||||
if(!reg_ids)
|
||||
reg_ids = list()
|
||||
var/regsel = text2num(params["region"])
|
||||
if(regsel in reg_ids)
|
||||
reg_ids -= regsel
|
||||
else
|
||||
reg_ids += regsel
|
||||
|
||||
if(id_card)
|
||||
id_card.name = text("[id_card.registered_name]'s ID Card ([id_card.assignment])")
|
||||
@@ -351,13 +360,15 @@
|
||||
data["id_owner"] = id_card && id_card.registered_name ? html_encode(id_card.registered_name) : "-----"
|
||||
data["id_name"] = id_card ? strip_html_simple(id_card.name) : "-----"
|
||||
|
||||
data["engineering_jobs"] = format_jobs(engineering_positions)
|
||||
data["medical_jobs"] = format_jobs(medical_positions)
|
||||
data["science_jobs"] = format_jobs(science_positions)
|
||||
data["security_jobs"] = format_jobs(security_positions)
|
||||
data["cargo_jobs"] = format_jobs(supply_positions)
|
||||
data["civilian_jobs"] = format_jobs(civilian_positions)
|
||||
data["centcom_jobs"] = format_jobs(get_all_centcom_jobs())
|
||||
if(show_assignments)
|
||||
data["engineering_jobs"] = format_jobs(engineering_positions)
|
||||
data["medical_jobs"] = format_jobs(medical_positions)
|
||||
data["science_jobs"] = format_jobs(science_positions)
|
||||
data["security_jobs"] = format_jobs(security_positions)
|
||||
data["cargo_jobs"] = format_jobs(supply_positions)
|
||||
data["civilian_jobs"] = format_jobs(civilian_positions)
|
||||
data["centcom_jobs"] = format_jobs(get_all_centcom_jobs())
|
||||
|
||||
|
||||
if(computer.card_slot.stored_card)
|
||||
var/obj/item/weapon/card/id/id_card = computer.card_slot.stored_card
|
||||
@@ -374,16 +385,20 @@
|
||||
for(var/i = 1; i <= 7; i++)
|
||||
if((minor || target_dept) && !(i in region_access))
|
||||
continue
|
||||
|
||||
var/list/accesses = list()
|
||||
for(var/access in get_region_accesses(i))
|
||||
if (get_access_desc(access))
|
||||
accesses.Add(list(list(
|
||||
if(i in reg_ids)
|
||||
for(var/access in get_region_accesses(i))
|
||||
if (get_access_desc(access))
|
||||
accesses.Add(list(list(
|
||||
"desc" = replacetext(get_access_desc(access), " ", " "),
|
||||
"ref" = access,
|
||||
"allowed" = (access in id_card.access) ? 1 : 0)))
|
||||
|
||||
regions.Add(list(list(
|
||||
"name" = get_region_accesses_name(i),
|
||||
"regid" = i,
|
||||
"selected" = (i in reg_ids) ? 1 : null,
|
||||
"accesses" = accesses)))
|
||||
data["regions"] = regions
|
||||
|
||||
@@ -453,4 +468,4 @@
|
||||
head_subordinates = list()
|
||||
for(var/datum/job/job in SSjob.occupations)
|
||||
if(rank in job.department_head)
|
||||
head_subordinates += job.title
|
||||
head_subordinates += job.title
|
||||
|
||||
@@ -63,7 +63,7 @@
|
||||
/obj/item/weapon/computer_hardware/battery_module/New()
|
||||
battery = new/obj/item/weapon/stock_parts/cell(src)
|
||||
battery.maxcharge = battery_rating
|
||||
battery.charge = 0
|
||||
battery.charge = battery.maxcharge/2
|
||||
..()
|
||||
|
||||
/obj/item/weapon/computer_hardware/battery_module/proc/charge_to_full()
|
||||
|
||||
Reference in New Issue
Block a user