mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
[Manual Port] of the robot sprite iconforge migration (#9743)
This commit is contained in:
@@ -356,7 +356,7 @@ GLOBAL_LIST_EMPTY(text_tag_cache)
|
|||||||
if(!(C && C.prefs?.read_preference(/datum/preference/toggle/chat_tags)))
|
if(!(C && C.prefs?.read_preference(/datum/preference/toggle/chat_tags)))
|
||||||
return tagdesc
|
return tagdesc
|
||||||
if(!GLOB.text_tag_cache[tagname])
|
if(!GLOB.text_tag_cache[tagname])
|
||||||
var/datum/asset/spritesheet/chatassets = get_asset_datum(/datum/asset/spritesheet/chat)
|
var/datum/asset/spritesheet_batched/chatassets = get_asset_datum(/datum/asset/spritesheet_batched/chat)
|
||||||
GLOB.text_tag_cache[tagname] = chatassets.icon_tag(tagname)
|
GLOB.text_tag_cache[tagname] = chatassets.icon_tag(tagname)
|
||||||
if(!C.tgui_panel.is_ready() || C.tgui_panel.oldchat)
|
if(!C.tgui_panel.is_ready() || C.tgui_panel.oldchat)
|
||||||
return "<IMG src='\ref[text_tag_icons]' class='text_tag' iconstate='[tagname]'" + (tagdesc ? " alt='[tagdesc]'" : "") + ">"
|
return "<IMG src='\ref[text_tag_icons]' class='text_tag' iconstate='[tagname]'" + (tagdesc ? " alt='[tagdesc]'" : "") + ">"
|
||||||
|
|||||||
@@ -45,13 +45,13 @@
|
|||||||
|
|
||||||
/datum/eventkit/modify_robot/ui_assets(mob/user)
|
/datum/eventkit/modify_robot/ui_assets(mob/user)
|
||||||
return list(
|
return list(
|
||||||
get_asset_datum(/datum/asset/spritesheet/robot_icons)
|
get_asset_datum(/datum/asset/spritesheet_batched/robot_icons)
|
||||||
)
|
)
|
||||||
|
|
||||||
/datum/eventkit/modify_robot/tgui_data(mob/user)
|
/datum/eventkit/modify_robot/tgui_data(mob/user)
|
||||||
. = list()
|
. = list()
|
||||||
// Target section for general data
|
// Target section for general data
|
||||||
var/datum/asset/spritesheet/robot_icons/spritesheet = get_asset_datum(/datum/asset/spritesheet/robot_icons)
|
var/datum/asset/spritesheet_batched/robot_icons/spritesheet = get_asset_datum(/datum/asset/spritesheet_batched/robot_icons)
|
||||||
|
|
||||||
if(target)
|
if(target)
|
||||||
.["target"] = list()
|
.["target"] = list()
|
||||||
@@ -589,7 +589,7 @@
|
|||||||
target_items += list(list("name" = item.name, "ref" = "\ref[item]", "icon" = icon2html(item, user, sourceonly=TRUE), "desc" = item.desc))
|
target_items += list(list("name" = item.name, "ref" = "\ref[item]", "icon" = icon2html(item, user, sourceonly=TRUE), "desc" = item.desc))
|
||||||
return target_items
|
return target_items
|
||||||
|
|
||||||
/datum/eventkit/modify_robot/proc/get_module_source(var/mob/user, var/datum/asset/spritesheet/robot_icons/spritesheet)
|
/datum/eventkit/modify_robot/proc/get_module_source(var/mob/user, var/datum/asset/spritesheet_batched/robot_icons/spritesheet)
|
||||||
var/list/source_list = list()
|
var/list/source_list = list()
|
||||||
source_list["model"] = source.module
|
source_list["model"] = source.module
|
||||||
source_list["sprite"] = sanitize_css_class_name("[source.sprite_datum.type]")
|
source_list["sprite"] = sanitize_css_class_name("[source.sprite_datum.type]")
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/datum/asset/spritesheet/chat
|
/datum/asset/spritesheet_batched/chat
|
||||||
name = "chat"
|
name = "chat"
|
||||||
|
|
||||||
/datum/asset/spritesheet/chat/create_spritesheets()
|
/datum/asset/spritesheet_batched/chat/create_spritesheets()
|
||||||
InsertAll("", text_tag_icons) // OOC, LOOC ect icons
|
insert_all_icons("", text_tag_icons, prefix_with_dirs = FALSE) // OOC, LOOC ect icons
|
||||||
|
|||||||
@@ -1,36 +1,52 @@
|
|||||||
/datum/asset/spritesheet/robot_icons
|
/datum/asset/spritesheet_batched/robot_icons
|
||||||
name = "robot_icons"
|
name = "robot_icons"
|
||||||
|
|
||||||
/datum/asset/spritesheet/robot_icons/create_spritesheets()
|
/datum/asset/spritesheet_batched/robot_icons/create_spritesheets()
|
||||||
for(var/datum/robot_sprite/S as anything in typesof(/datum/robot_sprite))
|
for(var/datum/robot_sprite/S as anything in typesof(/datum/robot_sprite))
|
||||||
if(!S.name || !S.sprite_icon_state) // snowflake out those customs... they suck
|
if(!S.name || !S.sprite_icon_state) // snowflake out those customs... they suck
|
||||||
continue
|
continue
|
||||||
var/icon/I_N = icon(S.sprite_icon, S.sprite_icon_state, NORTH)
|
|
||||||
var/icon/I_S = icon(S.sprite_icon, S.sprite_icon_state, SOUTH)
|
var/datum/universal_icon/I_N = uni_icon(S.sprite_icon, S.sprite_icon_state, NORTH)
|
||||||
var/icon/I_W = icon(S.sprite_icon, S.sprite_icon_state, WEST)
|
var/datum/universal_icon/I_S = uni_icon(S.sprite_icon, S.sprite_icon_state, SOUTH)
|
||||||
var/icon/I_E = icon(S.sprite_icon, S.sprite_icon_state, EAST)
|
var/datum/universal_icon/I_W = uni_icon(S.sprite_icon, S.sprite_icon_state, WEST)
|
||||||
|
var/datum/universal_icon/I_E = uni_icon(S.sprite_icon, S.sprite_icon_state, EAST)
|
||||||
|
|
||||||
if(S.has_eye_sprites)
|
if(S.has_eye_sprites)
|
||||||
var/icon/I_NE = icon(S.sprite_icon, "[S.sprite_icon_state]-eyes", NORTH)
|
var/datum/universal_icon/I_NE = uni_icon(S.sprite_icon, "[S.sprite_icon_state]-eyes", NORTH)
|
||||||
if(I_NE)
|
if(I_NE)
|
||||||
I_N.Blend(I_NE, ICON_OVERLAY)
|
I_N.blend_icon(I_NE, ICON_OVERLAY)
|
||||||
if(S.has_eye_sprites)
|
if(S.has_eye_sprites)
|
||||||
var/icon/I_SE = icon(S.sprite_icon, "[S.sprite_icon_state]-eyes", SOUTH)
|
var/datum/universal_icon/I_SE = uni_icon(S.sprite_icon, "[S.sprite_icon_state]-eyes", SOUTH)
|
||||||
if(I_SE)
|
if(I_SE)
|
||||||
I_S.Blend(I_SE, ICON_OVERLAY)
|
I_S.blend_icon(I_SE, ICON_OVERLAY)
|
||||||
if(S.has_eye_sprites)
|
if(S.has_eye_sprites)
|
||||||
var/icon/I_WE = icon(S.sprite_icon, "[S.sprite_icon_state]-eyes", WEST)
|
var/datum/universal_icon/I_WE = uni_icon(S.sprite_icon, "[S.sprite_icon_state]-eyes", WEST)
|
||||||
if(I_WE)
|
if(I_WE)
|
||||||
I_W.Blend(I_WE, ICON_OVERLAY)
|
I_W.blend_icon(I_WE, ICON_OVERLAY)
|
||||||
if(S.has_eye_sprites)
|
if(S.has_eye_sprites)
|
||||||
var/icon/I_EE = icon(S.sprite_icon, "[S.sprite_icon_state]-eyes", EAST)
|
var/datum/universal_icon/I_EE = uni_icon(S.sprite_icon, "[S.sprite_icon_state]-eyes", EAST)
|
||||||
if(I_EE)
|
if(I_EE)
|
||||||
I_E.Blend(I_EE, ICON_OVERLAY)
|
I_E.blend_icon(I_EE, ICON_OVERLAY)
|
||||||
|
|
||||||
var/imgid = sanitize_css_class_name("[S.type]")
|
var/imgid = sanitize_css_class_name("[S.type]")
|
||||||
I_N.Scale(120, 120)
|
if(S.icon_x > S.icon_y)
|
||||||
I_S.Scale(120, 120)
|
var/buffer = (S.icon_x - S.icon_y) / 2
|
||||||
I_W.Scale(120, 120)
|
I_N.crop(0, -buffer, S.icon_x, S.icon_y + buffer)
|
||||||
I_E.Scale(120, 120)
|
I_S.crop(0, -buffer, S.icon_x, S.icon_y + buffer)
|
||||||
Insert(imgid + "N", I_N)
|
I_W.crop(0, -buffer, S.icon_x, S.icon_y + buffer)
|
||||||
Insert(imgid + "S", I_S)
|
I_E.crop(0, -buffer, S.icon_x, S.icon_y + buffer)
|
||||||
Insert(imgid + "W", I_W)
|
else if (S.icon_x < S.icon_y)
|
||||||
Insert(imgid + "E", I_E)
|
var/buffer = (S.icon_y - S.icon_x) / 2
|
||||||
|
I_N.crop(-buffer, 0, S.icon_x + buffer, S.icon_y)
|
||||||
|
I_S.crop(-buffer, 0, S.icon_x + buffer, S.icon_y)
|
||||||
|
I_W.crop(-buffer, 0, S.icon_x + buffer, S.icon_y)
|
||||||
|
I_E.crop(-buffer, 0, S.icon_x + buffer, S.icon_y)
|
||||||
|
I_N.scale(120, 120)
|
||||||
|
I_S.scale(120, 120)
|
||||||
|
I_W.scale(120, 120)
|
||||||
|
I_E.scale(120, 120)
|
||||||
|
|
||||||
|
insert_icon(imgid + "N", I_N)
|
||||||
|
insert_icon(imgid + "S", I_S)
|
||||||
|
insert_icon(imgid + "W", I_W)
|
||||||
|
insert_icon(imgid + "E", I_E)
|
||||||
|
|||||||
@@ -357,6 +357,8 @@
|
|||||||
sprite_datum = module_sprites[1]
|
sprite_datum = module_sprites[1]
|
||||||
sprite_datum.do_equipment_glamour(module)
|
sprite_datum.do_equipment_glamour(module)
|
||||||
return
|
return
|
||||||
|
if(mind)
|
||||||
|
sprite_name = mind.name
|
||||||
if(!selecting_module)
|
if(!selecting_module)
|
||||||
var/datum/tgui_module/robot_ui_module/ui = new(src)
|
var/datum/tgui_module/robot_ui_module/ui = new(src)
|
||||||
ui.tgui_interact(src)
|
ui.tgui_interact(src)
|
||||||
|
|||||||
@@ -23,7 +23,7 @@
|
|||||||
|
|
||||||
/datum/tgui_module/robot_ui_module/ui_assets(mob/user)
|
/datum/tgui_module/robot_ui_module/ui_assets(mob/user)
|
||||||
return list(
|
return list(
|
||||||
get_asset_datum(/datum/asset/spritesheet/robot_icons)
|
get_asset_datum(/datum/asset/spritesheet_batched/robot_icons)
|
||||||
)
|
)
|
||||||
|
|
||||||
/datum/tgui_module/robot_ui_module/tgui_static_data()
|
/datum/tgui_module/robot_ui_module/tgui_static_data()
|
||||||
@@ -55,6 +55,7 @@
|
|||||||
if(is_borg_whitelisted(R, module_name))
|
if(is_borg_whitelisted(R, module_name))
|
||||||
modules |= module_name
|
modules |= module_name
|
||||||
data["possible_modules"] = modules
|
data["possible_modules"] = modules
|
||||||
|
data["mind_name"] = R.mind.name
|
||||||
if(R.emagged)
|
if(R.emagged)
|
||||||
data["theme"] = "syndicate"
|
data["theme"] = "syndicate"
|
||||||
else if (R.ui_theme)
|
else if (R.ui_theme)
|
||||||
@@ -66,7 +67,7 @@
|
|||||||
var/list/data = ..()
|
var/list/data = ..()
|
||||||
|
|
||||||
var/mob/living/silicon/robot/R = host
|
var/mob/living/silicon/robot/R = host
|
||||||
var/datum/asset/spritesheet/robot_icons/spritesheet = get_asset_datum(/datum/asset/spritesheet/robot_icons)
|
var/datum/asset/spritesheet_batched/robot_icons/spritesheet = get_asset_datum(/datum/asset/spritesheet_batched/robot_icons)
|
||||||
|
|
||||||
data["currentName"] = new_name ? new_name : R.name
|
data["currentName"] = new_name ? new_name : R.name
|
||||||
data["isDefaultName"] = !new_name
|
data["isDefaultName"] = !new_name
|
||||||
@@ -142,6 +143,7 @@
|
|||||||
var/name = params["value"]
|
var/name = params["value"]
|
||||||
if(name)
|
if(name)
|
||||||
new_name = sanitizeSafe(name, MAX_NAME_LEN)
|
new_name = sanitizeSafe(name, MAX_NAME_LEN)
|
||||||
|
R.sprite_name = new_name
|
||||||
. = TRUE
|
. = TRUE
|
||||||
if("confirm")
|
if("confirm")
|
||||||
R.apply_name(new_name)
|
R.apply_name(new_name)
|
||||||
|
|||||||
@@ -24,6 +24,8 @@
|
|||||||
var/has_custom_equipment_sprites = FALSE
|
var/has_custom_equipment_sprites = FALSE
|
||||||
var/vis_height = 32
|
var/vis_height = 32
|
||||||
var/pixel_x = 0
|
var/pixel_x = 0
|
||||||
|
var/icon_x = 32
|
||||||
|
var/icon_y = 32
|
||||||
|
|
||||||
var/is_whitelisted = FALSE
|
var/is_whitelisted = FALSE
|
||||||
var/whitelist_ckey
|
var/whitelist_ckey
|
||||||
@@ -188,6 +190,8 @@
|
|||||||
has_dead_sprite_overlay = TRUE
|
has_dead_sprite_overlay = TRUE
|
||||||
has_custom_equipment_sprites = TRUE
|
has_custom_equipment_sprites = TRUE
|
||||||
pixel_x = -16
|
pixel_x = -16
|
||||||
|
icon_x = 64
|
||||||
|
icon_y = 32
|
||||||
|
|
||||||
/datum/robot_sprite/dogborg/do_equipment_glamour(var/obj/item/robot_module/module)
|
/datum/robot_sprite/dogborg/do_equipment_glamour(var/obj/item/robot_module/module)
|
||||||
if(!has_custom_equipment_sprites)
|
if(!has_custom_equipment_sprites)
|
||||||
@@ -207,7 +211,8 @@
|
|||||||
has_dead_sprite_overlay = FALSE
|
has_dead_sprite_overlay = FALSE
|
||||||
has_custom_equipment_sprites = FALSE
|
has_custom_equipment_sprites = FALSE
|
||||||
vis_height = 64
|
vis_height = 64
|
||||||
pixel_x = -16
|
icon_x = 64
|
||||||
|
icon_y = 64
|
||||||
|
|
||||||
// Default module sprite
|
// Default module sprite
|
||||||
|
|
||||||
@@ -222,5 +227,6 @@
|
|||||||
/datum/robot_sprite/dogborg/raptor
|
/datum/robot_sprite/dogborg/raptor
|
||||||
has_dead_sprite_overlay = FALSE
|
has_dead_sprite_overlay = FALSE
|
||||||
vis_height = 45
|
vis_height = 45
|
||||||
pixel_x = -16
|
icon_x = 64
|
||||||
|
icon_y = 64
|
||||||
//CHOMPAdd End
|
//CHOMPAdd End
|
||||||
|
|||||||
@@ -19,6 +19,8 @@
|
|||||||
has_dead_sprite = TRUE
|
has_dead_sprite = TRUE
|
||||||
has_dead_sprite_overlay = TRUE
|
has_dead_sprite_overlay = TRUE
|
||||||
pixel_x = -16
|
pixel_x = -16
|
||||||
|
icon_x = 64
|
||||||
|
icon_y = 32
|
||||||
|
|
||||||
whitelist_ckey = "argonne"
|
whitelist_ckey = "argonne"
|
||||||
whitelist_charname = "RUSS"
|
whitelist_charname = "RUSS"
|
||||||
@@ -80,6 +82,8 @@
|
|||||||
has_dead_sprite = TRUE
|
has_dead_sprite = TRUE
|
||||||
has_dead_sprite_overlay = TRUE
|
has_dead_sprite_overlay = TRUE
|
||||||
pixel_x = -16
|
pixel_x = -16
|
||||||
|
icon_x = 64
|
||||||
|
icon_y = 32
|
||||||
|
|
||||||
whitelist_ckey = "jademanique"
|
whitelist_ckey = "jademanique"
|
||||||
whitelist_charname = "B.A.U-Kingside"
|
whitelist_charname = "B.A.U-Kingside"
|
||||||
@@ -101,6 +105,8 @@
|
|||||||
has_dead_sprite = TRUE
|
has_dead_sprite = TRUE
|
||||||
has_dead_sprite_overlay = TRUE
|
has_dead_sprite_overlay = TRUE
|
||||||
pixel_x = -16
|
pixel_x = -16
|
||||||
|
icon_x = 64
|
||||||
|
icon_y = 32
|
||||||
|
|
||||||
whitelist_ckey = "lunarfleet"
|
whitelist_ckey = "lunarfleet"
|
||||||
whitelist_charname = "Clea-Nor"
|
whitelist_charname = "Clea-Nor"
|
||||||
|
|||||||
@@ -50,7 +50,7 @@
|
|||||||
))
|
))
|
||||||
window.send_asset(get_asset_datum(/datum/asset/simple/namespaced/fontawesome))
|
window.send_asset(get_asset_datum(/datum/asset/simple/namespaced/fontawesome))
|
||||||
window.send_asset(get_asset_datum(/datum/asset/simple/namespaced/tgfont))
|
window.send_asset(get_asset_datum(/datum/asset/simple/namespaced/tgfont))
|
||||||
window.send_asset(get_asset_datum(/datum/asset/spritesheet/chat))
|
window.send_asset(get_asset_datum(/datum/asset/spritesheet_batched/chat))
|
||||||
// Other setup
|
// Other setup
|
||||||
request_telemetry()
|
request_telemetry()
|
||||||
addtimer(CALLBACK(src, PROC_REF(on_initialize_timed_out)), 5 SECONDS)
|
addtimer(CALLBACK(src, PROC_REF(on_initialize_timed_out)), 5 SECONDS)
|
||||||
|
|||||||
BIN
librust_g.so
BIN
librust_g.so
Binary file not shown.
BIN
rust_g.dll
BIN
rust_g.dll
Binary file not shown.
@@ -1,3 +1,4 @@
|
|||||||
|
import { useState } from 'react';
|
||||||
import { useBackend } from 'tgui/backend';
|
import { useBackend } from 'tgui/backend';
|
||||||
import { Box, Button, Flex, Input, Section, Stack } from 'tgui-core/components';
|
import { Box, Button, Flex, Input, Section, Stack } from 'tgui-core/components';
|
||||||
import { classes } from 'tgui-core/react';
|
import { classes } from 'tgui-core/react';
|
||||||
@@ -6,12 +7,14 @@ import { Tooltip } from '../../components';
|
|||||||
|
|
||||||
export const IconSection = (props: {
|
export const IconSection = (props: {
|
||||||
currentName: string;
|
currentName: string;
|
||||||
|
mindName: string;
|
||||||
isDefaultName: boolean;
|
isDefaultName: boolean;
|
||||||
sprite?: string | null;
|
sprite?: string | null;
|
||||||
size?: string | null;
|
size?: string | null;
|
||||||
}) => {
|
}) => {
|
||||||
const { act } = useBackend();
|
const { act } = useBackend();
|
||||||
const { currentName, isDefaultName, sprite, size } = props;
|
const { currentName, mindName, isDefaultName, sprite, size } = props;
|
||||||
|
const [robotName, setRobotName] = useState<string>(currentName);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Section
|
<Section
|
||||||
@@ -30,17 +33,30 @@ export const IconSection = (props: {
|
|||||||
<Stack.Item>
|
<Stack.Item>
|
||||||
<Box>Name: </Box>
|
<Box>Name: </Box>
|
||||||
</Stack.Item>
|
</Stack.Item>
|
||||||
<Stack.Item basis="100%">
|
<Stack.Item grow>
|
||||||
<Tooltip content="Adjust your name">
|
<Tooltip content="Adjust your name">
|
||||||
<Input
|
<Input
|
||||||
fluid
|
fluid
|
||||||
value={currentName}
|
value={robotName}
|
||||||
onChange={(e, value) => act('rename', { value })}
|
onChange={(e, value) => {
|
||||||
|
act('rename', { value });
|
||||||
|
setRobotName(value);
|
||||||
|
}}
|
||||||
maxLength={52}
|
maxLength={52}
|
||||||
textColor={isDefaultName ? 'red' : undefined}
|
textColor={isDefaultName ? 'red' : undefined}
|
||||||
/>
|
/>
|
||||||
</Tooltip>
|
</Tooltip>
|
||||||
</Stack.Item>
|
</Stack.Item>
|
||||||
|
<Stack.Item>
|
||||||
|
<Button
|
||||||
|
icon="floppy-disk"
|
||||||
|
tooltip="Load character slot name"
|
||||||
|
onClick={() => {
|
||||||
|
act('rename', { value: mindName });
|
||||||
|
setRobotName(mindName);
|
||||||
|
}}
|
||||||
|
/>
|
||||||
|
</Stack.Item>
|
||||||
</Stack>
|
</Stack>
|
||||||
</Stack.Item>
|
</Stack.Item>
|
||||||
{!!sprite && !!size && (
|
{!!sprite && !!size && (
|
||||||
|
|||||||
@@ -17,6 +17,7 @@ export const RobotChoose = (props) => {
|
|||||||
sprite_datum,
|
sprite_datum,
|
||||||
theme,
|
theme,
|
||||||
currentName,
|
currentName,
|
||||||
|
mind_name,
|
||||||
isDefaultName,
|
isDefaultName,
|
||||||
sprite_datum_class,
|
sprite_datum_class,
|
||||||
sprite_datum_size,
|
sprite_datum_size,
|
||||||
@@ -38,6 +39,7 @@ export const RobotChoose = (props) => {
|
|||||||
/>
|
/>
|
||||||
<IconSection
|
<IconSection
|
||||||
currentName={currentName}
|
currentName={currentName}
|
||||||
|
mindName={mind_name}
|
||||||
isDefaultName={isDefaultName}
|
isDefaultName={isDefaultName}
|
||||||
sprite={sprite_datum_class}
|
sprite={sprite_datum_class}
|
||||||
size={sprite_datum_size}
|
size={sprite_datum_size}
|
||||||
|
|||||||
@@ -1,5 +1,6 @@
|
|||||||
export type Data = {
|
export type Data = {
|
||||||
possible_modules: string[];
|
possible_modules: string[];
|
||||||
|
mind_name: string;
|
||||||
possible_sprites?: spriteOption[];
|
possible_sprites?: spriteOption[];
|
||||||
currentName: string;
|
currentName: string;
|
||||||
isDefaultName: boolean;
|
isDefaultName: boolean;
|
||||||
|
|||||||
Reference in New Issue
Block a user