Actor >> Info >> GameRules >> JBGameRules (abstract) >> JBGameRulesPersistence
Implementation - Click here to see the implementation details.
General
This class is used to implement specific game rules regarding this add-on. Upon start of a Jailbreak game, this add-on is added to the list of mutators. A description of the functions and variables are listed below.
Variables
- TPersistence
- This structure holds information about a particular controller and their pawn. The pawn's owner name is held, the controller's adrenaline amount, and an array of the pawn's inventory is held. A reference to the player's score is now kept in the structure to be used when sorting each team by their score. This will determine which player gets which weapons.
- TPersistWeapons
- This structure holds information about each weapon in the pawn's inventory. The weapon class, it's primary ammo, and it's secondary ammo are recorded for transfer into the next round.
- CapturerList
- A dynamic array to hold all the members of the capturing team.
- CapturedList
- A dynamic array to hold all the members of the captured team.
- NumCapturers
- An integer to hold the count of members of the capturing team.
- NumCaptured
- An integer to hold the count of members of the captured team.
- bNewRound
- For this add-on, a new round starts exactly when all controllers' pawns are spawned.
- bUprising
- This boolean variable determines if the server had selected to tranfer weapons over from the capturing team to the captured team.
- nHealth
- This is set by the server. This value is the amount of health to transfer over to the captured team.
Functions
- PreBeginPlay()
- Initialize all variables here.
- Timer()
- This function is called every second to determine if a new round has started. The reason for this approach is because in the function NotifyRound, each Controller's Pawn has not been created at that point. Using this approach allows the Pawns to be created so that their weapons may be carried over. This now sorts the two teams at the end of the round.
- NotifyExecutionEnd()
- Sets bNewRound to true.
- NotifyPlayerJailed(JBTagPlayer TagPlayer)
- This function will extract the team of the jailed player, and extract all players on the opposite team once all players of one team are jailed.
- ExtractPlayers(TeamInfo Team)
- Extracts the players on the teams and puts them into the associated array. Winning members go on the capturing team while losing members go on the captured team.
- CarryOverWeapons()
- Extracts all controllers in the new round and determines if they were the capturing team in the previous round. If they were on the capturing team, they will receive their inventory from the previous round.
- SetAdrenaline(Controller C, int Adrenaline)
- Sets the adrenaline for the controller in case the player was in mid-combo. (Not sure if core game code already handles this. Need to look into it.)
- PersistWeapon(Pawn P, TPersistWeapons Weapon)
- This function spawns the given weapon class and gives it to the associated pawn. Before giving the pawn the weapon, all ammo are transferred for that particular weapon. If the weapon is the assault rifle, then all ammo for the weapon are consumed and the new ammo is added. This function does not add the Assault Rifle, the Shield Gun, or the Translocator to the pawn as they are already spawned on the start of a new round.
- TransferHealth(Controller C)
- Each controller in the list is sent to this function. This function then determines if the controller was on the winning team or the losing team. The winning team loses the specified amount of health while the losing team gains the specified amount of health.
- AddToCapturingList(Controller Capturer)
- This function takes the given controller, and extracts out information needed to fill the TPersistence structure and the TPersistWeapons structure in the capturing array.
- AddToCapturedList(Controller Captured)
- This function takes the given controller, and extracts out information needed to fill the TPersistence structure and the TPersistWeapons structure in the captured array.
- SortListByScore(out array<TPersistence> Team, int LowerBound, int UpperBound)
- This function will sort the given team based on their score. The insertion sort algorithm is used.
- CleanUpArray()
- This function cleans up the array once all weapons are handed over to the capturing team and the captured team.