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

[MIRROR] Allow copying loadout slots #2972

Merged
merged 1 commit into from
Jan 5, 2025
Merged
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
18 changes: 17 additions & 1 deletion code/modules/client/preference_setup/loadout/loadout.dm
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,9 @@ var/global/list/gear_datums = list()
. += "<b>[SPAN_COLOR(fcolor, "[total_cost]/[config.max_gear_cost]")] loadout points spent.</b>"

. += "<a href='?src=\ref[src];clear_loadout=1'>Clear Loadout</a>"
. += "<a href='?src=\ref[src];toggle_hiding=1'>[hide_unavailable_gear ? "Show all" : "Hide unavailable"]</a></center></td></tr>"
. += "<a href='?src=\ref[src];toggle_hiding=1'>[hide_unavailable_gear ? "Show all" : "Hide unavailable"]</a>"
. += "<a href='?src=\ref[src];copy_loadout=1'>Copy Loadout</a>"
. += "</center></td></tr>"

. += "<tr><td colspan=3><center><b>"
var/firstcat = 1
Expand Down Expand Up @@ -367,6 +369,20 @@ var/global/list/gear_datums = list()
if(href_list["toggle_hiding"])
hide_unavailable_gear = !hide_unavailable_gear
return TOPIC_REFRESH

if (href_list["copy_loadout"])
var/list/options = list()
for (var/count = 1 to config.loadout_slots)
if (count == pref.gear_slot)
continue
options += count
var/selected = input(user, "Select a loadout slot to copy from", "Copy Loadout") as null | anything in options
if (!selected)
return TOPIC_NOACTION
var/list/selected_list = pref.gear_list[selected]
pref.gear_list[pref.gear_slot] = selected_list.Copy()
return TOPIC_REFRESH_UPDATE_PREVIEW

return ..()

/datum/gear
Expand Down
Loading