mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-13 00:55:20 +01:00
Modular computer fixes and improvements 2 (#20170)
* Fixes runtime with can_run * tr
This commit is contained in:
@@ -19,3 +19,11 @@
|
||||
install_component(new /obj/item/weapon/computer_hardware/network_card)
|
||||
install_component(new /obj/item/weapon/computer_hardware/card_slot)
|
||||
install_component(new /obj/item/weapon/computer_hardware/printer/mini)
|
||||
|
||||
/obj/item/device/modular_computer/tablet/preset/cargo/New()
|
||||
. = ..()
|
||||
install_component(new /obj/item/weapon/computer_hardware/processor_unit/small)
|
||||
install_component(new /obj/item/weapon/computer_hardware/battery(src, /obj/item/weapon/stock_parts/cell/computer))
|
||||
install_component(new /obj/item/weapon/computer_hardware/hard_drive/small)
|
||||
install_component(new /obj/item/weapon/computer_hardware/network_card)
|
||||
install_component(new /obj/item/weapon/computer_hardware/printer/mini)
|
||||
|
||||
@@ -77,7 +77,7 @@
|
||||
if(!access_to_check) // No required_access, allow it.
|
||||
return 1
|
||||
|
||||
if(computer.emagged && !transfer) //emags can bypass the execution locks but not the download ones.
|
||||
if(!transfer && computer && computer.emagged) //emags can bypass the execution locks but not the download ones.
|
||||
return 1
|
||||
|
||||
if(IsAdminGhost(user))
|
||||
|
||||
@@ -170,7 +170,7 @@ var/global/nttransfer_uid = 0
|
||||
data["uploading"] = 1
|
||||
data["upload_uid"] = unique_token
|
||||
data["upload_clients"] = connected_clients.len
|
||||
data["haspassword"] = server_password ? 1 : 0
|
||||
data["upload_haspassword"] = server_password ? 1 : 0
|
||||
data["upload_filename"] = "[provided_file.filename].[provided_file.filetype]"
|
||||
else if (upload_menu)
|
||||
var/list/all_files[0]
|
||||
|
||||
@@ -178,6 +178,9 @@
|
||||
if("clean_order")
|
||||
reset_order()
|
||||
return 1
|
||||
if("purchase")
|
||||
try_purchase()
|
||||
return 1
|
||||
if((state != 1) && devtype) // Following IFs should only be usable when in the Select Loadout mode
|
||||
return 0
|
||||
switch(action)
|
||||
@@ -240,38 +243,21 @@ obj/machinery/lapvend/attackby(obj/item/I as obj, mob/user as mob)
|
||||
if(!user.drop_item(c))
|
||||
return
|
||||
credits += c.value
|
||||
visible_message("<span class='info'><span class='name'>[usr]</span> inserts [c.value] credits into the [src].</span>")
|
||||
qdel(c)
|
||||
return
|
||||
|
||||
|
||||
var/obj/item/weapon/card/id/D = I.GetID()
|
||||
// Awaiting payment state
|
||||
if(state == 2 && D)
|
||||
if(process_payment(D,I))
|
||||
fabricate_and_recalc_price(1)
|
||||
if((devtype == 1) && fabricated_laptop)
|
||||
fabricated_laptop.forceMove(src.loc)
|
||||
fabricated_laptop = null
|
||||
else if((devtype == 2) && fabricated_tablet)
|
||||
fabricated_tablet.forceMove(src.loc)
|
||||
fabricated_tablet = null
|
||||
say("Enjoy your new product!")
|
||||
state = 3
|
||||
return 1
|
||||
return 0
|
||||
return ..()
|
||||
|
||||
|
||||
// Simplified payment processing, returns 1 on success.
|
||||
/obj/machinery/lapvend/proc/process_payment(obj/item/weapon/card/id/I, obj/item/ID_container, obj/item/stack/spacecash)
|
||||
/obj/machinery/lapvend/proc/process_payment()
|
||||
if(total_price > credits)
|
||||
say("Insufficient credits.")
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
|
||||
visible_message("<span class='info'>\The [usr] swipes \the [I] through \the [src].</span>")
|
||||
|
||||
/obj/machinery/lapvend/ui_data(mob/user)
|
||||
|
||||
var/list/data = list()
|
||||
@@ -287,5 +273,24 @@ obj/machinery/lapvend/attackby(obj/item/I as obj, mob/user as mob)
|
||||
data["hw_cpu"] = dev_cpu
|
||||
if(state == 1 || state == 2)
|
||||
data["totalprice"] = total_price
|
||||
data["credits"] = credits
|
||||
|
||||
return data
|
||||
return data
|
||||
|
||||
|
||||
/obj/machinery/lapvend/proc/try_purchase()
|
||||
// Awaiting payment state
|
||||
if(state == 2)
|
||||
if(process_payment())
|
||||
fabricate_and_recalc_price(1)
|
||||
if((devtype == 1) && fabricated_laptop)
|
||||
fabricated_laptop.forceMove(src.loc)
|
||||
fabricated_laptop = null
|
||||
else if((devtype == 2) && fabricated_tablet)
|
||||
fabricated_tablet.forceMove(src.loc)
|
||||
fabricated_tablet = null
|
||||
credits -= total_price
|
||||
say("Enjoy your new product!")
|
||||
state = 3
|
||||
return 1
|
||||
return 0
|
||||
Reference in New Issue
Block a user