PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge Class Reference

This is a utility component to help synchronize the Dialogue System's Lua environment with the UFPS player. More...

Inheritance diagram for PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge:
Collaboration diagram for PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge:

Public Member Functions

virtual void Awake ()
 
virtual void Start ()
 
void OnConversationStart (Transform actor)
 
void OnConversationEnd (Transform actor)
 
virtual void DeactivateCurrentWeapon ()
 Deactivates the current weapon.
 
virtual void ActivateCurrentWeapon ()
 Activates the current weapon.
 
virtual void SyncFPToLua ()
 Records the UFPS player's data into the Dialogue System's Lua environment.
 
virtual void SyncLuaToFP ()
 Updates the UFPS player's data with the current values in the Dialogue System's Lua environment.
 
void SyncFPStatsToLua ()
 Syncs UFPS's player stats to Lua.
 
void SyncLuaToFPStats ()
 Syncs Lua to UFPS's player stats.
 
void SyncFPInventoryToLua ()
 Syncs the UFPS inventory to Lua.
 
void SyncLuaToFPInventory ()
 Syncs Lua to the UFPS inventory.
 
void SyncFPWeaponHandlerToLua ()
 Syncs the player's current weapon index to Lua.
 
void SyncLuaToFPWeaponHandler ()
 Syncs the current weapon index stored in Lua to be the player's current weapon.
 
void SetPlayerField (string fieldName, object value)
 Sets a player field in the Actor table.
 
Lua.Result GetPlayerField (string fieldName)
 Gets a player field in the Actor table.
 

Public Attributes

bool syncUFPSDuringConversations = true
 Sync UFPS data to Dialogue System at start of conversation, back to UFPS at end.
 
bool disableWeaponDuringConversations = true
 Set true to disable the player's weapon during conversations.
 
List< vp_ItemType > usableItemTypes = new List<vp_ItemType>()
 The usable item types.
 
bool debug = false
 

Protected Member Functions

virtual bool CanStart_SetWeapon ()
 The bridge temporarily registers this method with UFPS when applying the Lua inventory data back into UFPS.
 

Properties

vp_FPPlayerEventHandler fpPlayer [get]
 
vp_Inventory fpInventory [get]
 
vp_FPWeaponHandler fpWeaponHandler [get]
 
bool forceWield [get, set]
 
string LuaPlayerName [get]
 Gets the name of the player in the dialogue database.
 
string LuaPlayerIndex [get]
 Gets the string index of the player in the Actor[] table.
 

Detailed Description

This is a utility component to help synchronize the Dialogue System's Lua environment with the UFPS player.

It synchronizes health and inventory.

Every weapon (e.g., "Pistol") has an associated Lua variable (e.g., Variable["Pistol"]) that is equal to the count or ammo count (if it uses ammo) if the player has the weapon or 0 if the player doesn't. During conversations, your dialogue entries can check and/or set the values using Lua conditions and scripts.

Member Function Documentation

◆ ActivateCurrentWeapon()

virtual void PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.ActivateCurrentWeapon ( )
inlinevirtual

Activates the current weapon.

Used when ending a conversation.

◆ Awake()

virtual void PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.Awake ( )
inlinevirtual

◆ CanStart_SetWeapon()

virtual bool PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.CanStart_SetWeapon ( )
inlineprotectedvirtual

The bridge temporarily registers this method with UFPS when applying the Lua inventory data back into UFPS.

It prevents UFPS from playing equip/load animations.

Returns
false.

◆ DeactivateCurrentWeapon()

virtual void PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.DeactivateCurrentWeapon ( )
inlinevirtual

Deactivates the current weapon.

Used when starting a conversation.

◆ GetPlayerField()

Lua.Result PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.GetPlayerField ( string  fieldName)
inline

Gets a player field in the Actor table.

Returns
The player field.
Parameters
fieldNameField name.

◆ OnConversationEnd()

void PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.OnConversationEnd ( Transform  actor)
inline

◆ OnConversationStart()

void PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.OnConversationStart ( Transform  actor)
inline

◆ SetPlayerField()

void PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.SetPlayerField ( string  fieldName,
object  value 
)
inline

Sets a player field in the Actor table.

Parameters
fieldNameField name.
valueValue.

◆ Start()

virtual void PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.Start ( )
inlinevirtual

◆ SyncFPInventoryToLua()

void PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.SyncFPInventoryToLua ( )
inline

Syncs the UFPS inventory to Lua.

◆ SyncFPStatsToLua()

void PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.SyncFPStatsToLua ( )
inline

Syncs UFPS's player stats to Lua.

◆ SyncFPToLua()

virtual void PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.SyncFPToLua ( )
inlinevirtual

Records the UFPS player's data into the Dialogue System's Lua environment.

Records the player's health and inventory (weapons and items).

◆ SyncFPWeaponHandlerToLua()

void PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.SyncFPWeaponHandlerToLua ( )
inline

Syncs the player's current weapon index to Lua.

◆ SyncLuaToFP()

virtual void PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.SyncLuaToFP ( )
inlinevirtual

Updates the UFPS player's data with the current values in the Dialogue System's Lua environment.

Updates the player's health and inventory (weapons and items). Also uses fpPlayer.Register() to hook into CanStart_Weapon() to prevent UFPS from playing equip/load animations if the inventory has changed.

◆ SyncLuaToFPInventory()

void PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.SyncLuaToFPInventory ( )
inline

Syncs Lua to the UFPS inventory.

◆ SyncLuaToFPStats()

void PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.SyncLuaToFPStats ( )
inline

Syncs Lua to UFPS's player stats.

◆ SyncLuaToFPWeaponHandler()

void PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.SyncLuaToFPWeaponHandler ( )
inline

Syncs the current weapon index stored in Lua to be the player's current weapon.

Since the bridge has temporarily disabled equip/load animations, we can set the weapon immediately. (In an earlier version of this script that lacked the code to disable equip/load animations, we invoked SetWeapon() after 0.5s.)

Member Data Documentation

◆ debug

bool PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.debug = false

◆ disableWeaponDuringConversations

bool PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.disableWeaponDuringConversations = true

Set true to disable the player's weapon during conversations.

◆ syncUFPSDuringConversations

bool PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.syncUFPSDuringConversations = true

Sync UFPS data to Dialogue System at start of conversation, back to UFPS at end.

◆ usableItemTypes

List<vp_ItemType> PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.usableItemTypes = new List<vp_ItemType>()

The usable item types.

Assign all item types that the player can possibly use here. These item types will be synchronized with Lua.

Property Documentation

◆ forceWield

bool PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.forceWield
getset

◆ fpInventory

vp_Inventory PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.fpInventory
get

◆ fpPlayer

vp_FPPlayerEventHandler PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.fpPlayer
get

◆ fpWeaponHandler

vp_FPWeaponHandler PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.fpWeaponHandler
get

◆ LuaPlayerIndex

string PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.LuaPlayerIndex
get

Gets the string index of the player in the Actor[] table.

The string index for Lua.

◆ LuaPlayerName

string PixelCrushers.DialogueSystem.UFPSSupport.FPPlayerLuaBridge.LuaPlayerName
get

Gets the name of the player in the dialogue database.

The name of the player in the dialogue database.


The documentation for this class was generated from the following file: