Files
Bubberstation/code/modules/bitrunning/objects/vendor.dm
John Willard 1880003270 Reworks silicon/ai access checking & fixes some ui_act's (#84964)
## About The Pull Request

Currently to check for Silicon access, we do:
``if is silicon or is admin ghost or has unlimited silicon privileges or
has machine remote in hand``
What has unlimited silicon privileges? Bots, Drones, and admin ghosts.
To check for AI access, it just checks for AI instead of silicon, and
doesnt check for unlimited silicon privileges.

This was kinda silly, so I thought I should make this a little easier to
understand.
Now all silicon/ai traits come from ``AI_ACCESS_TRAIT`` or
``SILICON_ACCESS_TRAIT``. I made a single exception to keep Admin ghost,
since now instead of being a var on the client, we moved it to using the
same trait but giving it to the client instead, but since we have to
keep parity with previous functionality (admins can spawn in and not
have this on, it only works while as a ghost), I kept previous checks as
well.

No more type checks, removes a silly var on the mob level and another on
the client.

Now while I was doing this, I found a lot of tgui's ``ui_act`` still
uses ``usr`` and the wrong args, so I fixed those wherever I saw them,
and used a mass replace for the args.

Other changes:

- machinery's ``ui_act`` from
https://github.com/tgstation/tgstation/pull/81250 had ``isAI`` replaced
with ``HAS_AI_ACCESS``, this has been reverted. Machine wands and admin
ghosts no longer get kicked off things not on cameras. This was my
fault, I overlooked this when adding Human AI.
- Human AI's wand gives AI control as long as it's in your hand, you can
swap to your offhand. I hope this doesn't end up going horribly,
otherwise I'll revert this part. It should let human AIs not have their
UI closed on them when swapping to eat food or use their door wand or
whatnot.
- Bots previously had special checks to scan reagents and be
unobservant, I replaced this with giving them the trait. I also fixed an
instance of unobservant not being used, so now statues don't affect the
basic creature, whatever that is.

## Why It's Good For The Game

This is an easier to understand way of handling silicon access and makes
these mobs more consistent between eachother.
Other than what I've mentioned above, this should have no impact on
gameplay itself.

## Changelog

🆑
fix: Statues don't count as eyes to creatures.
fix: Human AIs and Admin ghosts no longer get kicked off of machines
that aren't on cameranets.
/🆑
2024-08-19 10:43:45 +00:00

87 lines
2.9 KiB
Plaintext

#define CREDIT_TYPE_BITRUNNING "np"
/obj/machinery/computer/order_console/bitrunning
name = "bitrunning supplies order console"
desc = "NexaCache(tm)! Dubiously authentic gear for the digital daredevil."
icon = 'icons/obj/machines/bitrunning.dmi'
icon_state = "vendor"
icon_keyboard = null
icon_screen = null
circuit = /obj/item/circuitboard/computer/order_console/bitrunning
cooldown_time = 10 SECONDS
cargo_cost_multiplier = 0.65
express_cost_multiplier = 1
purchase_tooltip = @{"Your purchases will arrive at cargo,
and hopefully get delivered by them.
35% cheaper than express delivery."}
express_tooltip = @{"Sends your purchases instantly."}
credit_type = CREDIT_TYPE_BITRUNNING
order_categories = list(
CATEGORY_BITRUNNING_FLAIR,
CATEGORY_BITRUNNING_TECH,
CATEGORY_BEPIS,
)
blackbox_key = "bitrunning"
/obj/machinery/computer/order_console/bitrunning/subtract_points(final_cost, obj/item/card/id/card)
if(final_cost <= card.registered_account.bitrunning_points)
card.registered_account.bitrunning_points -= final_cost
return TRUE
return FALSE
/obj/machinery/computer/order_console/bitrunning/order_groceries(mob/living/purchaser, obj/item/card/id/card, list/groceries)
var/list/things_to_order = list()
for(var/datum/orderable_item/item as anything in groceries)
things_to_order[item.item_path] = groceries[item]
var/datum/supply_pack/bitrunning/pack = new(
purchaser = purchaser, \
cost = get_total_cost(), \
contains = things_to_order,
)
var/datum/supply_order/new_order = new(
pack = pack,
orderer = purchaser,
orderer_rank = "Bitrunning Vendor",
orderer_ckey = purchaser.ckey,
reason = "",
paying_account = card.registered_account,
department_destination = null,
coupon = null,
charge_on_purchase = FALSE,
manifest_can_fail = FALSE,
cost_type = credit_type,
can_be_cancelled = FALSE,
)
say("Thank you for your purchase! It will arrive on the next cargo shuttle!")
radio.talk_into(src, "A bitrunner has ordered equipment which will arrive on the cargo shuttle! Please make sure it gets to them as soon as possible!", radio_channel)
SSshuttle.shopping_list += new_order
/obj/machinery/computer/order_console/bitrunning/retrieve_points(obj/item/card/id/id_card)
return round(id_card.registered_account.bitrunning_points)
/obj/machinery/computer/order_console/bitrunning/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(!.)
flick("vendor_off", src)
/obj/machinery/computer/order_console/bitrunning/update_icon_state()
icon_state = "[initial(icon_state)][powered() ? null : "_off"]"
return ..()
/datum/supply_pack/bitrunning
name = "bitrunning order"
hidden = TRUE
crate_name = "bitrunning delivery crate"
access = list(ACCESS_BIT_DEN)
/datum/supply_pack/bitrunning/New(purchaser, cost, list/contains)
. = ..()
name = "[purchaser]'s Bitrunning Order"
src.cost = cost
src.contains = contains
#undef CREDIT_TYPE_BITRUNNING