Class engine.Faction
Factions for actors
Defines 2 factions by default: "Players", "Enemies"
Functions
engine.Faction.add (t)
Adds a new faction
engine.Faction.setInitialReaction (f1, f2, reaction, mutual)
Sets the initial reaction.
engine.Faction.get (id)
Gets the faction definition
Methods
engine.Faction:factionReaction (f1, f2)
Gets the status of faction f1 toward f2
engine.Faction:setFactionReaction (f1, f2, reaction, mutual)
Sets the status of faction f1 toward f2.
engine.Faction:copyReactions (to, from)
Copies all the reactions from/to a faction onto a new one
Functions
- engine.Faction.add (t) STATIC
-
Adds a new faction
Parameters:
- t the table describing the faction.
Returns:
-
t.short_name see above
- engine.Faction.setInitialReaction (f1, f2, reaction, mutual) STATIC
-
Sets the initial reaction.
Parameters:
- engine.Faction.get (id) STATIC
-
Gets the faction definition
Parameters:
- id
Returns:
Methods
- engine.Faction:factionReaction (f1, f2)
-
Gets the status of faction f1 toward f2
Parameters:
Returns:
-
reaction a numerical value representing the reaction, 0 is neutral, <0 is aggressive, >0 is friendly.
- engine.Faction:setFactionReaction (f1, f2, reaction, mutual)
-
Sets the status of faction f1 toward f2.
This should only be used after the game has loaded (not in load.lua).
These changes will be saved to the savefile.
Parameters:
- engine.Faction:copyReactions (to, from)
-
Copies all the reactions from/to a faction onto a new one
Parameters:
- to
- from