[MIRROR] fix samples (#10663)

Co-authored-by: Kashargul <144968721+Kashargul@users.noreply.github.com>
This commit is contained in:
CHOMPStation2StaffMirrorBot
2025-04-17 06:36:20 -07:00
committed by GitHub
parent 8ba8dc9553
commit 6bf45c9fb2
6 changed files with 48 additions and 14 deletions

View File

@@ -381,7 +381,7 @@ var/list/global_huds = list(
UI_style_color_new = hud_used.ui_color
hud_used.ui_color = UI_style_color_new
var/list/icons = hud_used.adding + hud_used.other + hud_used.hotkeybuttons
var/list/icons = hud_used.adding + hud_used.other + hud_used.hotkeybuttons + hud_used.other_important
icons.Add(zone_sel)
icons.Add(gun_setting_icon)
icons.Add(item_use_icon)
@@ -402,6 +402,7 @@ var/list/global_huds = list(
for(var/obj/screen/I in icons)
if(I.name in list(I_HELP, I_HURT, I_DISARM, I_GRAB))
continue
if(!(I.name in list("check known languages", "autowhisper", "autowhisper mode", "move downwards", "move upwards", "set pose")))
I.icon = ic
I.color = UI_style_color_new
I.alpha = UI_style_alpha_new

View File

@@ -318,7 +318,10 @@ GLOBAL_LIST_INIT(preference_entries_by_key, init_preference_entries_by_key())
/// Write a /datum/preference type and return its value directly to the json.
/mob/proc/write_preference_directly(preference_type, preference_value)
return client?.prefs?.write_preference_by_type(preference_type, preference_value)
var/success = client?.prefs?.write_preference_by_type(preference_type, preference_value)
if(success)
client?.prefs?.value_cache[preference_type] = preference_value
return success
/// Set a /datum/preference entry.
/// Returns TRUE for a successful preference application.

View File

@@ -42,24 +42,30 @@ var/global/list/all_tooltip_styles = list(
if(!ishuman(usr))
if(!isrobot(usr))
to_chat(usr, span_warning("You must be a human or a robot to use this verb."))
to_chat(src, span_warning("You must be a human or a robot to use this verb."))
return
var/UI_style_new = tgui_input_list(usr, "Select a style. White is recommended for customization", "UI Style Choice", all_ui_styles)
var/current_style = prefs.read_preference(/datum/preference/choiced/ui_style)
var/current_alpha = prefs.read_preference(/datum/preference/numeric/ui_style_alpha)
var/current_color = prefs.read_preference(/datum/preference/color/ui_style_color)
var/UI_style_new = tgui_input_list(src, "Select a style. White is recommended for customization", "UI Style Choice", all_ui_styles, current_style)
if(!UI_style_new) return
var/UI_style_alpha_new = tgui_input_number(usr, "Select a new alpha (transparency) parameter for your UI, between 50 and 255", null, null, 255, 50)
var/UI_style_alpha_new = tgui_input_number(src, "Select a new alpha (transparency) parameter for your UI, between 50 and 255", null, current_alpha, 255, 50)
if(!UI_style_alpha_new || !(UI_style_alpha_new <= 255 && UI_style_alpha_new >= 50)) return
var/UI_style_color_new = tgui_color_picker(usr, "Choose your UI color. Dark colors are not recommended!")
var/UI_style_color_new = tgui_color_picker(src, "Choose your UI color. Dark colors are not recommended!", null, current_color)
if(!UI_style_color_new) return
//update UI
usr.update_ui_style(UI_style_new, UI_style_alpha_new, UI_style_color_new)
if(tgui_alert(usr, "Like it? Save changes?","Save?",list("Yes", "No")) == "Yes")
if(tgui_alert(src, "Like it? Save changes?","Save?",list("Yes", "No")) == "Yes")
usr.write_preference_directly(/datum/preference/choiced/ui_style, UI_style_new)
usr.write_preference_directly(/datum/preference/numeric/ui_style_alpha, UI_style_alpha_new)
usr.write_preference_directly(/datum/preference/color/ui_style_color, UI_style_color_new)
SScharacter_setup.queue_preferences_save(prefs)
to_chat(usr, "UI was saved")
to_chat(src, "UI was saved")
return
usr.update_ui_style(current_style, current_alpha, current_color)

View File

@@ -9,7 +9,6 @@
var/fixed_tech = null //do we have a predetermined tech-group, per request? if so, overrides randomization for icon and name
var/rand_tech = null //randomized tech-group from the list below
var/list/valid_techs = list(TECH_COMBAT,TECH_MAGNET,TECH_POWER,TECH_BIO,TECH_DATA,TECH_ENGINEERING,TECH_PHORON,TECH_MATERIAL,TECH_BLUESPACE,TECH_ILLEGAL,TECH_ARCANE,TECH_PRECURSOR)
origin_tech = list() //blank list creation, or else we get a runtime trying to assign the new techgroup
persist_storable = FALSE //don't shove hazardous shinies into the item bank!! also their properties are (usually) randomized on creation, so saving them is pointless-- you won't get out what you put in
@@ -26,10 +25,15 @@
/obj/item/research_sample/Initialize(mapload)
. = ..()
var/tech_mod = rand(0,rand_level)
var/tech_value = tech_level+tech_mod
var/new_tech
if(LAZYLEN(origin_tech))
new_tech = origin_tech.Copy()
else
new_tech = list()
var/tech_mod = rand(0, rand_level)
var/tech_value = tech_level + tech_mod
if(fixed_tech)
origin_tech.Add(list("[fixed_tech]" = tech_value))
LAZYSET(new_tech, fixed_tech, tech_value)
else //if we're not a preset, randomize the name, icon, and associated tech, to make sure samples aren't predictable/metagamable
var/name_prefix = "[pick("strange","anomalous","exotic","atypical","unusual","incongruous","weird","aberrant","eccentric")]"
var/name_suffix //blank because it's randomized per sample appearance
@@ -62,7 +66,8 @@
name_suffix = "[pick("object","sample","thing","fragment","specimen","element","alloy","chunk","remnant","scrap","sliver")]"
name = "[name_prefix] [name_suffix]"
rand_tech = pick(valid_techs) //assign techs last
origin_tech.Add(list("[rand_tech]" = tech_value))
LAZYSET(new_tech, rand_tech, tech_value)
origin_tech = new_tech
/obj/item/research_sample/attack_hand(mob/user)
. = ..()

View File

@@ -80,6 +80,8 @@ export class Port extends Component<PortProps, PortState> {
const { portRef: iconRef } = this.state;
const { port, color, output } = this.props;
const style = { display: output ? 'block' : 'flex' };
return (
<Tooltip
content={decodeHtmlEntities(port.type)}
@@ -94,6 +96,7 @@ export class Port extends Component<PortProps, PortState> {
onContextMenu={this.handlePortRightClick}
onMouseUp={this.handlePortMouseUp}
textAlign="center"
style={style}
>
<svg
style={{ width: '100%', height: '100%', position: 'absolute' }}

View File

@@ -6,6 +6,7 @@ const SVG_CURVE_INTENSITY = 64;
enum ConnectionStyle {
CURVE = 'curve',
SUBWAY = 'subway',
SUBWAY_SHARP = 'subway sharp',
}
export type Position = {
@@ -24,6 +25,8 @@ export type Connection = {
style?: ConnectionStyle;
// Optional: the ref of what element this connection is sourced
ref?: string;
// Optional: Used to group some connections together
index?: number;
};
export const Connections = (props: {
@@ -47,6 +50,7 @@ export const Connections = (props: {
position: 'absolute',
pointerEvents: 'none',
zIndex: zLayer,
overflow: 'visible',
}}
>
{connections.map((val, index) => {
@@ -76,6 +80,17 @@ export const Connections = (props: {
path += `L ${to.x} ${to.y}`;
break;
}
case ConnectionStyle.SUBWAY_SHARP: {
let offset = 16;
if (val.index !== undefined) {
offset = 8 * (val.index % 32) + 32;
}
const yDiff = Math.abs(to.y - from.y);
path += `L ${Math.max(from.x + offset, to.x - offset)} ${from.y}`;
path += `L ${Math.max(from.x + offset, to.x - offset)} ${to.y}`;
path += `L ${to.x} ${to.y}`;
break;
}
}
return (
@@ -83,6 +98,7 @@ export const Connections = (props: {
className={classes([
isColorClass(val.color) && `color-stroke-${val.color}`,
])}
stroke={(!isColorClass(val.color) && val.color) || undefined}
key={index}
d={path}
fill="transparent"