Skip to content

Commit

Permalink
Tentative ponr fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rockymoto517 committed Aug 3, 2023
1 parent c7fd874 commit e8ae5b6
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 5 deletions.
7 changes: 7 additions & 0 deletions lua/basenetworksession.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
Hooks:PostHook(BaseNetworkSession, "spawn_players", "eclipse_spawn_players", function()
if managers.mission._instant_start_ponr then
managers.groupai:set_state("ponr")
managers.groupai:state():on_police_called("default")
managers.groupai:state():set_difficulty(1)
end
end)
1 change: 1 addition & 0 deletions lua/groupaistatebase.lua
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ function GroupAIStateBase:_update_point_of_no_return(t, dt)
if self._point_of_no_return_timer <= 0 then
if Network:is_server() then
managers.groupai:set_state("ponr")
managers.network:session():send_to_peers_synched("sync_assault_ponr")
self:set_difficulty(1)
end
self:remove_point_of_no_return_timer(-1)
Expand Down
19 changes: 19 additions & 0 deletions lua/groupaistatebesiege.lua
Original file line number Diff line number Diff line change
Expand Up @@ -1269,6 +1269,7 @@ function GroupAIStatePonr:init(state, data)
if Network:is_server() and managers.navigation:is_data_ready() then
self:_queue_police_upd_task()
end
self._delayed_hud_banner_update = false
self:force_end_assault_phase(true)
end

Expand All @@ -1294,3 +1295,21 @@ function GroupAIStatePonr._extract_group_desc_structure(spawn_entry_outer, valid
end
end
end

function GroupAIStatePonr:set_assault_endless(enabled)
if not managers.hud._hud_assault_corner then
self._delayed_hud_banner_update = true
self._delayed_hud_banner_update_arg = enabled
else
GroupAIStatePonr.super.set_assault_endless(self, enabled)
end
end

function GroupAIStatePonr:update(t, dt)
GroupAIStatePonr.super.update(self, t, dt)

if self._delayed_hud_banner_update and managers.hud._hud_assault_corner then
GroupAIStatePonr.super.set_assault_endless(self, self._delayed_hud_banner_update_arg)
self._delayed_hud_banner_update = false
end
end
10 changes: 9 additions & 1 deletion lua/hudassaultcorner.lua
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
if StreamHeist.settings.ponr_assault_text then
Hooks:PostHook(HUDAssaultCorner, "init", "eclipse_assault_corner_init", function(self)
self._ponr_state = false
end)

function HUDAssaultCorner:set_ponr_state()
self._ponr_state = true
end

function HUDAssaultCorner:sync_start_assault(assault_number)
if self._point_of_no_return or self._casing then
return
Expand Down Expand Up @@ -34,7 +42,7 @@ if StreamHeist.settings.ponr_assault_text then
if managers.job:current_difficulty_stars() > 0 then
local ids_risk = Idstring("risk")

if managers.groupai:state_name() == "ponr" then
if managers.groupai:state_name() == "ponr" or self._ponr_state then
if diff_i == 6 then
return {
"hud_assault_ponr",
Expand Down
3 changes: 1 addition & 2 deletions lua/missionmanager.lua
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,7 @@ Hooks:PreHook(MissionManager, "_activate_mission", "sh__activate_mission", funct
-- instantly force into post ponr state
if data.set_ponr_state then
if Network:is_server() then
managers.groupai:set_state("ponr")
managers.groupai:state():set_difficulty(1)
self._instant_start_ponr = true
end
end
end
Expand Down
8 changes: 8 additions & 0 deletions lua/unitnetworkhandler.lua
Original file line number Diff line number Diff line change
Expand Up @@ -97,3 +97,11 @@ function UnitNetworkHandler:sync_cs_grenade(detonate_pos, shooter_pos, duration)

managers.groupai:state():sync_cs_grenade(detonate_pos, shooter_pos, duration)
end

function UnitNetworkHandler:sync_assault_ponr(sender)
if not self._verify_gamestate(self._gamestate_filter.any_ingame) or not self._verify_sender(sender) then
return
end

managers.hud._hud_assault_corner:set_ponr_state()
end
2 changes: 1 addition & 1 deletion meta.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[
{
"ident": "eclipse_difficulty",
"version": "5.0",
"version": "5.1",
"patchnotes_url": "https://github.com/mrcreepysos/Eclipse-Difficulty/commits/main",
"download_url": "https://github.com/mrcreepysos/Eclipse-Difficulty/archive/refs/heads/main.zip"
}
Expand Down
2 changes: 1 addition & 1 deletion mod.txt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"contact" : "nikita_was_taken on Discord",
"image" : "mod.png",
"blt_version" : 2,
"version" : "5.0",
"version" : "5.1",
"updates" : [{
"identifier" : "eclipse_difficulty",
"host" : { "meta" : "https://raw.githubusercontent.com/mrcreepysos/Eclipse-Difficulty/main/meta.json" }
Expand Down
1 change: 1 addition & 0 deletions supermod.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
<group :hook_id="network/">
<post :hook_id="base/networkmanager"/>
<post :hook_id="handlers/unitnetworkhandler"/>
<post :hook_id="base/basenetworksession"/>
</group>

<post :hook_id="setups/gamesetup"/>
Expand Down

0 comments on commit e8ae5b6

Please sign in to comment.