LuaDocs/Activity
From Data Realms Wiki
Parent: Entity
Generic Class. Base class for all Activity:s, including game modes and editors.
Enumerations
ActivityState
- 0 = NOTSTARTED
- 1 = STARTING
- 2 = EDITING
- 3 = PREGAME
- 4 = RUNNING
- 5 = DEMOEND
- 6 = INERROR
- 7 = OVER
Player
- 0 = PLAYER_1
- 1 = PLAYER_2
- 2 = PLAYER_3
- 3 = PLAYER_4
- 4 = MAXPLAYERCOUNT
Team
- 0 = TEAM_1
- 1 = TEAM_2
- 2 = TEAM_3
- 3 = TEAM_4
- 4 = MAXTEAMCOUNT
ViewState
- 0 = NORMAL
- 1 = OBSERVE
- 2 = DEATHWATCH
- 3 = ACTORSELECT
- 4 = AISENTRYPOINT
- 5 = AIPATROLPOINTS
- 6 = AIGOLDDIGPOINT
- 7 = AIGOTOPOINT
- 8 = LZSELECT
DifficultySetting
- 0 = MINDIFFICULTY
- 15 = CAKEDIFFICULTY
- 40 = EASYDIFFICULTY
- 60 = MEDIUMDIFFICULTY
- 85 = HARDDIFFICULTY
- 98 = NUTSDIFFICULTY
- 100 = MAXDIFFICULTY
Properties
ClassName
Read-only property. The class name of this Entity.A string with the friendly-formatted type name of this object.
Description
Read-only property. The user-friendly description of this.A string with the user-friendly description of this.
InCampaignStage
Shows in which stage of the Campaign this appears.An int with the stage number. < 0 means it's not in the campaign
ActivityState
The current activity state code. See the ActivityState enumeration for the legend.An int with the game state code.
SceneName
The name of the current scene.A string with the instance name of the scene.
PlayerCount
The total number of active players in the current game, AI or HumanThe total number of players in the current game.
HumanCount
Read-only property. The total number of human players in the current gameThe total number of players in the current game.
TeamCount
The total number of teams in the current gameThe total number of teams in the current game.
Difficulty
The current difficulty settingThe current setting.
Functions
DeactivatePlayer
Turns off a player if they were active. Should only be done if brain etc are already taken care of and disposed of properly. Will also deactivate the team this player is on, if there's no other active players still on it.
Arguments:
- Which player index to deactivate.
Return value:
Whether the player was active before trying to deactivate.
PlayerActive
Indicates whether a specific player is active in the current game.
Arguments:
- Which player index to check.
Return value:
Whether the player is active in the current activity.
PlayerHuman
Indicates whether a specific player is human in the current game, ie not an AI player and has a screen etc.
Arguments:
- Which player index to check.
Return value:
Whether the player is active as a Human in the current activity.
TeamActive
Indicates whether a specific team is active in the current game.
Arguments:
- Which team index to check.
Return value:
Whether the team is active in the current activity.
GetTeamOfPlayer
Gets the current team a specific player belongs to.
Arguments:
- The player to get the team info on.
Return value:
An int with the team number.
SetTeamOfPlayer
Sets the current team a specific player belongs to.
Arguments:
- The player to set the team info on, and the team.
Return value:
None.
PlayersInTeamCount
Gets the current number of players in a specific team.
Arguments:
- Which team to get the player count for.
Return value:
An int with the player count.
ScreenOfPlayer
Converts a player index into a screen index, and only if that player is human.
Arguments:
- Which player index to convert.
Return value:
An int with the screen index, or -1 if nonhuman player or no players.
GetViewState
Gets the current viewing state for a specific player. See the ViewState enumeration for the legend.
Arguments:
- Which player to get the view state for.
Return value:
None.
SetViewState
Sets the current viewing state for a specific player. See the ViewState enumeration for the legend.
Arguments:
- The state you want to set to.
- Which player to get the view state for.
Return value:
None.
GetPlayerBrain
Gets the current Brain actor for a specific player.
Arguments:
- Which player to get the brain actor for.
Return value:
A pointer to the Brain Actor. Ownership is NOT transferred!
SetPlayerBrain
Sets the current Brain actor for a specific player.
Arguments:
- A pointer to the new brain Actor. Ownership is NOT transferred!
- Which team to set the brain actor for.
Return value:
None.
PlayerHadBrain
Shows whether a specific player ever had a brain yet.
Arguments:
- Which player to check whether they ever had a brain.
Return value:
Whether this player ever had a brain.
SetBrainEvacuated
Sets whether a player's brain was evacuated during the Activity.
Arguments:
- Which player to check whether their brain was evac'd.
- Whether it was evacuated yet.
Return value:
None.
BrainWasEvacuated
Shows whether a specific player's brain was evacuated into orbit so far.
Arguments:
- Which player to check whether their brain was evac'd.
Return value:
Whether this player had a brain that was evacuated.
IsAssignedBrain
Shows whether the passed in actor is the brain of any player.
Arguments:
- Which Actor to check for player brainedness.
Return value:
Whetehr any player's brain or not.
IsBrainOfWhichPlayer
Shows which player has a specific actor as a brain, if any.
Arguments:
- Which Actor to check for player brainedness.
Return value:
Which player has this assigned as a brain, if any.
IsOtherPlayerBrain
Shows whether the passed in actor is the brain of any other player.
Arguments:
- Which Actor to check for other player brainedness.
- From which player's perspective to make the query.
Return value:
Whetehr other player's brain or not.
HumanBrainCount
Shows how many human-controlled brains are left in this Activity.
Arguments:
- None.
Return value:
How many brains are left as human-controlled in this Activity.
AIBrainCount
Shows how many A.I.-controlled brains are left in this Activity.
Arguments:
- None.
Return value:
How many brains are left on as A.I.-controlled in this Activity.
GetControlledActor
Gets the currently controlled actor of a specific player.
Arguments:
- Which player to get the controlled actor of.
Return value:
A pointer to the controlled Actor. Ownership is NOT transferred! 0 If no actor is currently controlled by this player.
SetTeamFunds
Sets the amount of funds a specific team currently has in the game.
Arguments:
- Which team to set the fund count for. 0 = first team.
Return value:
A float with the funds tally for the requested team.
GetTeamFunds
Gets the amount of funds a specific team currently has in the game.
Arguments:
- Which team to get the fund count from. 0 = first team.
Return value:
A float with the funds tally for the requested team.
SetTeamAISkill
Sets AI skill level for specified team
Return value:
None
GetTeamAISkill
Arguments:
- Team to get skill level for
Return value:
Team skill level
ChangeTeamFunds
Changes a team's funds level by a certain amount.
Arguments:
- The amount with which to change the funds balance.
- Which team to alter the funds of. 0 = first team.
Return value:
None.
TeamFundsChanged
Checks whetehr the team funds changed since last time this was called. This also resets the state, so calling this again on the same team will ield false unless it's been changed again.
Arguments:
- Which team's funds to check.
Return value:
Whether funds amount changed for this team since last time this was called.
ReportDeath
Increments the tally of a death of an actor on a specific team.
Arguments:
- Which team to increase the death count of. 0 = first team.
Return value:
The new death count.
GetTeamDeathCount
Gets the number of deaths on a specific team so far on the current game.
Arguments:
- Which team to get the death tally of. 0 = first team.
Return value:
The current death count.
GetDemoTimeLeft
Shows how many seconds of demo time is left, if indeed in demo mode.
Arguments:
- None.
Return value:
An int wwith how many demo seconds are left, or < 0 if not applicable.
Running
Indicates whether the game is currently running or not (not editing, over or paused)
Arguments:
- None.
Return value:
Whether the game is running or not.
Paused
Indicates whether the game is currently paused or not.
Arguments:
- None.
Return value:
Whether the game is paused or not.
ActivityOver
Indicates whether the game is over or not.
Arguments:
- None.
Return value:
Whether the game is over or not.
EnteredOrbit
Indicates an Actor as having left the game scene and entered orbit. OWNERSHIP IS NOT transferred, as the Actor's inventory is just 'unloaded'.
Arguments:
- The actor instance. Ownership IS NOT TRANSFERRED!
Return value:
None.
SwitchToActor
Forces the ActivityMan to focus player control to a specific Actor for a specific team. OWNERSHIP IS NOT TRANSFERRED!
Arguments:
- Which Actor to switch focus to. The team of this Actor will be set once it is passed in. Ownership IS NOT TRANSFERRED! The Actor should be added to MovableMan already.
Return value:
Whether the focus switch was successful or not.
SwitchToNextActor
Forces the ActivityMan to focus player control to the next Actor of a specific team, other than the current one focused on.
Arguments:
- Which team to switch to next actor on.
- An actor pointer to skip in the sequence.
Return value:
None.
SwitchToPrevActor
Forces the ActivityMan to focus player control to the previous Actor of a specific team, other than the current one focused on.
Arguments:
- Which team to switch to next actor on.
- An actor pointer to skip in the sequence.
Return value:
None.
IsPlayerTeam
Indicates whether a team is player controlled or not.
Arguments:
- The team nuber to check.
Return value:
Whether team is player controlled or not.
ResetMessageTimer
Resets the message timer for one player
Arguments:
- The player to rese tthe message timer for.
Return value:
None.
Pause
Pauses and unpauses the game.
Arguments:
- Whether to pause the game or not.
Return value:
None.
End
Forces this activity's game end.
Arguments:
- None.
Return value:
None.