Skip to content

Commit

Permalink
Merge branch 'master' into tac-refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
Cthulhu80 authored Oct 4, 2023
2 parents ba3da54 + c1cd602 commit 476620d
Show file tree
Hide file tree
Showing 12 changed files with 156 additions and 131 deletions.
10 changes: 6 additions & 4 deletions code/controllers/subsystem/statpanel.dm
Original file line number Diff line number Diff line change
Expand Up @@ -383,8 +383,10 @@ SUBSYSTEM_DEF(statpanels)
set name = "Open Statbrowser Options"
set hidden = TRUE

if (!current_fontsize)
current_fontsize = 12

var/datum/statbrowser_options/SM = statbrowser_options
if(!SM)
SM = statbrowser_options = new(src, current_fontsize)
SM.tgui_interact()
var/datum/statbrowser_options/options_panel = statbrowser_options
if(!options_panel)
options_panel = statbrowser_options = new(src, current_fontsize)
options_panel.tgui_interact()
139 changes: 44 additions & 95 deletions code/game/machinery/floodlight.dm
Original file line number Diff line number Diff line change
@@ -1,30 +1,28 @@
//these are probably broken

/obj/structure/machinery/floodlight
name = "Emergency Floodlight"
name = "emergency floodlight"
desc = "A powerful light usually stationed near landing zones to provide better visibility."
icon = 'icons/obj/structures/machinery/floodlight.dmi'
icon_state = "flood00"
density = TRUE
anchored = TRUE
var/obj/item/cell/cell = null
var/use = 0
var/unlocked = 0
var/open = 0
light_power = 2
unslashable = TRUE
unacidable = TRUE
wrenchable = TRUE
use_power = USE_POWER_IDLE
idle_power_usage = 0
active_power_usage = 100

var/on_light_range = 6

///Whether or not the floodlight can be toggled on or off
var/toggleable = TRUE

///Whether or not the floodlight is turned on, disconnected from whether it has power or is lit
var/turned_on = FALSE

/obj/structure/machinery/floodlight/Initialize(mapload, ...)
. = ..()
cell = new /obj/item/cell(src)
if(light_on)
set_light(on_light_range)

/obj/structure/machinery/floodlight/Destroy()
QDEL_NULL(cell)
return ..()
turn_light(toggle_on = (operable() && turned_on))

/obj/structure/machinery/floodlight/turn_light(mob/user, toggle_on)
. = ..()
Expand All @@ -36,100 +34,51 @@
else
set_light(0)

update_icon()

/obj/structure/machinery/floodlight/proc/updateicon()
icon_state = "flood[open ? "o" : ""][open && cell ? "b" : ""]0[light_on]"

/obj/structure/machinery/floodlight/attack_hand(mob/user as mob)
if(open && cell)
if(ishuman(user))
if(!user.get_active_hand())
user.put_in_hands(cell)
cell.forceMove(user.loc)
else
cell.forceMove(loc)
/obj/structure/machinery/floodlight/attack_hand(mob/user)
if(!toggleable)
to_chat(user, SPAN_NOTICE("[src] doesn't seem to have a switch to toggle the light."))
return

cell.add_fingerprint(user)
cell.update_icon()
if(user.lying || user.stat)
return

src.cell = null
to_chat(user, "You remove the power cell.")
updateicon()
if(!is_valid_user(user))
to_chat(user, SPAN_NOTICE("You don't have the dexterity to do this."))
return

if(light_on)
to_chat(user, SPAN_NOTICE("You turn off the light."))
turn_light(user, toggle_on = FALSE)
unslashable = TRUE
unacidable = TRUE
else
if(!cell)
return
if(cell.charge <= 0)
return
to_chat(user, SPAN_NOTICE("You turn on the light."))
turn_light(user, toggle_on = TRUE)
unacidable = FALSE
turned_on = !turned_on

updateicon()
if(inoperable())
to_chat(user, SPAN_NOTICE("You turn [turned_on ? "on" : "off"] the floodlight. It seems to be inoperable."))
return

to_chat(user, SPAN_NOTICE("You turn [turned_on ? "on" : "off"] the light."))
turn_light(user, toggle_on = turned_on)
update_use_power(turned_on ? USE_POWER_ACTIVE : USE_POWER_IDLE)

/obj/structure/machinery/floodlight/attackby(obj/item/W as obj, mob/user as mob)
if(!ishuman(user))
return
/obj/structure/machinery/floodlight/update_icon()
. = ..()
icon_state = "flood0[light_on]"

/obj/structure/machinery/floodlight/power_change(area/master_area = null)
. = ..()

if (HAS_TRAIT(W, TRAIT_TOOL_WRENCH))
if (!anchored)
anchored = TRUE
to_chat(user, "You anchor the [src] in place.")
else
anchored = FALSE
to_chat(user, "You remove the bolts from the [src].")

if (HAS_TRAIT(W, TRAIT_TOOL_SCREWDRIVER))
if (!open)
if(unlocked)
unlocked = 0
to_chat(user, "You screw the battery panel in place.")
else
unlocked = 1
to_chat(user, "You unscrew the battery panel.")

if (HAS_TRAIT(W, TRAIT_TOOL_CROWBAR))
if(unlocked)
if(open)
open = 0
overlays = null
to_chat(user, "You crowbar the battery panel in place.")
else
if(unlocked)
open = 1
to_chat(user, "You remove the battery panel.")

if (istype(W, /obj/item/cell))
if(open)
if(cell)
to_chat(user, "There is a power cell already installed.")
else
if(user.drop_inv_item_to_loc(W, src))
cell = W
to_chat(user, "You insert the power cell.")
updateicon()
turn_light(toggle_on = (!(stat & NOPOWER) && turned_on))

//Magical floodlight that cannot be destroyed or interacted with.
/obj/structure/machinery/floodlight/landing
name = "Landing Light"
desc = "A powerful light stationed near landing zones to provide better visibility."
name = "landing light"
desc = "A powerful light usually stationed near landing zones to provide better visibility. This one seems to have been bolted down and is unable to be moved."
icon_state = "flood01"
light_on = TRUE
in_use = 1
use_power = USE_POWER_NONE

/obj/structure/machinery/floodlight/landing/attack_hand()
return

/obj/structure/machinery/floodlight/landing/attackby()
return
needs_power = FALSE
unslashable = TRUE
unacidable = TRUE
wrenchable = FALSE
toggleable = FALSE
turned_on = TRUE

/obj/structure/machinery/floodlight/landing/floor
icon_state = "floor_flood01"
Expand Down
9 changes: 6 additions & 3 deletions code/modules/cm_marines/radar.dm
Original file line number Diff line number Diff line change
Expand Up @@ -204,17 +204,20 @@
if(!trackable(humanoid))
continue
var/crewmember_name = "Unknown"
var/crewmember_rank = "Unknown"
if(humanoid.wear_id)
var/obj/item/card/id/ID = humanoid.wear_id.GetID()
if(ID?.registered_name)
crewmember_name = ID.registered_name
if(ID?.assignment)
crewmember_rank = ID.assignment
switch(humanoid.stat)
if(CONSCIOUS)
crewmember_name = "[crewmember_name] (Conscious)"
crewmember_name = "[crewmember_name] ([crewmember_rank]) (Conscious)"
if(UNCONSCIOUS)
crewmember_name = "[crewmember_name] (Unconscious)"
crewmember_name = "[crewmember_name] ([crewmember_rank]) (Unconscious)"
if(DEAD)
crewmember_name = "[crewmember_name] (DEAD)"
crewmember_name = "[crewmember_name] ([crewmember_rank]) (DEAD)"
var/list/crewinfo = list(
ref = REF(humanoid),
name = crewmember_name,
Expand Down
4 changes: 4 additions & 0 deletions html/changelogs/AutoChangeLog-pr-4505.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
author: "Drathek"
delete-after: True
changes:
- bugfix: "Fix getFlatIcon not resizing its template nor respect appearance_flags of RESET_COLOR and RESET_ALPHA"
4 changes: 4 additions & 0 deletions html/changelogs/AutoChangeLog-pr-4514.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
author: "Drathek"
delete-after: True
changes:
- rscadd: "Restore the stat panel options menu to change the stat panel font size"
5 changes: 5 additions & 0 deletions html/changelogs/AutoChangeLog-pr-4535.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
author: "Morrow"
delete-after: True
changes:
- bugfix: "Fixed floodlight stacking to make mostly invincible walls"
- refactor: "Refactored 90% of the floodlight code"
4 changes: 4 additions & 0 deletions html/changelogs/AutoChangeLog-pr-4545.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
author: "Steelpoint"
delete-after: True
changes:
- ui: "Added personnel job titles to the handheld crew monitor, to make it easier to tell find out exactly what role's you are looking for. Also slightly expands the default monitor screen size to accommodate the entire personnel text on screen."
4 changes: 4 additions & 0 deletions html/changelogs/AutoChangeLog-pr-4582.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
author: "Morrow"
delete-after: True
changes:
- bugfix: "Fixed req door accesses"
45 changes: 43 additions & 2 deletions html/statbrowser.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ if (!String.prototype.trim) {
// Status panel implementation ------------------------------------------------
var status_tab_parts = ["Loading..."];
var current_tab = null;
var local_fontsize;
// Per `storage.js` for tgui:
// Localstorage can sometimes throw an error, even if DOM storage is not
// disabled in IE11 settings.
// See: https://superuser.com/questions/1080011
try {
local_fontsize = localStorage.getItem("fontsize");
} catch (error) {
local_fontsize = 12;
}
var current_fontsize = local_fontsize ? parseInt(local_fontsize) : 12; // in px, also determines line height and category header sizes for the verb menus
var mc_tab_parts = [["Loading...", ""]];
var href_token = null;
var spells = [];
Expand Down Expand Up @@ -232,8 +243,8 @@ function spell_cat_check(cat) {
}
}

function tab_change(tab) {
if (tab == current_tab) return;
function tab_change(tab, force) {
if (!force && tab == current_tab) return;
if (document.getElementById(current_tab))
document.getElementById(current_tab).className = "button"; // disable active on last button
current_tab = tab;
Expand Down Expand Up @@ -707,6 +718,7 @@ function draw_verbs(cat) {
a.href = "#";
a.onclick = make_verb_onclick(command.replace(/\s/g, "-"));
a.className = "grid-item";
a.style.lineHeight = current_fontsize + 2 + "px";
var t = document.createElement("span");
t.textContent = command;
t.className = "grid-item-text";
Expand All @@ -725,6 +737,7 @@ function draw_verbs(cat) {
// do addition here
var header = document.createElement("h3");
header.textContent = cat;
header.style.fontSize = current_fontsize + 4 + "px";
content.appendChild(header);
content.appendChild(additions[cat]);
}
Expand Down Expand Up @@ -857,6 +870,7 @@ Byond.subscribeTo("remove_verb_list", function (v) {
// passes a 2D list of (verbcategory, verbname) creates tabs and adds verbs to respective list
// example (IC, Say)
Byond.subscribeTo("init_verbs", function (payload) {
statcontentdiv.style.fontSize = current_fontsize + "px";
wipe_verbs(); // remove all verb categories so we can replace them
checkStatusTab(); // remove all status tabs
verb_tabs = payload.panel_tabs;
Expand All @@ -877,6 +891,7 @@ Byond.subscribeTo("init_verbs", function (payload) {
draw_verbs(current_tab);
}
}
createOptionsButton();
SendTabsToByond();
});

Expand Down Expand Up @@ -1028,3 +1043,29 @@ Byond.subscribeTo("remove_sdql2", remove_sdql2);
Byond.subscribeTo("remove_mc", remove_mc);

Byond.subscribeTo("add_verb_list", add_verb_list);

function createOptionsButton() {
var button = document.createElement("BUTTON");
button.onclick = function () {
openOptionsMenu();
this.blur();
};
button.id = "options";
button.textContent = "Options";
button.className = "options";
button.style.order = 999; // last please
button.style.marginLeft = "auto";
button.style.marginRight = "2%";
menu.appendChild(button);
}

function openOptionsMenu() {
Byond.command("Open-Statbrowser-Options " + current_fontsize);
}

Byond.subscribeTo("change_fontsize", function (new_fontsize) {
current_fontsize = parseInt(new_fontsize);
localStorage.setItem("fontsize", current_fontsize.toString());
statcontentdiv.style.fontSize = current_fontsize + "px";
tab_change(current_tab, true); // Redraw the current tab
});
Loading

0 comments on commit 476620d

Please sign in to comment.