-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* combat training * Disable bot & gamesetting customization menus - feature not yet available. - cleanup unused code
- Loading branch information
Showing
20 changed files
with
1,276 additions
and
1,218 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
#include scripts\mp\bots\bots; | ||
#include scripts\mp\bots\bots_util; | ||
|
||
main() | ||
{ | ||
initdvars(); | ||
replacefunc(scripts\mp\bots\bots::init, ::init_stub); | ||
replacefunc(scripts\mp\bots\bots_util::bot_get_client_limit, ::bot_get_client_limit); | ||
} | ||
|
||
initdvars() | ||
{ | ||
} | ||
|
||
gethostplayer() | ||
{ | ||
var_0 = getentarray( "player", "classname" ); | ||
|
||
for ( var_1 = 0; var_1 < var_0.size; var_1++ ) | ||
{ | ||
if ( var_0[var_1] ishost() ) | ||
return var_0[var_1]; | ||
} | ||
} | ||
|
||
get_host() | ||
{ | ||
host = gethostplayer(); | ||
|
||
while (!isdefined(host)) | ||
{ | ||
wait(0.25); | ||
host = gethostplayer(); | ||
} | ||
|
||
return host; | ||
} | ||
|
||
wait_for_host() | ||
{ | ||
host = get_host(); | ||
|
||
while ( isdefined( host ) && !host.hasspawned && !isdefined( host.selectedclass ) ) | ||
{ | ||
wait(0.25); | ||
} | ||
|
||
return 1; | ||
} | ||
|
||
init_stub() | ||
{ | ||
thread monitor_smoke_grenades(); | ||
thread bot_triggers(); | ||
initbotlevelvariables(); | ||
|
||
refresh_existing_bots(); | ||
wait_for_host(); | ||
|
||
var_0 = botautoconnectenabled(); | ||
setmatchdata( "hasBots", 1 ); | ||
level thread bot_connect_monitor(); | ||
} | ||
|
||
bot_get_client_limit() | ||
{ | ||
var_0 = getdvarint( "party_maxplayers", 0 ); | ||
|
||
maxclients = level.maxclients; | ||
|
||
if ( var_0 != level.maxclients && var_0 >= 1 ) | ||
{ | ||
if ( var_0 > 18 ) | ||
maxclients = 18; | ||
else | ||
maxclients = var_0; | ||
} | ||
|
||
setdvar( "sv_maxclients", maxclients ); | ||
return maxclients; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
party_minplayers 1 | ||
xblive_privatematch 1 | ||
xpartygo | ||
xblive_privatematch 0 | ||
wait 10 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
if not Engine.InFrontend() then | ||
return | ||
end | ||
|
||
-- GENERAL | ||
Engine.SetDvarBool("daily_login_bonus_enabled", false) | ||
|
||
function CONDITIONS.IsStoreAllowed(self) | ||
return true | ||
end | ||
|
||
function CODTV.IsCODTVEnabled() | ||
return false | ||
end | ||
|
||
-- MP | ||
if CONDITIONS.InFrontendPublicMP then | ||
function CONDITIONS.IsServerBrowserAllowed(self) | ||
return true | ||
end | ||
|
||
function CONDITIONS.IsGameBattlesAllowed(self) | ||
return CONDITIONS.IsServerBrowserAllowed(self) | ||
end | ||
end | ||
|
||
-- MP PRIVATE | ||
if CONDITIONS.InFrontend and Engine.IsCoreMode() and (IsPrivateMatch() or IsSystemLink()) then | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
if Engine.InFrontend() then | ||
return | ||
end | ||
|
||
-- Multiplayer | ||
if CONDITIONS.IsMultiplayer then | ||
function CONDITIONS.IsTeamChoiceAllowed(self) | ||
return IsCurrentGameTypeteamBased() | ||
end | ||
|
||
function CONDITIONS.IsCODCastingAllowed(self) | ||
return true | ||
end | ||
|
||
function CONDITIONS.IsTeamOrCodcasterChoiceAllowed(self) | ||
return CONDITIONS.IsTeamChoiceAllowed(self) or CONDITIONS.IsCODCastingAllowed(self) | ||
end | ||
|
||
function Lobby.IsTeamAssignmentEnabled() | ||
return true | ||
end | ||
end | ||
|
||
-- ZOMBIES | ||
if CONDITIONS.IsThirdGameMode then | ||
end | ||
|
||
-- Singleplayer | ||
if CONDITIONS.IsSingleplayer then | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
if CONDITIONS.InFrontend then | ||
require("InFrontend") | ||
end | ||
|
||
if CONDITIONS.InGame then | ||
require("InGame") | ||
end | ||
|
||
function CheckTURequirement(f10_arg0, f10_arg1) | ||
return false | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,237 @@ | ||
if Engine.InFrontend() then | ||
return | ||
end | ||
|
||
local RequestLeaveMenu = function(f1_arg0, f1_arg1) | ||
LUI.FlowManager.RequestLeaveMenu(f1_arg0) | ||
end | ||
|
||
local PopupMessage = function(f2_arg0, f2_arg1) | ||
f2_arg0:setText(f2_arg1.message_text) | ||
f2_arg0:dispatchEventToRoot({ | ||
name = "resize_popup", | ||
}) | ||
end | ||
|
||
local Backout = function(f3_arg0) | ||
Engine.ExecFirstClient("xpartybackout") | ||
Engine.ExecFirstClient("disconnect") | ||
end | ||
|
||
local DisbandAfterRound = function(f4_arg0) | ||
Engine.ExecFirstClient("xpartydisbandafterround") | ||
Engine.ExecFirstClient("disconnect") | ||
end | ||
|
||
local OnlineGame = function(f5_arg0) | ||
return Engine.GetDvarBool("onlinegame") | ||
end | ||
|
||
local Quit1 = function(f6_arg0) | ||
if OnlineGame(f6_arg0) then | ||
Engine.ExecFirstClient("xstopprivateparty") | ||
Engine.ExecFirstClient("disconnect") | ||
Engine.ExecFirstClient("xblive_privatematch 0") | ||
Engine.ExecFirstClient("onlinegame 1") | ||
Engine.ExecFirstClient("xstartprivateparty") | ||
else | ||
Engine.ExecFirstClient("disconnect") | ||
end | ||
end | ||
|
||
local Quit2 = function(f7_arg0) | ||
Engine.ExecFirstClient("xstopprivateparty") | ||
Engine.ExecFirstClient("xpartydisbandafterround") | ||
if Engine.GetDvarBool("sv_running") then | ||
Engine.NotifyServer("end_game", 1) | ||
Engine.ExecFirstClient("xblive_privatematch 0") | ||
Engine.ExecFirstClient("onlinegame 1") | ||
Engine.ExecFirstClient("xstartprivateparty") | ||
else | ||
Quit1(f7_arg0) | ||
end | ||
end | ||
|
||
local Quit3 = function(f7_arg0, f7_arg1) | ||
if Engine.GetDvarBool("sv_running") then | ||
if Engine.IsAliensMode() then | ||
Engine.Unpause() | ||
if Engine.IsAliensMode() and not IsSystemLink() then | ||
for f7_local0 = 0, Engine.GetMaxControllerCount() - 1, 1 do | ||
if Engine.HasActiveLocalClient(f7_local0) then | ||
Loot.ConsumeAll(f7_local0) | ||
end | ||
end | ||
end | ||
end | ||
Engine.NotifyServer("end_game", 1) | ||
Engine.ExecNow("set endgame_called 1") | ||
else | ||
if Engine.IsAliensMode() and not IsSystemLink() then | ||
for f7_local0 = 0, Engine.GetMaxControllerCount() - 1, 1 do | ||
if Engine.HasActiveLocalClient(f7_local0) then | ||
Loot.ConsumeAll(f7_local0) | ||
end | ||
end | ||
end | ||
Quit1(f7_arg0) | ||
end | ||
LUI.FlowManager.RequestCloseAllMenus() | ||
end | ||
|
||
local LeaveWithParty = function(f8_arg0, f8_arg1) | ||
LUI.FlowManager.RequestLeaveMenu(f8_arg0) | ||
Engine.Exec("onPlayerQuit") | ||
if Engine.GetDvarBool("sv_running") then | ||
DisbandAfterRound(f8_arg0) | ||
else | ||
Backout(f8_arg0) | ||
end | ||
LUI.FlowManager.RequestCloseAllMenus() | ||
end | ||
|
||
local LeaveSolo = function(f9_arg0, f9_arg1) | ||
LUI.FlowManager.RequestLeaveMenu(f9_arg0) | ||
Engine.Exec("onPlayerQuit") | ||
if Engine.GetDvarBool("sv_running") then | ||
Engine.NotifyServer("end_game", 2) | ||
Quit2(f9_arg0) | ||
else | ||
Quit1(f9_arg0) | ||
end | ||
LUI.FlowManager.RequestCloseAllMenus() | ||
end | ||
|
||
local IsPartyHost = function(f10_arg0) | ||
local f10_local0 = Lobby.IsInPrivateParty() | ||
if f10_local0 then | ||
f10_local0 = Lobby.IsPrivatePartyHost() | ||
if f10_local0 then | ||
f10_local0 = not Lobby.IsAloneInPrivateParty() | ||
end | ||
end | ||
return f10_local0 | ||
end | ||
|
||
local ManualQuit = function(f11_arg0, f11_arg1) | ||
Engine.ExecNow("uploadStats") | ||
if Engine.IsAliensMode() and not IsSystemLink() then | ||
for f11_local0 = 0, Engine.GetMaxControllerCount() - 1, 1 do | ||
if Engine.HasActiveLocalClient(f11_local0) then | ||
Loot.ConsumeAll(f11_local0) | ||
end | ||
end | ||
end | ||
if IsPartyHost(f11_arg0) then | ||
LUI.FlowManager.RequestLeaveMenu(f11_arg0, true) | ||
LUI.FlowManager.RequestPopupMenu(f11_arg0, "PullPartyPopup", false) | ||
else | ||
Engine.Exec("onPlayerQuit") | ||
if Engine.GetDvarBool("sv_running") then | ||
Quit2(f11_arg0) | ||
else | ||
Quit1(f11_arg0) | ||
end | ||
LUI.FlowManager.RequestCloseAllMenus() | ||
end | ||
end | ||
|
||
local EndGamePopup = function() | ||
local self = LUI.UIElement.new() | ||
self.id = "end_game_id" | ||
self:registerAnimationState("default", { | ||
topAnchor = true, | ||
leftAnchor = true, | ||
bottomAnchor = true, | ||
rightAnchor = true, | ||
top = -50, | ||
left = 0, | ||
bottom = 0, | ||
right = 0, | ||
alpha = 1, | ||
}) | ||
self:animateToState("default", 0) | ||
local f12_local1 = Engine.Localize("@LUA_MENU_END_GAME_DESC") | ||
local f12_local2 = Engine.Localize("@LUA_MENU_LEAVE_GAME_TITLE") | ||
if Engine.IsAliensMode() and Game.GetOmnvar("zm_ui_is_solo") then | ||
f12_local1 = Engine.Localize("@CP_ZMB_LEAVE_GAME_DESC") | ||
f12_local2 = Engine.Localize("@MENU_NOTICE") | ||
end | ||
MenuBuilder.BuildAddChild(self, { | ||
type = "generic_yesno_popup", | ||
id = "privateGame_options_list_id", | ||
properties = { | ||
message_text_alignment = LUI.Alignment.Center, | ||
message_text = f12_local1, | ||
popup_title = f12_local2, | ||
padding_top = 12, | ||
yes_action = Quit3, | ||
}, | ||
}) | ||
local f12_local3 = LUI.UIBindButton.new() | ||
f12_local3.id = "endBackToGameStartButton" | ||
f12_local3:registerEventHandler("button_start", RequestLeaveMenu) | ||
self:addElement(f12_local3) | ||
return self | ||
end | ||
|
||
local LeaveGamePopup = function() | ||
local self = LUI.UIElement.new() | ||
self.id = "leave_game_id" | ||
self:registerAnimationState("default", { | ||
topAnchor = true, | ||
leftAnchor = true, | ||
bottomAnchor = true, | ||
rightAnchor = true, | ||
top = -50, | ||
left = 0, | ||
bottom = 0, | ||
right = 0, | ||
alpha = 1, | ||
}) | ||
self:animateToState("default", 0) | ||
MenuBuilder.BuildAddChild(self, { | ||
type = "generic_yesno_popup", | ||
id = "publicGame_options_list_id", | ||
properties = { | ||
message_text_alignment = LUI.Alignment.Center, | ||
message_text = Engine.IsAliensMode() and Engine.Localize("@CP_ZMB_LEAVE_GAME_DESC") | ||
or Engine.Localize("@LUA_MENU_LEAVE_GAME_DESC"), | ||
popup_title = Engine.IsAliensMode() and Engine.Localize("@MENU_NOTICE") | ||
or Engine.Localize("@LUA_MENU_LEAVE_GAME_TITLE"), | ||
padding_top = 12, | ||
yes_action = ManualQuit, | ||
}, | ||
}) | ||
local f13_local1 = LUI.UIBindButton.new() | ||
f13_local1.id = "leaveBackToGameStartButton" | ||
f13_local1:registerEventHandler("button_start", RequestLeaveMenu) | ||
self:addElement(f13_local1) | ||
return self | ||
end | ||
|
||
local PullPartyPopup = function(f14_arg0, f14_arg1) | ||
local f14_local0 = MenuBuilder.BuildRegisteredType("PopupMessageAndButtons", { | ||
title = Engine.Localize("LUA_MENU_LEAVE_GAME_TITLE"), | ||
message = Engine.Localize("LUA_MENU_PULL_PARTY_DESC"), | ||
defaultFocusIndex = 2, | ||
cancelClosesPopup = true, | ||
buttonsClosePopup = true, | ||
buttons = { | ||
{ | ||
label = Engine.Localize("LUA_MENU_YES"), | ||
action = LeaveWithParty, | ||
}, | ||
{ | ||
label = Engine.Localize("LUA_MENU_NO"), | ||
action = LeaveSolo, | ||
}, | ||
}, | ||
}) | ||
f14_local0.id = "PullPartyPopup" | ||
return f14_local0 | ||
end | ||
|
||
MenuBuilder.m_types["popup_end_game"] = EndGamePopup | ||
MenuBuilder.m_types["popup_leave_game"] = LeaveGamePopup | ||
MenuBuilder.m_types["PullPartyPopup"] = PullPartyPopup |
Oops, something went wrong.