Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

git-svn-id: https://pdinklag.de/svn/titanrpg@37 c0513002-0cab-42c9-a8…

…ae-037f75ac7604
  • Loading branch information...
commit 5900a4442cf4196708012fb8e04f312b72e313bc 1 parent b962407
pdinklag authored
View
2  Classes/AbilityAura.uc
@@ -7,7 +7,7 @@ var array<HealingBeamEffect> HealEmitters;
replication
{
- reliable if(Role == ROLE_Authority)
+ reliable if(Role == ROLE_Authority && !bNetSyncComplete)
HealInterval, HealRadius;
}
View
5 Classes/AbilityConjuration.uc
@@ -39,6 +39,7 @@ simulated event PreBeginPlay()
MonsterTypesRepl.StringArray[i] = MonsterTypes[i].DisplayName;
}
MonsterTypesRepl.Replicate();
+ FinalSyncState++;
}
}
@@ -49,7 +50,7 @@ simulated event PostNetReceive()
Super.PostNetReceive();
- if(Role < ROLE_Authority && MonsterTypesRepl != None)
+ if(ShouldReceive() && MonsterTypesRepl != None)
{
MonsterTypes.Length = MonsterTypesRepl.ObjectArray.Length;
for(i = 0; i < MonsterTypes.Length; i++)
@@ -63,6 +64,7 @@ simulated event PostNetReceive()
MonsterTypesRepl.SetOwner(Owner);
MonsterTypesRepl.ServerDestroy();
+ ClientSyncState++;
}
}
@@ -88,6 +90,7 @@ function ModifyPawn(Pawn Other)
Artifact = Other.Spawn(class'ArtifactMonsterSummon');
if(Artifact != None)
{
+ Artifact.bCanBeTossed = false;
Artifact.MonsterTypes.Length = 0;
for(i = 0; i < MonsterTypes.Length; i++)
{
View
4 Classes/AbilityConstruction.uc
@@ -42,6 +42,7 @@ simulated event PreBeginPlay()
TurretTypesRepl.FloatArray[i] = TurretTypes[i].DrawScale;
}
TurretTypesRepl.Replicate();
+ FinalSyncState++;
}
}
@@ -52,7 +53,7 @@ simulated event PostNetReceive()
Super.PostNetReceive();
- if(Role < ROLE_Authority && TurretTypesRepl != None)
+ if(ShouldReceive() && TurretTypesRepl != None)
{
TurretTypes.Length = TurretTypesRepl.Length;
for(i = 0; i < TurretTypes.Length; i++)
@@ -67,6 +68,7 @@ simulated event PostNetReceive()
TurretTypesRepl.SetOwner(Owner);
TurretTypesRepl.ServerDestroy();
+ ClientSyncState++;
}
}
View
4 Classes/AbilityLoadedMedic.uc
@@ -23,6 +23,7 @@ simulated event PreBeginPlay()
LevelCapRepl.IntArray[i] = LevelCap[i];
LevelCapRepl.Replicate();
+ FinalSyncState++;
}
}
@@ -32,7 +33,7 @@ simulated event PostNetReceive()
Super.PostNetReceive();
- if(Role < ROLE_Authority && LevelCapRepl != None)
+ if(ShouldReceive() && LevelCapRepl != None)
{
LevelCap.Length = LevelCapRepl.IntArray.Length;
for(i = 0; i < LevelCap.Length; i++)
@@ -40,6 +41,7 @@ simulated event PostNetReceive()
LevelCapRepl.SetOwner(Owner);
LevelCapRepl.ServerDestroy();
+ ClientSyncState++;
}
}
View
2  Classes/AbilityLoadedVehicles.uc
@@ -4,7 +4,7 @@ var config int RepairLinkLevel;
replication
{
- reliable if(Role == ROLE_Authority)
+ reliable if(Role == ROLE_Authority && !bNetSyncComplete)
RepairLinkLevel;
}
View
4 Classes/AbilityLoadedWeapons.uc
@@ -33,6 +33,7 @@ simulated event PreBeginPlay()
WeaponsRepl.IntArray[i] = Weapons[i].Level;
}
WeaponsRepl.Replicate();
+ FinalSyncState++;
}
}
@@ -43,7 +44,7 @@ simulated event PostNetReceive()
Super.PostNetReceive();
- if(Role < ROLE_Authority && WeaponsRepl != None)
+ if(ShouldReceive() && WeaponsRepl != None)
{
Weapons.Length = WeaponsRepl.Length;
for(i = 0; i < Weapons.Length; i++)
@@ -55,6 +56,7 @@ simulated event PostNetReceive()
WeaponsRepl.SetOwner(Owner);
WeaponsRepl.ServerDestroy();
+ ClientSyncState++;
}
}
View
2  Classes/AbilityUltima.uc
@@ -7,7 +7,7 @@ var int KillCount; //Kill count in current spawn
replication
{
- reliable if(Role == ROLE_Authority)
+ reliable if(Role == ROLE_Authority && !bNetSyncComplete)
BaseDelay;
reliable if(Role == ROLE_Authority && bNetDirty)
View
2  Classes/AbilityVehicleArmor.uc
@@ -6,7 +6,7 @@ var localized string MaxBonusText;
replication
{
- reliable if(Role == ROLE_Authority)
+ reliable if(Role == ROLE_Authority && !bNetSyncComplete)
MaxHealthBonus;
}
View
71 Classes/RPGAbility.uc
@@ -50,18 +50,31 @@ var int AbilityLevel;
var bool bClientReceived;
+var int ClientSyncCounter;
+var int FinalSyncState, ClientSyncState;
+var bool bNetSyncComplete;
+
var ReplicatedArray RequiredRepl, ForbiddenRepl, ItemsRepl, LevelCostRepl;
replication
{
reliable if(Role == ROLE_Authority && bNetInitial)
- RPRI, AbilityLevel, Index, BuyOrderIndex, bAllowed,
+ RPRI, AbilityLevel, Index, BuyOrderIndex, bAllowed, FinalSyncState,
RequiredRepl, ForbiddenRepl, ItemsRepl, LevelCostRepl;
- reliable if(Role == ROLE_Authority)
+ reliable if(Role == ROLE_Authority && !bNetSyncComplete)
StartingCost, CostAddPerLevel, MaxLevel, bUseLevelCost,
RequiredLevel,
BonusPerLevel, bIsStat;
+
+ reliable if(Role < ROLE_Authority)
+ ServerSyncComplete;
+}
+
+function ServerSyncComplete()
+{
+ bNetSyncComplete = true;
+ bNetNotify = false;
}
function bool ShouldReplicateInfo()
@@ -85,6 +98,8 @@ simulated event PreBeginPlay()
Super.PreBeginPlay();
+ FinalSyncState = 1; //initial sync
+
if(ShouldReplicateInfo())
{
//Required
@@ -98,6 +113,7 @@ simulated event PreBeginPlay()
RequiredRepl.IntArray[i] = RequiredAbilities[i].Level;
}
RequiredRepl.Replicate();
+ FinalSyncState++;
}
//Forbidden
@@ -111,6 +127,7 @@ simulated event PreBeginPlay()
ForbiddenRepl.IntArray[i] = ForbiddenAbilities[i].Level;
}
ForbiddenRepl.Replicate();
+ FinalSyncState++;
}
//Items
@@ -124,6 +141,7 @@ simulated event PreBeginPlay()
ItemsRepl.IntArray[i] = GrantItem[i].Level;
}
ItemsRepl.Replicate();
+ FinalSyncState++;
}
//LevelCost
@@ -135,22 +153,28 @@ simulated event PreBeginPlay()
LevelCostRepl.IntArray[i] = LevelCost[i];
LevelCostRepl.Replicate();
+ FinalSyncState++;
}
}
}
+simulated function bool ShouldReceive()
+{
+ return Role < ROLE_Authority && !bNetSyncComplete;
+}
+
simulated event PostNetReceive()
{
local AbilityStruct A;
local GrantItemStruct Grant;
local int i;
- if(Role < ROLE_Authority)
+ if(ShouldReceive())
{
if(RPRI != None && !bClientReceived)
{
- RPRI.ReceiveAbility(Self);
bClientReceived = true;
+ ClientSyncState++;
}
//Required
@@ -165,6 +189,7 @@ simulated event PostNetReceive()
}
RequiredRepl.SetOwner(Owner);
RequiredRepl.ServerDestroy();
+ ClientSyncState++;
}
//Forbidden
@@ -179,6 +204,7 @@ simulated event PostNetReceive()
}
ForbiddenRepl.SetOwner(Owner);
ForbiddenRepl.ServerDestroy();
+ ClientSyncState++;
}
//Items
@@ -193,6 +219,7 @@ simulated event PostNetReceive()
}
ItemsRepl.SetOwner(Owner);
ItemsRepl.ServerDestroy();
+ ClientSyncState++;
}
//LevelCost
@@ -204,6 +231,29 @@ simulated event PostNetReceive()
LevelCostRepl.SetOwner(Owner);
LevelCostRepl.ServerDestroy();
+ ClientSyncState++;
+ }
+
+ ClientSyncCounter++;
+
+ if(ClientSyncState >= FinalSyncState && !bNetSyncComplete)
+ {
+ RPRI.ReceiveAbility(Self);
+ ServerSyncComplete();
+ bNetSyncComplete = true;
+ }
+ else if(ClientSyncCounter > 20)
+ {
+ /*
+ in case something goes wrong, make sure the ability gets marked as received anyway,
+ so the menu becomes available.
+
+ Should never happen.
+ */
+ Log(Self @ "Failed to complete sync after" @ ClientSyncCounter @ "net receptions!", 'TitanRPG');
+ RPRI.ReceiveAbility(Self);
+ ServerSyncComplete();
+ bNetSyncComplete = true;
}
}
}
@@ -260,6 +310,15 @@ simulated function bool Buy(optional int Amount)
return true;
}
+//Get the ability's name
+simulated function string GetName()
+{
+ if(bIsStat)
+ return StatName;
+ else
+ return AbilityName;
+}
+
/*
Automatically generates a description text for this ability.
Includes the Description string, items granted at certain levels, requirements, forbidden abilities, max level and
@@ -312,7 +371,7 @@ simulated function string DescriptionText()
for(x = 0; x < RequiredAbilities.Length && RequiredAbilities[x].AbilityClass != None; x++)
{
i = list.Length;
- list[i] = RequiredAbilities[x].AbilityClass.default.AbilityName;
+ list[i] = RPRI.GetAbility(RequiredAbilities[x].AbilityClass).GetName();
if(RequiredAbilities[x].Level > 1)
list[i] @= string(RequiredAbilities[x].Level);
@@ -339,7 +398,7 @@ simulated function string DescriptionText()
for(x = 0; x < ForbiddenAbilities.Length && ForbiddenAbilities[x].AbilityClass != None; x++)
{
i = list.Length;
- list[i] = ForbiddenAbilities[x].AbilityClass.default.AbilityName;
+ list[i] = RPRI.GetAbility(ForbiddenAbilities[x].AbilityClass).GetName();
if(ForbiddenAbilities[x].Level > 1)
list[i] @= string(ForbiddenAbilities[x].Level);
View
39 Classes/RPGMenu.uc
@@ -6,6 +6,8 @@ var array<GUITabItem> Panels;
var automated GUITabControl Tabs;
+var bool bStats; //set by RPRI
+
var localized string WindowTitle;
function InitComponent(GUIController MyController, GUIComponent MyOwner)
@@ -16,10 +18,15 @@ function InitComponent(GUIController MyController, GUIComponent MyOwner)
Super.InitComponent(MyController, MyOwner);
+ if(bStats)
+ Panels[1].ClassName = "RPGMenu_AbilitiesMaster";
+
for(i = 0; i < Panels.Length; i++)
{
//Prepend package name to class name
Panels[i].ClassName = "<? echo($packageName); ?>." $ Panels[i].ClassName;
+
+ Log("Adding tab:" @ Panels[i].ClassName, 'DEBUG');
Tabs.AddTabItem(Panels[i]);
}
@@ -29,34 +36,19 @@ function InitComponent(GUIController MyController, GUIComponent MyOwner)
function InitFor(RPGPlayerReplicationInfo Whom)
{
- local int i, NumStats;
+ local int i;
RPRI = Whom;
if(RPRI.Level.NetMode == NM_Standalone)
RPRI.Level.Game.SetPause(true, PlayerController(RPRI.Controller));
- for(i = 0; i < RPRI.AllAbilities.Length; i++)
- {
- if(RPRI.AllAbilities[i].bIsStat)
- NumStats++;
- }
-
RPRI.Menu = Self;
- i = 0;
- while(i < Tabs.TabStack.Length)
+ for(i = 0; i < Tabs.TabStack.Length; i++)
{
- if(NumStats == 0 && Tabs.TabStack[i].MyPanel.IsA('RPGMenu_Stats'))
- {
- Tabs.RemoveTab("", Tabs.TabStack[i]);
- }
- else
- {
- RPGMenu_TabPage(Tabs.TabStack[i].MyPanel).RPGMenu = Self;
- RPGMenu_TabPage(Tabs.TabStack[i].MyPanel).InitMenu();
- i++;
- }
+ RPGMenu_TabPage(Tabs.TabStack[i].MyPanel).RPGMenu = Self;
+ RPGMenu_TabPage(Tabs.TabStack[i].MyPanel).InitMenu();
}
}
@@ -89,10 +81,11 @@ event Free()
defaultproperties
{
Panels(0)=(ClassName="RPGMenu_Character",Caption="Character",Hint="View your current character's statistics.")
- Panels(1)=(ClassName="RPGMenu_Stats",Caption="Stats",Hint="Distribute stat points.")
- Panels(2)=(ClassName="RPGMenu_Abilities",Caption="Abilities",Hint="Buy abilities.")
- Panels(3)=(ClassName="RPGMenu_PlayerLevels",Caption="Player Levels",Hint="See the levels of the currently playing players.")
- Panels(4)=(ClassName="RPGMenu_SettingsMaster",Caption="Settings",Hint="Customize TitanRPG features.")
+ Panels(1)=(ClassName="RPGMenu_Abilities",Caption="Buy",Hint="Distribute stat points and buy abilities.")
+ Panels(2)=(ClassName="RPGMenu_PlayerLevels",Caption="Player Levels",Hint="See the levels of the currently playing players.")
+ Panels(3)=(ClassName="RPGMenu_SettingsMaster",Caption="Settings",Hint="Customize TitanRPG features.")
+
+ bStats=False //should be left as default
Begin Object Class=GUITabControl Name=RPGMenuTC
bFillSpace=True
View
62 Classes/RPGMenu_AbilitiesMaster.uc
@@ -0,0 +1,62 @@
+class RPGMenu_AbilitiesMaster extends RPGMenu_TabPage;
+
+var RPGPlayerReplicationInfo RPRI;
+
+var array<GUITabItem> Panels;
+var automated GUITabControl Tabs;
+
+function InitComponent(GUIController MyController, GUIComponent MyOwner)
+{
+ local int i;
+
+ Super.InitComponent(MyController, MyOwner);
+
+ for(i = 0; i < Panels.Length; i++)
+ {
+ //Prepend package name to class name
+ Panels[i].ClassName = "<? echo($packageName); ?>." $ Panels[i].ClassName;
+ Tabs.AddTabItem(Panels[i]);
+ }
+}
+
+function InitMenu()
+{
+ local int i;
+
+ for(i = 0; i < Tabs.Controls.Length; i++)
+ {
+ RPGMenu_TabPage(Tabs.Controls[i]).RPGMenu = RPGMenu;
+ RPGMenu_TabPage(Tabs.Controls[i]).InitMenu();
+ }
+}
+
+function CloseMenu()
+{
+ local int i;
+
+ for(i = 0; i < Tabs.Controls.Length; i++)
+ RPGMenu_TabPage(Tabs.Controls[i]).CloseMenu();
+
+ RPRI = None;
+}
+
+defaultproperties
+{
+ Panels(0)=(ClassName="RPGMenu_Stats",Caption="Stats",Hint="Distribute stat points.")
+ Panels(1)=(ClassName="RPGMenu_Abilities",Caption="Abilities",Hint="Buy abilities.")
+
+ Begin Object Class=GUITabControl Name=RPGMenuTC
+ WinWidth=1.0
+ WinLeft=0
+ WinTop=0
+ WinHeight=0.06
+ TabHeight=0.037500
+ bAcceptsInput=true
+ bDockPanels=true
+ bBoundToParent=true
+ bScaleToParent=true
+ bFillSpace=True
+ BackgroundStyleName="TabBackground"
+ End Object
+ Tabs=GUITabControl'RPGMenuTC'
+}
View
4 Classes/RPGMenu_SettingsMaster.uc
@@ -1,7 +1,5 @@
class RPGMenu_SettingsMaster extends RPGMenu_TabPage;
-var RPGPlayerReplicationInfo RPRI;
-
var array<GUITabItem> Panels;
var automated GUITabControl Tabs;
@@ -36,8 +34,6 @@ function CloseMenu()
for(i = 0; i < Tabs.Controls.Length; i++)
RPGMenu_TabPage(Tabs.Controls[i]).CloseMenu();
-
- RPRI = None;
}
defaultproperties
View
15 Classes/RPGMenu_Stats.uc
@@ -9,6 +9,7 @@ var automated GUIMultiColumnList Abilities;
var automated GUIButton btBuy;
var automated moEditBox ebAmount;
+var int LastAmount;
var GUIStyles CategoryStyle;
@@ -79,8 +80,7 @@ function InitMenu()
}
}
- if(ebAmount.GetText() == "")
- ebAmount.SetText("5");
+ ebAmount.SetText(string(LastAmount));
Abilities.SetIndex(OldAbilityListIndex);
Abilities.SetTopItem(OldAbilityListTop);
@@ -92,6 +92,7 @@ function InitMenu()
function CloseMenu()
{
+ LastAmount = int(ebAmount.GetText());
Stats.Length = 0;
}
@@ -105,7 +106,7 @@ function SelectAbility()
{
Stat = Stats[Abilities.Index];
- if(Stat.AbilityLevel < Stat.MaxLevel)
+ if(Stat.AbilityLevel < Stat.MaxLevel && RPGMenu.RPRI.PointsAvailable >= Stat.StartingCost)
btBuy.MenuState = MSAT_Blurry;
else
btBuy.MenuState = MSAT_Disabled;
@@ -142,11 +143,11 @@ function bool BuyStat(GUIComponent Sender)
{
local int Amount;
local RPGAbility Stat;
-
- Amount = Max(1, int(ebAmount.GetText()));
RPGMenu.RPRI.ServerNoteActivity(); //Disable idle kicking when actually doing something
- if(Abilities.Index >= 0)
+
+ Amount = Min(RPGMenu.RPRI.PointsAvailable, Max(1, int(ebAmount.GetText())));
+ if(Abilities.Index >= 0 && Amount > 0)
{
Stat = Stats[Abilities.Index];
@@ -161,6 +162,8 @@ defaultproperties
{
Text_StatsAvailable="Available Stat Points:"
Text_Max="(MAX)"
+
+ LastAmount=5
Begin Object Class=AltSectionBackground Name=sbAbilities_
Caption="Available Stats"
View
13 Classes/RPGPlayerReplicationInfo.uc
@@ -871,7 +871,7 @@ function AwardExperience(float exp)
if(Count > 0)
{
if(Controller != None && Controller.Pawn != None)
- Controller.Pawn.PlaySound(LevelUpSound);
+ class'Util'.static.PlayLoudEnoughSound(Controller.Pawn, LevelUpSound);
Level.Game.BroadCastLocalized(Self, class'GainLevelMessage', RPGLevel, PRI);
ClientShowHint(LevelUpText);
@@ -901,6 +901,17 @@ simulated function ClientShowHint(string Hint)
simulated function ClientEnableRPGMenu()
{
+ local int i;
+
+ for(i = 0; i < AllAbilities.Length; i++)
+ {
+ if(AllAbilities[i].bIsStat)
+ {
+ class'RPGMenu'.default.bStats = true;
+ break;
+ }
+ }
+
bClientSyncDone = true;
if(Interaction != None)
{
View
18 Classes/RPGSelectionMenu.uc
@@ -9,6 +9,7 @@ class RPGSelectionMenu extends FloatingWindow
config(TitanRPGSettings);
var Pawn Instigator;
+var RPGPlayerReplicationInfo RPRI;
var RPGArtifact Artifact;
var automated GUISectionBackground sbList, sbPreview;
@@ -74,6 +75,7 @@ function InitFor(RPGArtifact A)
Artifact = A;
Instigator = A.Instigator;
+ RPRI = class'RPGPlayerReplicationInfo'.static.GetFor(Instigator.Controller);
//Setup and fill list
lstItems.List.bNotify = false;
@@ -214,12 +216,22 @@ function bool InternalOnKeyEvent(out byte iKey, out byte State, float Delta)
local string Temp;
if(State == 1)
- {
- Log(Self @ "InternalOnKeyEvent" @ iKey @ State @ Delta, 'DEBUG');
-
+ {
Temp = PlayerOwner().ConsoleCommand("KEYNAME" @ iKey);
Log("KEYNAME ->" @ Temp, 'DEBUG');
+ //default bindings
+ if(
+ RPRI != None &&
+ RPRI.Interaction != None &&
+ RPRI.Interaction.bDefaultArtifactBindings &&
+ Temp ~= "U"
+ )
+ {
+ OKClicked(None);
+ return true;
+ }
+
Temp = PlayerOwner().ConsoleCommand("KEYBINDING" @ Temp);
Log("KEYBINDING ->" @ Temp, 'DEBUG');
View
2  _TODO.txt
@@ -39,6 +39,7 @@ TODO (1.62)
- OSMT integration for friendly monsters
TODO (1.61)
+- Get rid of RPGAbilityCategory instances
- U key in RPGSelectionMenu
- Proximity grenades
- Fix stat points !!!
@@ -119,6 +120,7 @@ Release Config TODO:
- ArtifactTurretSummonBase
DONE 1.61:
+- Fixed keybinding in RPGMenu
- Ejector Seat and Ultima have status icons
- Vehicle repair ignores UDamage
- XLoc beacon gets reset when entering a vehicle
Please sign in to comment.
Something went wrong with that request. Please try again.