mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2025-12-29 03:21:30 +00:00
* tgui the beginning * binaries and the like * Bring in the last of it * Example radio UI * delete example * NTOS Main Menu, start on manifest, tgui states * tasks.json * gunnery ui pt 1 * okay * fix everything * scss update * oops * manifest gigablast * downloader part 1 * download prt 2 * NTOSDownloader final * mfw committing to_worlds * gunnery console pt2 * i cooked * targeting (finished) * one vueui down * voting ui almost done * MY MIND FEELS LIKE AN ARCH ENEMYYYY * voting ui down * photocopier * ntos config + download fixes * photocopier 2 * refactor define * NTOS client manager + fixes * fax machine final (it also uses toner now) * marching forwards... left behind... * ntnrc part 1 * canister * add quotes * portable pumps pt1 + more backgrounds * oops * finish the portable pump * freezers so I'll keep on pushing forward... you haven't seen the last of me... oooooooh... * doors ui pt1 * finish doors UI (forgive me wildkins it's a bit of shitcode) * vitals monitor, make things use labeled lists, new backgrounds * mais j'envoyé aucun mayday... * maglock pt1 * pour ça je me suis perdu... * infrared * fix that * prox sensor pt1 * prox sensor * signaler (this was actually pretty hard) * atmos control pt1 * atmos control pt1.1 * atmos pt 2 * fuel injector * multitool UI * jammer * list viewer * APC * portgen * targeting console updates + SMES ui * new themes, shield generator * supermatter * Add ore detector and (shitty) NTNet Relay * orderterminal pt1 * orderterminal pt2 * smartfridge * Add (air-)tank GUI update ore detector size * Adds Transfer Valves * Add AtmoScrubber * analyzer pt1 * weapons analyzer pt2 * bodyscanner pt1 * bodyscanner pt2 * fix this shitcode * seed storage * appearance changer * appearance changer final * sleeper pt1 * sleeper * gps * vehicles * chem dispenser * lily request * holopad * tgui modules pt1 * ppanel * damage menu * fixes * im here too now * follow menu, search bars * quikpay * quikpay fixes * circuit printer * ppanel * ppanel updates * pai * turret controls (i want to kill myself) * tweak * remove the boardgame * guntracker * implant tracker * penal mechs come close to me, come close to me * chem codex * pai radio * doorjack * pai directives * signaler removal, sensors * ghost spawner * spawnpoint * fixes * teleporter * one more to the chopping block * account database * remove divider * scanner, atmos * latejoin ui pt1 * latejoin * records pt1 * RECORDS UI DONE * delete interpreter & records * CHAT FUCKING CLIENT * data updates * fix some things * final UI, log * basic nanoui fix * antag panel * remove vueui * atm update * vending update * warrants, cameras * ntmonitor * time comes for all * preserve this legacy * bring that back (oops) * rcon, ui auto update for computer UIs, remove rcon computers * alarm monitoring (a bit broke and also todo: add custom alarm monitoring programs to a few consoles) * A LIKE SUPREME * a * power monitor * lights on * fuck this code, fuck nanoui modules, and fuck nanoui * LEAVE IT OH SO FAR BEHIND * fix alarm monitoring for synths * I SAW IN YOU WHAT LIFE WAS MISSING * comms console * idcard and record updates * turn the light on * arcade * pt2 * news browser * static * crusher * f * COULD I JUST SLEIGH THE GOLD FROM THE BALLS? I'M SO FRUSTRATED OH COULD YOU TELL? IF I HEAR ONE MORE VUEUI OR ONE NANOUI I'M GONNA LOSE IT SO LET ME GOOOOOOOOOOOOOOOOO * codeowners & suit sensors * html ui style removal * make lint happy * resist and disorder * i slowly get up and turn off the noise, already fed up... * pleaseeeeeeeeeeeeeee * THE CREDIT LARP IS NECESSARY * i hold the keys * RISE UP * fix that? * harry's suggestions xoxo * runtime fix pt2 * You are the only thing that I still care about * adds build workflow * Update update_tgui.yml * adds some needed steps * ATM * misc fixes and tweaks * fixes 2 * make newscasters usable and fix use power on freezers * turret control is clearer --------- Co-authored-by: John Wildkins <john.wildkins@gmail.com> Co-authored-by: Matt Atlas <liermattia@gmail.com> Co-authored-by: harryob <55142896+harryob@users.noreply.github.com> Co-authored-by: Werner <Arrow768@users.noreply.github.com> Co-authored-by: Geeves <ggrobler447@gmail.com> Co-authored-by: harryob <me@harryob.live>
216 lines
7.6 KiB
Plaintext
216 lines
7.6 KiB
Plaintext
/// This is really ugly copypaste, but we are seriously at the point where I don't give a fuck anymore.
|
|
/// Well, it's not the worst copypaste since this and the computer program need to be separate anyway, but it's still ugly.
|
|
/datum/tgui_module/admin/law_manager
|
|
var/ion_law = "IonLaw"
|
|
var/zeroth_law = "ZerothLaw"
|
|
var/inherent_law = "InherentLaw"
|
|
var/supplied_law = "SuppliedLaw"
|
|
var/supplied_law_position = MIN_SUPPLIED_LAW_NUMBER
|
|
|
|
var/current_view = 0
|
|
|
|
var/global/list/datum/ai_laws/admin_laws
|
|
var/global/list/datum/ai_laws/player_laws
|
|
var/mob/living/silicon/owner = null
|
|
|
|
/datum/tgui_module/admin/law_manager/New(var/mob/living/silicon/S)
|
|
..()
|
|
owner = S
|
|
|
|
if(!admin_laws)
|
|
admin_laws = new()
|
|
player_laws = new()
|
|
|
|
init_subtypes(/datum/ai_laws, admin_laws)
|
|
sortTim(admin_laws, GLOBAL_PROC_REF(cmp_name_asc))
|
|
|
|
for(var/datum/ai_laws/laws in admin_laws)
|
|
if(laws.selectable)
|
|
player_laws += laws
|
|
|
|
/datum/tgui_module/admin/law_manager/ui_interact(mob/user, datum/tgui/ui)
|
|
ui = SStgui.try_update_ui(user, src, ui)
|
|
if(!ui)
|
|
ui = new(user, src, "LawManager", "Law Manager (Admin)")
|
|
ui.autoupdate = FALSE
|
|
ui.open()
|
|
|
|
/datum/tgui_module/admin/law_manager/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
|
|
if(..())
|
|
return
|
|
|
|
switch(action)
|
|
if("set_view")
|
|
current_view = text2num(params["set_view"])
|
|
return TRUE
|
|
|
|
if("law_channel")
|
|
if(params["law_channel"] in owner.law_channels())
|
|
owner.law_channel = params["law_channel"]
|
|
return TRUE
|
|
|
|
if("state_law")
|
|
var/datum/ai_law/AL = locate(params["ref"]) in owner.laws.all_laws()
|
|
if(AL)
|
|
var/state_law = text2num(params["state_law"])
|
|
owner.laws.set_state_law(AL, state_law)
|
|
return TRUE
|
|
|
|
if("add_zeroth_law")
|
|
if(zeroth_law && is_admin(usr) && !owner.laws.zeroth_law)
|
|
owner.set_zeroth_law(zeroth_law)
|
|
return TRUE
|
|
|
|
if("add_ion_law")
|
|
if(ion_law && is_malf(usr))
|
|
owner.add_ion_law(ion_law)
|
|
return TRUE
|
|
|
|
if("add_inherent_law")
|
|
if(inherent_law && is_malf(usr))
|
|
owner.add_inherent_law(inherent_law)
|
|
return TRUE
|
|
|
|
if("add_supplied_law")
|
|
if(supplied_law && supplied_law_position >= 1 && MIN_SUPPLIED_LAW_NUMBER <= MAX_SUPPLIED_LAW_NUMBER && is_malf(usr))
|
|
owner.add_supplied_law(supplied_law_position, supplied_law)
|
|
return TRUE
|
|
|
|
if("change_zeroth_law")
|
|
var/new_law = sanitize(input("Enter new law Zero. Leaving the field blank will cancel the edit.", "Edit Law", zeroth_law))
|
|
if(new_law && new_law != zeroth_law && state.can_use_topic(src, usr))
|
|
zeroth_law = new_law
|
|
return TRUE
|
|
|
|
if("change_ion_law")
|
|
var/new_law = sanitize(input("Enter new ion law. Leaving the field blank will cancel the edit.", "Edit Law", ion_law))
|
|
if(new_law && new_law != ion_law && state.can_use_topic(src, usr))
|
|
ion_law = new_law
|
|
return TRUE
|
|
|
|
if("change_inherent_law")
|
|
var/new_law = sanitize(input("Enter new inherent law. Leaving the field blank will cancel the edit.", "Edit Law", inherent_law))
|
|
if(new_law && new_law != inherent_law && state.can_use_topic(src, usr))
|
|
inherent_law = new_law
|
|
return TRUE
|
|
|
|
if("change_supplied_law")
|
|
var/new_law = sanitize(input("Enter new supplied law. Leaving the field blank will cancel the edit.", "Edit Law", supplied_law))
|
|
if(new_law && new_law != supplied_law && state.can_use_topic(src, usr))
|
|
supplied_law = new_law
|
|
return TRUE
|
|
|
|
if("change_supplied_law_position")
|
|
var/new_position = input(usr, "Enter new supplied law position between 1 and [MAX_SUPPLIED_LAW_NUMBER], inclusive. Inherent laws at the same index as a supplied law will not be stated.", "Law Position", supplied_law_position) as num|null
|
|
if(isnum(new_position) && state.can_use_topic(src, usr))
|
|
supplied_law_position = Clamp(new_position, 1, MAX_SUPPLIED_LAW_NUMBER)
|
|
return TRUE
|
|
|
|
if("edit_law")
|
|
if(is_malf(usr))
|
|
var/datum/ai_law/AL = locate(params["edit_law"]) in owner.laws.all_laws()
|
|
if(AL)
|
|
var/new_law = sanitize(input(usr, "Enter new law. Leaving the field blank will cancel the edit.", "Edit Law", AL.law))
|
|
if(new_law && new_law != AL.law && is_malf(usr) && state.can_use_topic(src, usr))
|
|
log_and_message_admins("has changed a law of [owner] from '[AL.law]' to '[new_law]'")
|
|
AL.law = new_law
|
|
return TRUE
|
|
|
|
if("delete_law")
|
|
if(is_malf(usr))
|
|
var/datum/ai_law/AL = locate(params["delete_law"]) in owner.laws.all_laws()
|
|
if(AL && is_malf(usr))
|
|
owner.delete_law(AL)
|
|
return TRUE
|
|
|
|
if("state_laws")
|
|
owner.statelaws(owner.laws)
|
|
return TRUE
|
|
|
|
if("state_law_set")
|
|
var/datum/ai_laws/ALs = locate(params["state_law_set"]) in (is_admin(usr) ? admin_laws : player_laws)
|
|
if(ALs)
|
|
owner.statelaws(ALs)
|
|
return TRUE
|
|
|
|
if("transfer_laws")
|
|
if(is_malf(usr))
|
|
var/datum/ai_laws/ALs = locate(params["transfer_laws"]) in (is_admin(usr) ? admin_laws : player_laws)
|
|
if(ALs)
|
|
log_and_message_admins("has transfered the [ALs.name] laws to [owner].")
|
|
ALs.sync(owner, 0)
|
|
current_view = 0
|
|
return TRUE
|
|
|
|
if("notify_laws")
|
|
to_chat(owner, "<span class='danger'>Law Notice</span>")
|
|
owner.laws.show_laws(owner)
|
|
if(isAI(owner))
|
|
var/mob/living/silicon/ai/AI = owner
|
|
for(var/mob/living/silicon/robot/R in AI.connected_robots)
|
|
to_chat(R, "<span class='danger'>Law Notice</span>")
|
|
R.laws.show_laws(R)
|
|
if(usr != owner)
|
|
to_chat(usr, "<span class='notice'>Laws displayed.</span>")
|
|
return TRUE
|
|
|
|
/datum/tgui_module/admin/law_manager/ui_data(mob/user)
|
|
var/list/data = list()
|
|
owner.lawsync()
|
|
|
|
data["ion_law_nr"] = ionnum()
|
|
data["ion_law"] = ion_law
|
|
data["zeroth_law"] = zeroth_law
|
|
data["inherent_law"] = inherent_law
|
|
data["supplied_law"] = supplied_law
|
|
data["supplied_law_position"] = supplied_law_position
|
|
|
|
package_laws(data, "zeroth_laws", list(owner.laws.zeroth_law))
|
|
package_laws(data, "ion_laws", owner.laws.ion_laws)
|
|
package_laws(data, "inherent_laws", owner.laws.inherent_laws)
|
|
package_laws(data, "supplied_laws", owner.laws.supplied_laws)
|
|
|
|
data["isAI"] = isAI(owner)
|
|
data["isMalf"] = is_malf(user)
|
|
data["isSlaved"] = owner.is_slaved()
|
|
data["isAdmin"] = is_admin(user)
|
|
data["view"] = current_view
|
|
|
|
var/channels = list()
|
|
for (var/ch_name in owner.law_channels())
|
|
channels += list(list("channel" = ch_name))
|
|
data["channel"] = owner.law_channel
|
|
data["channels"] = channels
|
|
data["law_sets"] = package_multiple_laws(data["isAdmin"] ? admin_laws : player_laws)
|
|
|
|
return data
|
|
|
|
/datum/tgui_module/admin/law_manager/proc/package_laws(var/list/data, var/field, var/list/datum/ai_law/laws)
|
|
var/list/packaged_laws = list()
|
|
for(var/datum/ai_law/AL in laws)
|
|
packaged_laws += list(list("law" = AL.law, "index" = AL.get_index(), "state" = owner.laws.get_state_law(AL), "ref" = "\ref[AL]"))
|
|
data[field] = packaged_laws
|
|
data["has_[field]"] = packaged_laws.len
|
|
|
|
/datum/tgui_module/admin/law_manager/proc/package_multiple_laws(var/list/datum/ai_laws/laws)
|
|
var/list/law_sets = list()
|
|
for(var/datum/ai_laws/ALs in laws)
|
|
var/packaged_laws = list()
|
|
package_laws(packaged_laws, "zeroth_laws", list(ALs.zeroth_law, ALs.zeroth_law_borg))
|
|
package_laws(packaged_laws, "ion_laws", ALs.ion_laws)
|
|
package_laws(packaged_laws, "inherent_laws", ALs.inherent_laws)
|
|
package_laws(packaged_laws, "supplied_laws", ALs.supplied_laws)
|
|
law_sets += list(list("name" = ALs.name, "header" = ALs.law_header, "ref" = "\ref[ALs]","laws" = packaged_laws))
|
|
|
|
return law_sets
|
|
|
|
/datum/tgui_module/admin/law_manager/proc/is_malf(var/mob/user)
|
|
return (is_admin(user) && !owner.is_slaved()) || owner.is_malf_or_traitor()
|
|
|
|
/datum/tgui_module/admin/law_manager/proc/sync_laws(var/mob/living/silicon/ai/AI)
|
|
if(!AI)
|
|
return
|
|
for(var/mob/living/silicon/robot/R in AI.connected_robots)
|
|
R.sync()
|
|
log_and_message_admins("has syncronized [AI]'s laws with its borgs.")
|