Skip to content
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

[Skyrat Mirror] [MODULAR] You can now rename and describe any loadout item, not just plushies. #151

Merged
merged 1 commit into from
Oct 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions code/__DEFINES/~skyrat_defines/loadouts.dm
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@

#define INFO_GREYSCALE "greyscale"
#define INFO_NAMED "name"
#define INFO_DESCRIBED "description"

/// Max amonut of misc / backpack items that are allowed.
#define MAX_ALLOWED_MISC_ITEMS 3
Expand Down
13 changes: 8 additions & 5 deletions modular_skyrat/modules/loadouts/loadout_items/_loadout_datum.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ GLOBAL_LIST_EMPTY(all_loadout_datums)
/datum/loadout_item
/// Displayed name of the loadout item.
var/name
/// Whether this item can be renamed.
var/can_be_named = FALSE
/// Whether this item can be renamed and described.
var/can_be_named = TRUE
/// The category of the loadout item.
var/category
/// The actual item path of the loadout item.
Expand Down Expand Up @@ -114,12 +114,15 @@ GLOBAL_LIST_EMPTY(all_loadout_datums)
else
stack_trace("[type] on_equip_item(): Could not locate backpack item (path: [item_path]) in [equipper]'s contents to set greyscaling!")

if(can_be_named && !visuals_only && (INFO_NAMED in our_loadout[item_path]))
if(can_be_named && !visuals_only)
var/obj/item/equipped_item = locate(item_path) in equipper.get_all_gear()
if(equipped_item)
equipped_item.name = our_loadout[item_path][INFO_NAMED]
if(INFO_NAMED in our_loadout[item_path])
equipped_item.name = our_loadout[item_path][INFO_NAMED]
if(INFO_DESCRIBED in our_loadout[item_path])
equipped_item.desc = our_loadout[item_path][INFO_DESCRIBED]
else
stack_trace("[type] on_equip_item(): Could not locate item (path: [item_path]) in [equipper]'s contents to set name!")
stack_trace("[type] on_equip_item(): Could not locate item (path: [item_path]) in [equipper]'s contents to set name/desc!")

/*
* Called after the item is equipped on [equipper], at the end of character setup.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ GLOBAL_LIST_INIT(loadout_toys, generate_loadout_items(/datum/loadout_item/toys))

/datum/loadout_item/toys
category = LOADOUT_ITEM_TOYS
can_be_named = TRUE

/*
* PLUSHIES
Expand Down
11 changes: 10 additions & 1 deletion modular_skyrat/modules/loadouts/loadout_ui/loadout_manager.dm
Original file line number Diff line number Diff line change
Expand Up @@ -208,10 +208,14 @@
/// Set [item]'s name to input provided.
/datum/loadout_manager/proc/set_item_name(datum/loadout_item/item)
var/current_name = ""
var/current_desc = ""
if(INFO_NAMED in owner.prefs.loadout_list[item.item_path])
current_name = owner.prefs.loadout_list[item.item_path][INFO_NAMED]
if(INFO_DESCRIBED in owner.prefs.loadout_list[item.item_path])
current_desc = owner.prefs.loadout_list[item.item_path][INFO_DESCRIBED]

var/input_name = stripped_input(owner, "What name do you want to give [item.name]? Leave blank to clear.", "[item.name] name", current_name, MAX_NAME_LEN)
var/input_name = tgui_input_text(owner, "What name do you want to give [item.name]? Leave blank to clear.", "[item.name] name", current_name, MAX_NAME_LEN)
var/input_desc = tgui_input_text(owner, "What description do you want to give [item.name]? 256 character max, leave blank to clear.", "[item.name] description", current_desc, 256, multiline = TRUE)
if(QDELETED(src) || QDELETED(owner) || QDELETED(owner.prefs))
return

Expand All @@ -224,6 +228,11 @@
else
if(INFO_NAMED in owner.prefs.loadout_list[item.item_path])
owner.prefs.loadout_list[item.item_path] -= INFO_NAMED
if(input_desc)
owner.prefs.loadout_list[item.item_path][INFO_DESCRIBED] = input_desc
else
if(INFO_DESCRIBED in owner.prefs.loadout_list[item.item_path])
owner.prefs.loadout_list[item.item_path] -= INFO_DESCRIBED

/datum/loadout_manager/proc/display_job_restrictions(datum/loadout_item/item)
if(!length(item.restricted_roles))
Expand Down
Loading