Skip to content
Draft
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
5 changes: 5 additions & 0 deletions localization/en-us.lua
Original file line number Diff line number Diff line change
Expand Up @@ -955,6 +955,7 @@ return {
b_preview_integration = "Enable Score Preview",
b_view_nemesis_deck = "View Decks",
b_toggle_jokers = "Toggle Jokers",
b_rematch = "Rematch",
b_skip_tutorial = "Skip Tutorial",
k_yes = "Yes",
k_no = "No",
Expand All @@ -978,6 +979,10 @@ return {
k_coming_soon = "Coming Soon!",
k_wait_enemy = "Waiting for enemy to finish...",
k_wait_enemy_reach_this_blind = "Waiting for enemy to reach this blind...",
k_rematch_ready_count = "Rematch Ready: %s",
k_rematch_same_seed = "Same Seed",
k_rematch_same_seed_on = "On",
k_rematch_same_seed_off = "Off",
k_lives = "Lives",
k_lost_life = "Lost a life",
k_total_lives_lost = " Total Lives Lost",
Expand Down
44 changes: 43 additions & 1 deletion networking-old/action_handlers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,9 +117,17 @@ local function action_start_game(seed, stake_str)
MP.reset_game_states()
local stake = tonumber(stake_str)
MP.ACTIONS.set_ante(0)
if not MP.LOBBY.config.different_seeds and MP.LOBBY.config.custom_seed ~= "random" then
if MP.REMATCH and MP.REMATCH.seed_override and MP.REMATCH.seed_override ~= "" then
seed = MP.REMATCH.seed_override
elseif not MP.LOBBY.config.different_seeds and MP.LOBBY.config.custom_seed ~= "random" then
seed = MP.LOBBY.config.custom_seed
end
if MP.REMATCH then
MP.REMATCH.pending_start = false
MP.REMATCH.commit_sent = false
MP.REMATCH.starting = false
MP.REMATCH.seed_override = nil
end
G.FUNCS.lobby_start_run(nil, { seed = seed, stake = stake })
MP.LOBBY.ready_to_start = false
end
Expand Down Expand Up @@ -213,6 +221,22 @@ local function action_stop_game()
MP.UI.update_connection_status()
MP.reset_game_states()
end
if
MP.LOBBY.code
and MP.LOBBY.is_host
and MP.REMATCH
and MP.REMATCH.pending_start
and not MP.REMATCH.starting
then
MP.REMATCH.starting = true
G.E_MANAGER:add_event(Event({
trigger = "immediate",
func = function()
MP.ACTIONS.start_game()
return true
end,
}))
end
end

local function action_end_pvp()
Expand Down Expand Up @@ -833,6 +857,21 @@ function MP.ACTIONS.sync_client()
Client.send("action:syncClient,isCached:" .. tostring(_RELEASE_MODE))
end

function MP.ACTIONS.modded(modId, modAction, params, target)
local parts = {
"action:moddedAction",
"modId:" .. tostring(modId),
"modAction:" .. tostring(modAction),
}
if params then
for k, v in pairs(params) do
parts[#parts + 1] = tostring(k) .. ":" .. tostring(v)
end
end
if target then parts[#parts + 1] = "target:" .. tostring(target) end
Client.send(table.concat(parts, ","))
end

-- #endregion Client to Server

-- Utils
Expand Down Expand Up @@ -961,6 +1000,9 @@ function Game:update(dt)
action_start_ante_timer(parsedAction.time)
elseif parsedAction.action == "pauseAnteTimer" then
action_pause_ante_timer(parsedAction.time)
elseif parsedAction.action == "moddedAction" then
local registry = MP.MOD_ACTIONS[parsedAction.modId]
if registry and registry[parsedAction.modAction] then registry[parsedAction.modAction](parsedAction) end
elseif parsedAction.action == "error" then
action_error(parsedAction.message)
elseif parsedAction.action == "keepAlive" then
Expand Down
26 changes: 25 additions & 1 deletion networking/action_handlers.lua
Original file line number Diff line number Diff line change
Expand Up @@ -231,9 +231,17 @@ local function action_start_game(seed, stake_str)
MP.reset_game_states()
local stake = tonumber(stake_str)
MP.ACTIONS.set_ante(0)
if not MP.LOBBY.config.different_seeds and MP.LOBBY.config.custom_seed ~= "random" then
if MP.REMATCH and MP.REMATCH.seed_override and MP.REMATCH.seed_override ~= "" then
seed = MP.REMATCH.seed_override
elseif not MP.LOBBY.config.different_seeds and MP.LOBBY.config.custom_seed ~= "random" then
seed = MP.LOBBY.config.custom_seed
end
if MP.REMATCH then
MP.REMATCH.pending_start = false
MP.REMATCH.commit_sent = false
MP.REMATCH.starting = false
MP.REMATCH.seed_override = nil
end
G.FUNCS.lobby_start_run(nil, { seed = seed, stake = stake })
MP.LOBBY.ready_to_start = false
end
Expand Down Expand Up @@ -333,6 +341,22 @@ local function action_stop_game()
MP.UI.update_connection_status()
MP.reset_game_states()
end
if
MP.LOBBY.code
and MP.LOBBY.is_host
and MP.REMATCH
and MP.REMATCH.pending_start
and not MP.REMATCH.starting
then
MP.REMATCH.starting = true
G.E_MANAGER:add_event(Event({
trigger = "immediate",
func = function()
MP.ACTIONS.start_game()
return true
end,
}))
end
end

local function action_end_pvp()
Expand Down
Loading