Skip to content

Commit

Permalink
[MIRROR] Allow copying loadout slots
Browse files Browse the repository at this point in the history
  • Loading branch information
SierraKomodo authored and LordNest committed Jan 5, 2025
1 parent 6b897d3 commit 7d578c6
Showing 1 changed file with 17 additions and 1 deletion.
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

0 comments on commit 7d578c6

Please sign in to comment.