Engine.GameInfo.AddDefaultInventory is defined as follows:
function AddDefaultInventory( pawn PlayerPawn )
{
local Weapon newWeapon;
local class<Weapon> WeapClass;
local GameRules G;
PlayerPawn.JumpZ = PlayerPawn.Default.JumpZ * PlayerJumpZScaling();
if ( PlayerPawn.IsA('Spectator') )
return;
if ( DefaultWeapon==None )
goto'ModifyPL';
// Spawn default weapon.
WeapClass = BaseMutator.MutatedDefaultWeapon();
if ( (WeapClass!=None) && (PlayerPawn.FindInventoryType(WeapClass)==None) )
{
newWeapon = Spawn(WeapClass,,, PlayerPawn.Location);
if ( newWeapon != None )
{
newWeapon.Instigator = PlayerPawn;
newWeapon.BecomeItem();
PlayerPawn.AddInventory(newWeapon);
newWeapon.BringUp();
newWeapon.GiveAmmo(PlayerPawn);
newWeapon.SetSwitchPriority(PlayerPawn);
newWeapon.WeaponSet(PlayerPawn);
}
}
ModifyPL:
if ( GameRules!=None )
{
for ( G=GameRules; G!=None; G=G.NextRules )
if ( G.bNotifySpawnPoint )
G.ModifyPlayer(PlayerPawn);
}
}
The implementation of UnrealShare.CoopGame.AddDefaultInventory invokes Engine.GameInfo.AddDefaultInventory only if DefaultGameType of the current level is not UnrealShare.VRikersGame:
function AddDefaultInventory( pawn PlayerPawn )
{
local Translator newTranslator;
if ( Level.DefaultGameType != class'VRikersGame' )
Super.AddDefaultInventory(PlayerPawn);
// Spawn translator.
if ( PlayerPawn.IsA('Spectator') || PlayerPawn.FindInventoryType(class'Translator') != None )
return;
newTranslator = Spawn(class'Translator',,, Location);
if ( newTranslator != None )
{
newTranslator.bHeldItem = true;
newTranslator.GiveTo( PlayerPawn );
PlayerPawn.SelectedItem = newTranslator;
newTranslator.PickupFunction(PlayerPawn);
}
}
So, if Level.DefaultGameType == class'VRikersGame', then
PlayerPawn.JumpZ = PlayerPawn.Default.JumpZ * PlayerJumpZScaling();
if ( GameRules!=None )
{
for ( G=GameRules; G!=None; G=G.NextRules )
if ( G.bNotifySpawnPoint )
G.ModifyPlayer(PlayerPawn);
}
won't be executed. Was such dependency on DefaultGameType defined intentionally? I'd expect that adjustment of PlayerPawn.JumpZ along with modification of player by GameRules object would apply regardless of DefaultGameType - as if UnrealShare.CoopGame.AddDefaultInventory would be defined as
function AddDefaultInventory( pawn PlayerPawn )
{
local Weapon newWeapon;
local class<Weapon> WeapClass;
local Translator newTranslator;
local GameRules G;
PlayerPawn.JumpZ = PlayerPawn.default.JumpZ * Level.Game.PlayerJumpZScaling();
if (PlayerPawn.IsA('Spectator'))
return;
if (Level.Game.DefaultWeapon == none || Level.DefaultGameType == class'VRikersGame')
goto'ModifyPL';
// Spawn default weapon.
WeapClass = Level.Game.BaseMutator.MutatedDefaultWeapon();
if (WeapClass != none && PlayerPawn.FindInventoryType(WeapClass) == none)
{
newWeapon = Spawn(WeapClass,,, PlayerPawn.Location);
if (newWeapon != none)
{
newWeapon.Instigator = PlayerPawn;
newWeapon.BecomeItem();
PlayerPawn.AddInventory(newWeapon);
newWeapon.BringUp();
newWeapon.GiveAmmo(PlayerPawn);
newWeapon.SetSwitchPriority(PlayerPawn);
newWeapon.WeaponSet(PlayerPawn);
}
}
ModifyPL:
if (Level.Game.GameRules != none)
{
for (G = Level.Game.GameRules; G != none; G = G.NextRules)
if (G.bNotifySpawnPoint)
G.ModifyPlayer(PlayerPawn);
}
if (PlayerPawn.FindInventoryType(class'Translator') == none)
{
newTranslator = Spawn(class'Translator',,, PlayerPawn.Location);
if (newTranslator != none)
{
newTranslator.bHeldItem = true;
newTranslator.GiveTo(PlayerPawn);
PlayerPawn.SelectedItem = newTranslator;
newTranslator.PickupFunction(PlayerPawn);
}
}
}
UPak.UPakCoopGame also looks weird
function AddDefaultInventory( pawn PlayerPawn )
{
local Translator newTranslator;
if ( Level.DefaultGameType != class'VRikersGame' )
Super.AddDefaultInventory(PlayerPawn);
// Spawn translator.
if( PlayerPawn.IsA('Spectator') || PlayerPawn.FindInventoryType(class'Translator') != None )
{
CheckScubaGear( PlayerPawn );
return;
}
newTranslator = Spawn(class'Translator',,, Location);
if( newTranslator != None )
{
newTranslator.bHeldItem = true;
newTranslator.GiveTo( PlayerPawn );
PlayerPawn.SelectedItem = newTranslator;
newTranslator.PickupFunction(PlayerPawn);
}
}
I wonder why it's not defined as
function AddDefaultInventory( pawn PlayerPawn )
{
Super.AddDefaultInventory(PlayerPawn);
CheckScubaGear(PlayerPawn);
}