Module ...

Defines factions

Functions

_M:add (t, t.name, t.short_name, t.reaction) Adds a new faction.
_M:factionReaction (f1, f2) Returns the status of faction f1 toward f2
_M:get (id) Returns the faction definition
_M:setFactionReaction (f1, f2, reaction, mutual) Sets the status of faction f1 toward f2.
_M:setInitialReaction (f1, f2, reaction, mutual) Sets the initial reaction.


Functions

_M:add (t, t.name, t.short_name, t.reaction)
Adds a new faction. Static method, and can be called during load.lua.

Parameters

  • t: the table describing the faction.
  • t.name: the name of the added faction, REQUIRED.
  • t.short_name: the internally referenced name, defaults to lowercase t.name with "-" for spaces.
  • t.reaction: table of initial reactions to other factions, where keys are short_names.

Return value:

t.short_name see above.
_M:factionReaction (f1, f2)
Returns the status of faction f1 toward f2

Parameters

  • f1: the source faction short_name.
  • f2: the target faction short_name.

Return value:

reaction a numerical value representing the reaction, 0 is neutral, <0 is aggressive, >0 is friendly.
_M:get (id)
Returns the faction definition

Parameters

  • id:
_M: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

  • f1: the source faction short_name.
  • f2: the target faction short_name.
  • reaction: a numerical value representing the reaction, 0 is neutral, <0 is aggressive, >0 is friendly.
  • mutual: if true the same status will be set for f2 toward f1.
_M:setInitialReaction (f1, f2, reaction, mutual)
Sets the initial reaction. Static method, and can be called during load.lua.

Parameters

  • f1: the source faction short_name.
  • f2: the target faction short_name.
  • reaction: a numerical value representing the reaction, 0 is neutral, <0 is aggressive, >0 is friendly.
  • mutual: if true the same status will be set for f2 toward f1.

Valid XHTML 1.0!