Files
Bubberstation/code/modules/modular_computers/file_system/programs/robocontrol.dm
SkyratBot 1f753d5d4c [MIRROR] Refactors crew records (#72725) + Medical/Security records now use the max/min age. [MDB IGNORE] (#19078)
* Medical/Security records now use the max/min age.

* merge conflict

* Refactors crew records (#72725)

I have attempted or otherwise started this project at least 4 times. I
am sick of it being on my calendar. The code needs it. I need it.

- This makes crew records a proper datum rather than assigning
properties record.fields.
- General, medical, and security records are merged.
- Did some slight refactoring here and there for things that looked
obvious.
- Wanted states are now defined (and you can suspect someone through
sechud)
- pAI (unrelated but annoying) had some poorly named exported types that
i made more specific
- Job icons are moved back to the JS side (I wanted to get icons for
initial rank without passing trim)

<details>
<summary>previews</summary>

Editable fields & security console

![CM6d74brnC](https://user-images.githubusercontent.com/42397676/213950290-af6cfd76-eb8b-48e9-b792-925949311d9a.gif)

Medical records

![bFJErsvOaN](https://user-images.githubusercontent.com/42397676/214132534-59af1f8c-9920-4b51-8b27-297103649962.gif)

Look and feel of the more current version

![cxGruQsJpP](https://user-images.githubusercontent.com/42397676/214132611-0134eef0-e74c-4fad-9cde-328ff7c06165.gif)

</details>

TGUI'd some of the worst UIs in the game.
Creating new records is made much simpler.
Manifest_inject is made readable.
Probably bug fixes

🆑
refactor: Crew records have been refactored.
refactor: Medical records -> TGUI
refactor: Security records -> TGUI
refactor: Warrants console -> TGUI
qol: Players are now alerted when their fines are paid off.
qol: Cleaned up sec hud examination text.
qol: Adding and deleting crimes is easier.
qol: Writing crimes in the console sets players to arrest.
qol: You can now mark someone as a suspect through sec hud.
/🆑

Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>

* I've got something that now actually works

Just got to incorporate the records into what players can actually see.

* Turns out that client has already been transferred after all

* Adds the past records in the TGUI records (they're kinda ugly but it works, so y'know)

* Whoops

* Hate you too sometimes Prettier

* Fixes ghost roles using LITERAL records, which caused problems

* Fixes the leaks caused by ghost roles not getting their name right because of the stupid freaking special() proc

* I hate list operations man they're so stupid

* Fixes the stars on the crew manifest!

---------

Co-authored-by: NamelessFairy <40036527+NamelessFairy@users.noreply.github.com>
Co-authored-by: KathrinBailey <53862927+KathrinBailey@users.noreply.github.com>
Co-authored-by: Jeremiah <42397676+jlsnow301@users.noreply.github.com>
Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
Co-authored-by: GoldenAlpharex <jerego1234@hotmail.com>
2023-02-28 14:14:24 -05:00

149 lines
4.7 KiB
Plaintext

/datum/computer_file/program/robocontrol
filename = "botkeeper"
filedesc = "BotKeeper"
category = PROGRAM_CATEGORY_SCI
program_icon_state = "robot"
extended_desc = "A remote controller used for giving basic commands to non-sentient robots."
requires_ntnet = TRUE
size = 6
tgui_id = "NtosRoboControl"
program_icon = "robot"
///Number of simple robots on-station.
var/botcount = 0
///Access granted by the used to summon robots.
var/list/current_access = list()
///List of all ping types you can annoy drones with.
var/list/drone_ping_types = list(
"Low",
"Medium",
"High",
"Critical",
)
/datum/computer_file/program/robocontrol/ui_data(mob/user)
var/list/data = get_header_data()
var/turf/current_turf = get_turf(ui_host())
var/list/botlist = list()
var/list/mulelist = list()
if(computer)
data["id_owner"] = computer.computer_id_slot || ""
botcount = 0
for(var/mob/living/simple_animal/bot/simple_bot as anything in GLOB.bots_list)
if(!is_valid_z_level(current_turf, get_turf(simple_bot)) || !(simple_bot.bot_mode_flags & BOT_MODE_REMOTE_ENABLED)) //Only non-emagged bots on the same Z-level are detected!
continue
if(computer && !simple_bot.check_access(user)) // Only check Bots we can access)
continue
var/list/newbot = list(
"name" = simple_bot.name,
"mode" = simple_bot.get_mode_ui(),
"model" = simple_bot.bot_type,
"locat" = get_area(simple_bot),
"bot_ref" = REF(simple_bot),
"mule_check" = FALSE,
)
if(simple_bot.bot_type == MULE_BOT)
var/mob/living/simple_animal/bot/mulebot/simple_mulebot = simple_bot
mulelist += list(list(
"name" = simple_mulebot.name,
"dest" = simple_mulebot.destination,
"power" = simple_mulebot.cell ? simple_mulebot.cell.percent() : 0,
"home" = simple_mulebot.home_destination,
"autoReturn" = simple_mulebot.auto_return,
"autoPickup" = simple_mulebot.auto_pickup,
"reportDelivery" = simple_mulebot.report_delivery,
"mule_ref" = REF(simple_mulebot),
))
if(simple_mulebot.load)
data["load"] = simple_mulebot.load.name
newbot["mule_check"] = TRUE
botlist += list(newbot)
for(var/mob/living/simple_animal/drone/all_drones as anything in GLOB.drones_list)
if(all_drones.hacked)
continue
if(!is_valid_z_level(current_turf, get_turf(all_drones)))
continue
var/list/drone_data = list(
"name" = all_drones.name,
"status" = all_drones.stat,
"drone_ref" = REF(all_drones),
)
data["drones"] += list(drone_data)
data["bots"] = botlist
data["mules"] = mulelist
data["botcount"] = botlist.len
data["droneaccess"] = GLOB.drone_machine_blacklist_enabled
data["dronepingtypes"] = drone_ping_types
return data
/datum/computer_file/program/robocontrol/ui_act(action, list/params, datum/tgui/ui)
. = ..()
if(.)
return
var/mob/current_user = ui.user
var/obj/item/card/id/id_card = computer?.computer_id_slot
var/list/standard_actions = list(
"patroloff",
"patrolon",
"ejectpai",
)
var/list/MULE_actions = list(
"stop",
"go",
"home",
"destination",
"setid",
"sethome",
"unload",
"autoret",
"autopick",
"report",
"ejectpai",
)
var/mob/living/simple_animal/bot/simple_bot = locate(params["robot"]) in GLOB.bots_list
if (action in standard_actions)
simple_bot.bot_control(action, current_user, current_access)
if (action in MULE_actions)
simple_bot.bot_control(action, current_user, current_access, TRUE)
switch(action)
if("summon")
simple_bot.bot_control(action, current_user, id_card ? id_card.access : current_access)
if("ejectcard")
if(!computer || !computer.computer_id_slot)
return
if(id_card)
GLOB.manifest.modify(id_card.registered_name, id_card.assignment, id_card.get_trim_assignment())
computer.RemoveID(usr)
else
playsound(get_turf(ui_host()) , 'sound/machines/buzz-sigh.ogg', 25, FALSE)
if("changedroneaccess")
if(!computer || !computer.computer_id_slot || !id_card)
to_chat(current_user, span_notice("No ID found, authorization failed."))
return
if(isdrone(current_user))
to_chat(current_user, span_notice("You can't free yourself."))
return
if(!(ACCESS_CE in id_card.access))
to_chat(current_user, span_notice("Required access not found on ID."))
return
GLOB.drone_machine_blacklist_enabled = !GLOB.drone_machine_blacklist_enabled
if("ping_drones")
if(!(params["ping_type"]) || !(params["ping_type"] in drone_ping_types))
return
var/area/current_area = get_area(current_user)
if(!current_area || QDELETED(current_user))
return
var/msg = span_boldnotice("NON-DRONE PING: [current_user.name]: [params["ping_type"]] priority alert in [current_area.name]!")
_alert_drones(msg, TRUE, current_user)
to_chat(current_user, msg)
playsound(src, 'sound/machines/terminal_success.ogg', 15, TRUE)