Skip to content

Commit

Permalink
Automatically handle client package
Browse files Browse the repository at this point in the history
  • Loading branch information
peterekepeter committed Jun 29, 2023
1 parent a214f67 commit 33cf425
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 26 deletions.
4 changes: 2 additions & 2 deletions MVES/Classes/MVPlayerWatcher.uc
Original file line number Diff line number Diff line change
Expand Up @@ -230,11 +230,11 @@ function bool GetCacheActor()
MapListCacheActor.SetPropertyText( "HTTPMapListLocation", Mutator.HTTPMapListLocation $ "/MapList" $ chr(47) $ string(Mutator.ServerCodeName) ); //Reset just in case
return true;
}
MapListCacheActor = Spawn( class<Info>( DynamicLoadObject( Mutator.ClientPackage$".MapListCache",class'class')), Watched);
MapListCacheActor = Spawn( class<Info>( DynamicLoadObject( Mutator.ClientPackageInternal$".MapListCache",class'class')), Watched);
if ( MapListCacheActor == none )
{
Log("[MVE] !!! FATAL ERROR !!!");
Log("[MVE] failed to spawn "$Mutator.ClientPackage$".MapListCache");
Log("[MVE] failed to spawn "$Mutator.ClientPackageInternal$".MapListCache");
Log("[MVE] make sure you have the correct client package in MVE_Config");
return false;
}
Expand Down
4 changes: 2 additions & 2 deletions MVES/Classes/MV_MainExtension.uc
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,14 @@ function WelcomeWindowTo( PlayerPawn Victim)
ForEach Victim.ChildActors( class'Info', I)
if ( I.IsA('MVWelcomeWRI') )
return;
I = Victim.Spawn(class<Info>( DynamicLoadObject( MapVote(Outer).ClientPackage$".MVWelcomeWRI",class'class')), Victim,,vect(0,0,0) );
I = Victim.Spawn(class<Info>( DynamicLoadObject( MapVote(Outer).ClientPackageInternal$".MVWelcomeWRI",class'class')), Victim,,vect(0,0,0) );
I.SetPropertyText("ServerInfoURL", MapVote(Outer).ServerInfoURL);
I.SetPropertyText("MapInfoURL", MapVote(Outer).MapInfoURL);
}

function Info SpawnVoteWRIActor( PlayerPawn Victim)
{
return Victim.Spawn( class<Info>(DynamicLoadObject( MapVote(Outer).ClientPackage$".MapVoteWRI",class'class')), Victim,,vect(0,0,0));
return Victim.Spawn( class<Info>(DynamicLoadObject( MapVote(Outer).ClientPackageInternal$".MapVoteWRI",class'class')), Victim,,vect(0,0,0));
}

function RemoveMapVotes( MVPlayerWatcher W)
Expand Down
27 changes: 18 additions & 9 deletions MVES/Classes/MapVote.uc
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
//================================================================================
class MapVote expands Mutator config(MVE_Config);

const ClientPackageDeprecatedValue = "automatic (will be removed)";
const ClientPackageInternal = "MVE2g";

var() config string ClientPackage; // Load this package

var() config string ClientScreenshotPackage; // Load this package
var() config string ClientLogoTexture; // Clients will load and display this texture
var() config string ServerInfoURL;
Expand Down Expand Up @@ -240,7 +244,7 @@ event PostBeginPlay()
local bool bNeedToRestorePackages, bNeedToRestoreMap;
local MV_IdleTimer MV_IdleTimer;

Log("[MVE] Map Vote Extended version: "$ClientPackage);
Log("[MVE] Map Vote Extended version: "$ClientPackageInternal);

TravelInfo = Spawn(class'MV_TravelInfo');
Spawn(class'MapVoteDelayedInit').InitializeDelayedInit(self);
Expand All @@ -258,7 +262,7 @@ event PostBeginPlay()
{
bXCGE_DynLoader = true;
default.bXCGE_DynLoader = true; //So we get to see if it worked from clients!
AddToPackageMap(ClientPackage);
AddToPackageMap(ClientPackageInternal);
if (ClientScreenshotPackage != "")
{
AddToPackageMap(ClientScreenshotPackage);
Expand Down Expand Up @@ -312,7 +316,7 @@ event PostBeginPlay()
if (bOverrideServerPackages && !bXCGE_DynLoader){
// check that current packages contains all packages specified by mapvote
CurrentPackages = ConsoleCommand("Get ini:Engine.Engine.GameEngine ServerPackages");
Log("[MVE] CurrentPackages is "$CurrentPackages);
Log("[MVE] CurrentPackages is "$CurrentPackages);
LogoTexturePackage = GetPackageNameFromString(ClientLogoTexture);
if (LogoTexturePackage != "" && InStr(CurrentPackages, "\""$LogoTexturePackage$"\"") < 0)
{
Expand All @@ -324,9 +328,9 @@ event PostBeginPlay()
Nfo(ClientScreenshotPackage$" is missing from ServerPackages");
bNeedToRestorePackages = true;
}
if (ClientPackage != "" && InStr(CurrentPackages, "\""$ClientPackage$"\"") < 0)
if (ClientPackageInternal != "" && InStr(CurrentPackages, "\""$ClientPackageInternal$"\"") < 0)
{
Nfo(ClientPackage$" is missing from ServerPackages");
Nfo(ClientPackageInternal$" is missing from ServerPackages");
bNeedToRestorePackages = true;
}
Cmd = CurrentGame.Packages;
Expand All @@ -337,7 +341,7 @@ event PostBeginPlay()
while ( Cmd != "" )
{
NextParm = Extension.NextParameter( Cmd, ",");
if ( NextParm != "" && InStr(CurrentPackages, "\""$ClientPackage$"\"") < 0)
if ( NextParm != "" && InStr(CurrentPackages, "\""$ClientPackageInternal$"\"") < 0)
{
Nfo(NextParm$" is missing from ServerPackages");
bNeedToRestorePackages = true;
Expand Down Expand Up @@ -947,6 +951,12 @@ function CleanRules()
{
local int i, j;
local bool bSave;

if (ClientPackage != ClientPackageDeprecatedValue)
{
ClientPackage = ClientPackageDeprecatedValue;
bSave = true;
}

For ( j=0 ; j<ArrayCount(CustomGame) ; j++ )
{
Expand Down Expand Up @@ -1486,7 +1496,7 @@ final function bool SetupTravelString( string mapStringWithIdx )
Result.AddPackages(ClientScreenshotPackage);
}
// add client package
Result.AddPackages(ClientPackage);
Result.AddPackages(ClientPackageInternal);
// add logo texture package
if (ClientLogoTexture != "")
{
Expand Down Expand Up @@ -1684,7 +1694,7 @@ function ApplyFixForMutatorsQueryLagSpikes() {
// https://ut99.org/viewtopic.php?p=142091
Level.Game.GetRules();
if (Level.Game.EnabledMutators == "") {
Level.Game.EnabledMutators = "MapVote "$ClientPackage;
Level.Game.EnabledMutators = "MapVote "$ClientPackageInternal;
}
}

Expand Down Expand Up @@ -1785,7 +1795,6 @@ defaultproperties
bAutoSetGameName=True
bSortAndDeduplicateMaps=True
bFixMutatorsQueryLagSpikes=True
ClientPackage="MVE2g"
ServerInfoURL=""
MapInfoURL=""
HTTPMapListLocation=""
Expand Down
65 changes: 53 additions & 12 deletions ReleaseFiles/MVE2g-v1/Help/Map Vote Extended.txt
Original file line number Diff line number Diff line change
@@ -1,21 +1,62 @@
Installation
============
1) copy the .u, .int and .ini files to the UT\System folder
2) add to the UnrealTournament.ini in section [Engine.GameEngine] the following entry
Quickstart
==========

1) copy the .u, .int and .ini files to the UT/System folder

2) Add this line to server startup mutator list or add it to server actor list.

ucc server MVES.MapVote

3) Whenever you want the map list to be updated you need to run the reload command
the reload command will re-scan paths for maps and will match them against filters

mutate bdbmapvote reload


Support
=======

The official forum post with latest updates goes here. You can report bugs or
ask for help in the thread:

https://ut99.org/viewtopic.php?t=15657


Advanced Installation
=====================

- If bOverrideServerPackages=True then MapVote will manage ServerPackages for
you and will automatically add the user interface package MVE2g to ServerPackages
By default bOverrideServerPackages=True but if you have set
bOverrideServerPackages=False you will need to manually add the client package
yourself to ServerPackages:

[Engine.GameEngine]
ServerPackages=MVE2g

3) rename to the MVE_Config.ini in section [MVES.MapVote] the following entry

[MVES.MapVote]
ClientPackage=MVE2g
- MapVote can be installed both in mutator or server actor mode. This will
affect the initialization order a bit. This may influence initialization of
other mutators. Ultimately this is a choice for you to use whichever mode is
more comfortable working with. Here are some ways you can run MapVote:

4) Add this line to server startup mutator list or add it to server actor list.
1) as server actor, edit UnrealTournament.ini add the following:

MVES.MapVote
[Engine.GameEngine]
ServerActors=MVES.MapVote

5) Whenever you want the map list to be updated you need to run the reload command
the reload command will re-scan paths for maps and will match them against filters
1) as server mutator start the server with the following:

ucc server DM-Agony?mutator=MVES.MapVote

mutate bdbmapvote reload
2) single player / standalone you can run the game with arguments:

UnrealTournament.exe CityIntro?mutator=MVES.MapVote -log


- The installation package should come with a MVE_Config.ini file. This is
provided as a convenience of good defaults and a baseline configuration. If
you feel lost or misconfigured something, you can use it as a reference to
set things back to good defaults. If you already have a configuration file
make sure you don't override it when installing updates. It's also a good
practice to keep backups of this file or to put it under version control.
1 change: 0 additions & 1 deletion ReleaseFiles/MVE2g-v1/System/MVE_Config.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ bReloadOnEveryRun=False
bReloadOnNextRun=True
bSaveConfigOnNextRun=True
bFullscanOnNextRun=False
ClientPackage=MVE2g
ClientLogoTexture=SpaceFX.nebula3
ClientScreenshotPackage=
ServerInfoURL=
Expand Down

0 comments on commit 33cf425

Please sign in to comment.