I started implementing factions for my module, and had the following in my load.lua:
Code: Select all
-- Factions
Faction:add{ name="Infected", reaction={Players=-100, Staff=-100} }
Faction:add{ name="Staff", reaction={Players=0, Infected=-100} }
Faction:setFactionReaction("players", "infected", -100)
All of a sudden my player wasn't able to bump into and attack zombies (infected). A whole lot of debugging later and I fixed the problem by switching over to Faction:setInitialReaction. It appears that Faction:setFactionReaction stores the reaction in the actual game object (game.factions to be exact) which is checked before the actual Faction module itself. When this is used in load.lua the game.factions variable gets set to nil somewhere along the way and the reaction is lost. The Faction:setInitialReaction stores the reaction in the Faction module itself, which does not appear to be loaded multiple times and retains the reaction. Any thoughts as to where the game.factions variable is getting nilled, and what the intended differences between Faction:setInitialReaction and Faction:setFactionReaction are? Expanding the engine.Faction docstring and LuaDoc would be super, too.
