Skip to content

Commit

Permalink
Release 0021
Browse files Browse the repository at this point in the history
SiegeGI:
- SharedReward now has a waste percentage applied when player is maxed
out on RU.
- Players can't be prevented joining from platforms on top of
PlayerStarts

sgBaseCore
- Better RU distribution code, merged DeniedRU,AddRU into StoredRU.
- Maxed out players now give half of the wasted RU to StoredRU
(accumulated and given to other players).

sgTeleporter:
- Cannot be built on top of other map teleporters that lead somewhere
else.
- Removed redundant touch checker.

WildcardsResources:
- Picked up RU is shared reward (50% waste)

sgProtector:
- Can be removed if built next to other leechable builds.

sgPRI:
- More reliable initialization.
- Non-players and local player are given preset fingerprints.

sgHUD:
- Core's stored RU is now displayed next to RU counter in color.

sgConstructor:
- Less polling for Category Info actor and Client Actor.
- Fix bug with bind from previous commit.

sgClient:
- Don't attempt to request fingerprint if existing one has already been
given.
  • Loading branch information
CacoFFF committed Jan 2, 2016
1 parent 55fef0f commit ecd8766
Show file tree
Hide file tree
Showing 12 changed files with 271 additions and 177 deletions.
34 changes: 23 additions & 11 deletions Classes/SiegeGI.uc
Expand Up @@ -859,7 +859,9 @@ function bool AddBot()
{
// Ugly hack to spawn the correct type of PRI
class'Bot'.default.PlayerReplicationInfoClass = class'sgPRI';
SetHulls( false);
Super.AddBot();
SetHulls( true);
class'Bot'.default.PlayerReplicationInfoClass = class'BotReplicationInfo';

}
Expand All @@ -873,7 +875,9 @@ event PlayerPawn Login(string portal, string options, out string error,
// Ugly hack to spawn the correct type of PRI ===> MOVED TO SIEGEMUTATOR
// priClass = spawnClass.default.PlayerReplicationInfoClass;
// spawnClass.default.PlayerReplicationInfoClass = class'sgPRI';
SetHulls( false);
newPlayer = Super.Login(portal, options, error, spawnClass);
SetHulls( true);
// spawnClass.default.PlayerReplicationInfoClass = priClass;

if ( newPlayer != none && (sgPRI(newPlayer.PlayerReplicationInfo) == none) )
Expand Down Expand Up @@ -1187,10 +1191,9 @@ function ScoreKill(Pawn killer, Pawn other)

if ( killer == other || killer == None )
{
if ( other.PlayerReplicationInfo != None )
other.PlayerReplicationInfo.Score -= 1;
if ( aVictim != None )
{
aVictim.Score -= 1;
aVictim.AddRU( KillRUReward(none, true) * RuMult );
aVictim.sgInfoSpreeCount = Max( 0, aVictim.sgInfoSpreeCount-1);
aVictim.Deaths -= 1; //Prevents suicide altering eff
Expand All @@ -1203,15 +1206,15 @@ function ScoreKill(Pawn killer, Pawn other)
killer.KillCount++;
if ( killer.bIsPlayer && other.bIsPlayer )
{
if ( killer.PlayerReplicationInfo.Team != other.PlayerReplicationInfo.Team )
if ( aKiller.Team != aVictim.Team )
{
killer.PlayerReplicationInfo.Score += 1;
aKiller.Score += 1;
if ( (aKiller != none) && (aVictim != none) && aVictim.bReachedSupplier && (aVictim.SupplierTimer > 0) )
{
aKiller.sgInfoSpreeCount += 3;
aKiller.AddRU( KillRUReward(none, true) * RuMult);
Cores[killer.playerreplicationinfo.Team].DeniedRU += Teams[killer.playerreplicationinfo.Team].Size * 5 * Cores[killer.playerreplicationinfo.Team].Grade;
PenalizeTeamForKill( Other, Killer.PlayerReplicationInfo.Team);
Cores[aKiller.Team].StoredRU -= aVictim.SupplierTimer + Teams[aKiller.Team].Size * 5 * Cores[aKiller.Team].Grade;
PenalizeTeamForKill( Other, aKiller.Team);
aVictim.AddRU(10 * RuMult);
aVictim.sgInfoSpreeCount = 0;
}
Expand All @@ -1225,7 +1228,7 @@ function ScoreKill(Pawn killer, Pawn other)
else
{
bTeamKill = true;
killer.PlayerReplicationInfo.Score -= 1;
aKiller.Score -= 1;
if ( aKiller != None )
{
aKiller.sgInfoKiller--; //Don't award the pusher with a kill
Expand Down Expand Up @@ -1546,8 +1549,9 @@ function bool RestartPlayer(Pawn p)
p.GotoState('GameEnded');
return false;
}
SetHulls( false);
startSpot = FindPlayerStart(p, 255);
SetHulls( true);
if ( startSpot == None )
return false;
Expand Down Expand Up @@ -2304,8 +2308,9 @@ function float KillRUReward( sgPRI Victim, bool bNegative)
return (35 + Victim.GetEff( true) * 0.25 + float(Victim.sgInfoSpreeCount)**1.4) * Factor;
}
function SharedReward( sgPRI Awarded, byte Team, float Award)
function SharedReward( sgPRI Awarded, byte Team, float Award, optional float Waste)
{
Waste = fClamp( Waste, 0, 1);
if ( (Awarded != none) && (Awarded.RU < Awarded.MaxRU) && (Awarded.Team == Team) )
{
if ( Awarded.RU <= (Awarded.MaxRU - Award) )
Expand All @@ -2321,7 +2326,14 @@ function SharedReward( sgPRI Awarded, byte Team, float Award)
}
if ( Award > 0 )
Cores[Team].AddRU += Award;
Cores[Team].StoredRU += Award * (1-Waste);
}
function SetHulls( bool bEnable)
{
local sgBuildingCH CH;
ForEach AllActors (class'sgBuildingCH', CH)
CH.SetCollision(bEnable);
}
defaultproperties
Expand Down Expand Up @@ -2399,7 +2411,7 @@ defaultproperties
FragLimit=0
TimeLimit=80
bChangeLevels=True
StartUpMessage="4th Generation Siege - build 20"
StartUpMessage="4th Generation Siege"
TourneyMessage=""
ReadyMessage="You are READY for Battle!"
StartMessage="The Battle has begun!"
Expand Down
Binary file modified Classes/WildcardsResources.uc
Binary file not shown.
84 changes: 56 additions & 28 deletions Classes/sgBaseCore.uc
Expand Up @@ -7,16 +7,15 @@ class sgBaseCore extends sgBuilding;
var float LastMsgSpam;
var bool bCoreDisabled;
var float RuMultiplier;
var float DeniedRU; //Core won't give this amount of ru until it goes down to zero
var float AddRU; //Core should distribute this among all players during next timer
var float StoredRU; //Spare RU in core
var float SuddenDeathScale;
var int CountedPlayers;
var PlayerPawn LocalClient;
var TeamInfo MyTeam;

replication
{
reliable if ( Role==ROLE_Authority )
RuMultiplier, DeniedRU, bCoreDisabled, AddRU;
RuMultiplier, StoredRU, bCoreDisabled;
}

event PostBeginPlay()
Expand All @@ -42,6 +41,8 @@ simulated event PostNetBeginPlay()
LocalClient = P;
break;
}
if ( LocalClient == none )
Log("Replication messed up: Core replicated before local pawn");
}
}

Expand All @@ -55,55 +56,81 @@ function Destruct( optional pawn instigatedBy)
Destroy();
}

simulated function TeamInfo GetTeamInfo( byte nTeam)
{
local TeamInfo T;
ForEach AllActors (class'TeamInfo', T)
if ( T.TeamIndex == nTeam )
return T;
}

simulated function int GetTeamSize()
{
local sgPRI PRI;
local int i;

//Get team size optimally
if ( MyTeam == none || (MyTeam.TeamIndex != Team) )
MyTeam = GetTeamInfo( Team);
if ( MyTeam != none )
return MyTeam.Size;
//Count players, non optimal
ForEach AllActors (class'sgPRI', PRI)
{
if ( PRI.Team == Team )
i++;
}
return i;
}

simulated function Timer()
{
local sgPRI a;
local float SetRU;
local int i;
local int TeamSize, MaxedOut;

Super.Timer();
if ( RuMultiplier <= 0 )
RuMultiplier = 1;


UpdateScore();

if ( bCoreDisabled )
return;

if ( (ROLE == ROLE_Authority) && (DeniedRU > 0 && AddRU > 0) )
{
SetRU = fMin( AddRU, DeniedRU);
DeniedRU -= SetRU;
AddRU -= SetRU;
}

if ( (Level.NetMode == NM_Client) && class'sgClient'.default.bHighPerformance )
Goto PERFORMANCE_JUMP;
TeamSize = GetTeamSize();

if ( bDisabledByEMP || (Level.NetMode == NM_Client) && class'sgClient'.default.bHighPerformance )
Goto NO_INCREASE;
//Do not simulate RU generation on enemy players
if ( LocalClient == none || LocalClient.PlayerReplicationInfo == none || LocalClient.PlayerReplicationInfo.Team == Team )
{
SetRU = fMax(0.05, (10-float(CountedPlayers)) * 0.05) + Grade * 0.85;
SetRU = fMax(0.05, (10-float(TeamSize)) * 0.05) + Grade * 0.85;
SetRU *= RuMultiplier * 0.05;
if ( !bDisabledByEMP )
if ( (StoredRU < 0) && (SetRU*TeamSize < Abs(StoredRU) ) )
StoredRU += SetRU*TeamSize;
else
{
if ( StoredRU > SetRU*TeamSize*2 )
{
StoredRU -= SetRU*TeamSize*2;
SetRU *= 3;
}
ForEach AllActors(class'sgPRI', a)
if( a.Team == Team )
{ if( a.Team == Team )
{
i++;
if ( DeniedRU > 0 )
DeniedRU -= SetRU;
else if ( (AddRU > 0) && (a.RU < a.MaxRU) )
{
a.AddRU( SetRU * 2, true);
AddRU -= SetRU;
}
if ( a.RU >= a.MaxRU )
MaxedOut++;
else
a.AddRU( SetRU, true);
}
}
if ( MaxedOut > 0 )
StoredRU += SetRU * 0.5 * MaxedOut;
}
}
PERFORMANCE_JUMP:
NO_INCREASE:

CountedPlayers = i;
if (myFX != None)
{
myFX.RotationRate.Yaw = Energy*0.25;
Expand Down Expand Up @@ -264,6 +291,7 @@ function UpdateScore()
defaultproperties
{
bNoRemove=True
StoredRU=10
RuMultiplier=1
bOnlyOwnerRemove=True
RuRewardScale=1
Expand Down
28 changes: 14 additions & 14 deletions Classes/sgClient.uc
Expand Up @@ -40,8 +40,7 @@ simulated event PostBeginPlay()
{
local PlayerPawn P;
local sgScore ScoreBoard;
local WildcardsResources WRU;


ForEach AllActors (class'PlayerPawn', P)
if ( ViewPort(P.Player) != none )
{
Expand Down Expand Up @@ -77,14 +76,7 @@ simulated event PostBeginPlay()
ConstructorPanel = new( self, 'sgConstructorPanel') class'FV_sgConstructorPanel';
ConstructorPanel.LocalPlayer = LocalPlayer;
if ( Level.NetMode != NM_ListenServer )
{ if ( bHighPerformance )
ForEach AllActors (class'WildcardsResources', WRU)
WRU.LightType = LT_None;
else
ForEach AllActors (class'WildcardsResources', WRU)
WRU.LightType = LT_Steady;
}
EnforcePerformance();
}
//Execute timed actions here
Expand Down Expand Up @@ -115,7 +107,9 @@ simulated event Timer()
SetTimer(5 * Level.TimeDilation, false);
return;
}
sgPRI(LocalPlayer.PlayerReplicationInfo).SendFingerPrint( FingerPrint);
//Do not request FingerPrint if already has one (autoset)
if ( sgPRI(LocalPlayer.PlayerReplicationInfo).PlayerFingerPrint == "" )
sgPRI(LocalPlayer.PlayerReplicationInfo).SendFingerPrint( FingerPrint);
bSendFingerPrint = false;
}
}
Expand Down Expand Up @@ -178,19 +172,25 @@ simulated function ToggleBInterface()

simulated function TogglePerformance()
{
local WildcardsResources WRU;
bHighPerformance = !bHighPerformance;
default.bHighPerformance = bHighPerformance;
sgSet.bHighPerformance = bHighPerformance;
EnforcePerformance();
SaveSettings();
}

simulated function EnforcePerformance()
{
local WildcardsResources WRU;
if ( Level.NetMode != NM_ListenServer )
{ if ( bHighPerformance )
{
if ( bHighPerformance )
ForEach AllActors (class'WildcardsResources', WRU)
WRU.LightType = LT_None;
else
ForEach AllActors (class'WildcardsResources', WRU)
WRU.LightType = LT_Steady;
}
SaveSettings();
}

simulated function GenerateFingerprint()
Expand Down

1 comment on commit ecd8766

@CacoFFF
Copy link
Owner Author

@CacoFFF CacoFFF commented on ecd8766 Jan 2, 2016

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgot to mention... translocator is drppable now.

Please sign in to comment.