Skip to content

tweak: Orbit tgui now does not load all NPCs by default #6684

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 10 commits into
base: master220
Choose a base branch
from
10 changes: 9 additions & 1 deletion code/modules/mob/dead/observer/orbit.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
/datum/orbit_menu
var/mob/dead/observer/owner
var/should_show_NPC = FALSE

/datum/orbit_menu/New(mob/dead/observer/new_owner)
if(!istype(new_owner))
Expand All @@ -13,6 +14,7 @@
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "Orbit", "Orbit")
should_show_NPC = initial(should_show_NPC)
ui.open()

/datum/orbit_menu/ui_act(action, list/params, datum/tgui/ui)
Expand All @@ -33,9 +35,14 @@
if("refresh")
update_static_data(owner, ui)
. = TRUE
if("toggle_show_npcs")
should_show_NPC = !should_show_NPC
update_static_data(owner, ui)
. = TRUE

/datum/orbit_menu/ui_data(mob/user)
var/list/data = list()
data["should_show_NPC"] = should_show_NPC
return data

/datum/orbit_menu/ui_static_data(mob/user)
Expand Down Expand Up @@ -80,7 +87,8 @@
if(isobserver(M))
ghosts += list(serialized)
else if(M.mind == null)
npcs += list(serialized)
if(should_show_NPC)
npcs += list(serialized)
else if(M.stat == DEAD)
dead += list(serialized)
else
Expand Down
17 changes: 16 additions & 1 deletion tgui/packages/tgui/interfaces/Orbit.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export const Orbit = (props, context) => {
antagonists,
highlights,
auto_observe,
should_show_NPC,
dead,
ghosts,
misc,
Expand Down Expand Up @@ -203,7 +204,21 @@ export const Orbit = (props, context) => {

<BasicSection title="Dead" source={dead} searchText={searchText} />

<BasicSection title="NPCs" source={npcs} searchText={searchText} />
{should_show_NPC ? (
<BasicSection title="NPCs" source={npcs} searchText={searchText} />
) : (
<Section
title="NPCs"
buttons={
!should_show_NPC && (
<Button
content="Load NPCs"
onClick={() => act('toggle_show_npcs')}
/>
)
}
/>
)}

<BasicSection title="Misc" source={misc} searchText={searchText} />
</Window.Content>
Expand Down
34 changes: 17 additions & 17 deletions tgui/public/tgui.bundle.js

Large diffs are not rendered by default.