Skip to content

Commit eac85ac

Browse files
committed
Selecting rewards.
1 parent 17779be commit eac85ac

2 files changed

Lines changed: 241 additions & 51 deletions

File tree

LuaRules/Gadgets/game_rogue_progression.lua

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,7 @@ local function SetupTeamProgression(teamID, rewards)
5252
end
5353
end
5454

55-
function gadget:RecvLuaMsg(message, playerID)
56-
if not (message and string.find(message, "rk_loadout")) then
57-
return
58-
end
55+
local function UpdateLoadout(message, playerID)
5956
local _, _, spectator, teamID = Spring.GetPlayerInfo(playerID)
6057
if spectator then
6158
return
@@ -64,6 +61,26 @@ function gadget:RecvLuaMsg(message, playerID)
6461
Spring.SetTeamRulesParam(teamID, "rk_loadout", loadout)
6562
end
6663

64+
local function SetRewardUsed(message, playerID)
65+
local _, _, spectator, teamID = Spring.GetPlayerInfo(playerID)
66+
if spectator then
67+
return
68+
end
69+
local rewardID = tonumber(message:sub(20))
70+
Spring.SetTeamRulesParam(teamID, "rk_reward_used_" .. rewardID, 1)
71+
end
72+
73+
function gadget:RecvLuaMsg(message, playerID)
74+
if not message then
75+
return
76+
end
77+
if string.find(message, "rk_loadout") then
78+
UpdateLoadout(message, playerID)
79+
elseif string.find(message, "rk_selected_reward") then
80+
SetRewardUsed(message, playerID)
81+
end
82+
end
83+
6784
local function SetupProgression()
6885
local planetID = tonumber(modOptions.rk_battle_planet)
6986
local galaxy = CustomKeyToUsefulTable(modOptions.rk_galaxy)

0 commit comments

Comments
 (0)