mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-07-21 04:48:18 +01:00
Examinable Armor (#17364)
* Examinable Armor * horse react this linter * me coder * changes * Update tgui/packages/tgui/interfaces/ArmorValues.tsx Co-authored-by: Matt Atlas <mattiathebest2000@hotmail.it> * capitalize * cl newline --------- Co-authored-by: Matt Atlas <mattiathebest2000@hotmail.it>
This commit is contained in:
@@ -3352,6 +3352,7 @@
|
||||
#include "code\modules\tgui\status_composers.dm"
|
||||
#include "code\modules\tgui\tgui.dm"
|
||||
#include "code\modules\tgui\tgui_window.dm"
|
||||
#include "code\modules\tgui\modules\armor_values.dm"
|
||||
#include "code\modules\tgui\modules\flavor_text.dm"
|
||||
#include "code\modules\tgui\states\admin.dm"
|
||||
#include "code\modules\tgui\states\always.dm"
|
||||
|
||||
@@ -333,8 +333,18 @@
|
||||
//Changed this switch to ranges instead of tiered values, to cope with granularity and also
|
||||
//things outside its range ~Nanako
|
||||
|
||||
. = ..(user, distance, "", "It is a [size] item.")
|
||||
if(length(armor))
|
||||
to_chat(user, FONT_SMALL(SPAN_NOTICE("\[?\] This item has armor values. <a href=?src=\ref[src];examine_armor=1>\[Show Armor Values\]</a>")))
|
||||
|
||||
return ..(user, distance, "", "It is a [size] item.")
|
||||
/obj/item/Topic(href, href_list)
|
||||
if(href_list["examine_armor"])
|
||||
var/list/armor_details = list()
|
||||
for(var/armor_type in armor)
|
||||
armor_details[armor_type] = armor[armor_type]
|
||||
var/datum/tgui_module/armor_values/AV = new /datum/tgui_module/armor_values(usr, capitalize_first_letters(name), armor_details)
|
||||
AV.ui_interact(usr)
|
||||
return ..()
|
||||
|
||||
/obj/item/attack_hand(mob/user)
|
||||
if(!user)
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
. = ..()
|
||||
if(LAZYLEN(accessories))
|
||||
for(var/obj/item/clothing/accessory/A in accessories)
|
||||
to_chat(user, "\A [A] [A.gender == PLURAL ? "are" : "is"] attached to it.")
|
||||
to_chat(user, SPAN_NOTICE("<a HREF=?src=\ref[user];lookitem=\ref[A]>\A [A]</a> [A.gender == PLURAL ? "are" : "is"] attached to it."))
|
||||
|
||||
/obj/item/clothing/proc/update_accessory_slowdown()
|
||||
slowdown_accessory = 0
|
||||
|
||||
@@ -610,12 +610,18 @@
|
||||
|
||||
//TODO: Fix Topic vulnerabilities for malfunction and AI override.
|
||||
/obj/item/rig/Topic(href,href_list)
|
||||
if(href_list["examine_fluff"])
|
||||
examine_fluff(usr)
|
||||
if(ismob(href))
|
||||
do_rig_thing(href, href_list)
|
||||
return
|
||||
do_rig_thing(usr, href_list)
|
||||
if(href_list["examine_armor"])
|
||||
var/list/armor_details = list()
|
||||
for(var/armor_type in armor)
|
||||
armor_details[armor_type] = armor[armor_type]
|
||||
var/datum/tgui_module/armor_values/AV = new /datum/tgui_module/armor_values(usr, capitalize_first_letters(name), armor_details)
|
||||
AV.ui_interact(usr)
|
||||
if(href_list["examine_fluff"])
|
||||
examine_fluff(usr)
|
||||
if(ismob(href))
|
||||
do_rig_thing(href, href_list)
|
||||
return
|
||||
do_rig_thing(usr, href_list)
|
||||
|
||||
/obj/item/rig/proc/do_rig_thing(mob/user, var/list/href_list)
|
||||
if(!check_suit_access(user))
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
/datum/tgui_module/armor_values
|
||||
var/armor_name = ""
|
||||
var/list/armor_values = list()
|
||||
|
||||
/datum/tgui_module/armor_values/New(mob/user, var/set_armor_name, var/list/set_armor_values)
|
||||
..()
|
||||
armor_name = set_armor_name
|
||||
armor_values = set_armor_values
|
||||
|
||||
/datum/tgui_module/armor_values/ui_interact(var/mob/user, var/datum/tgui/ui)
|
||||
ui = SStgui.try_update_ui(user, src, ui)
|
||||
if(!ui)
|
||||
ui = new(user, src, "ArmorValues", armor_name, 500, 400)
|
||||
ui.autoupdate = FALSE
|
||||
ui.open()
|
||||
|
||||
/datum/tgui_module/armor_values/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["armor_values"] = armor_values
|
||||
return data
|
||||
@@ -0,0 +1,6 @@
|
||||
author: Geeves
|
||||
|
||||
delete-after: True
|
||||
|
||||
changes:
|
||||
- rscadd: "Added the ability to examine items and see their armor values."
|
||||
@@ -0,0 +1,45 @@
|
||||
import { useBackend } from '../backend';
|
||||
import { Box, Divider, NoticeBox, ProgressBar, Section } from '../components';
|
||||
import { capitalize } from '../../common/string';
|
||||
import { Window } from '../layouts';
|
||||
|
||||
export type ArmorValuesData = {
|
||||
armor_values: string[];
|
||||
};
|
||||
|
||||
export const ArmorValues = (props, context) => {
|
||||
const { act, data } = useBackend<ArmorValuesData>(context);
|
||||
|
||||
return (
|
||||
<Window resizable>
|
||||
<Window.Content scrollable>
|
||||
<Section>
|
||||
<NoticeBox>
|
||||
The statistics below are out of character info, you can use this to
|
||||
reference armor values, but do not state the percentages in
|
||||
character.
|
||||
</NoticeBox>
|
||||
<Divider />
|
||||
{Object.keys(data.armor_values).map((line) =>
|
||||
line ? (
|
||||
<Box>
|
||||
<Box pb={1}>{capitalize(line)}</Box>
|
||||
<ProgressBar
|
||||
ranges={{
|
||||
good: [50, 100],
|
||||
average: [30, 50],
|
||||
bad: [0, 30],
|
||||
}}
|
||||
value={data.armor_values[line]}
|
||||
minValue={0}
|
||||
maxValue={100}
|
||||
/>
|
||||
<Divider />
|
||||
</Box>
|
||||
) : null
|
||||
)}
|
||||
</Section>
|
||||
</Window.Content>
|
||||
</Window>
|
||||
);
|
||||
};
|
||||
Reference in New Issue
Block a user