Player Factions Redo
The Player Factions mod is great - but it has some major problems. First, using passwords to create, enter, or disband the faction gets annoying. Second, when a player joins a faction, they are not invited, they simply know the password and can therefore join. With this mod, the code simply checks if the player running the command is the owner, in the case of creating or disbanding a faction, or kicking a player from it. This mod alters that so only when a player is invited to a faction, they can join. Then the invite is erased and cannot be used again. The mod stores these invites in a dictionary so multiple faction invites can be stored within. Here are the commands that are provided by Player Factions Redo:
-
/faction create <name>
: Create a new faction (name can only contain letters and numbers). -
/faction invite <player>
: Invite a player to your faction (owner only). -
/faction accept <faction>
: Accept an invitation to join a faction. -
/faction invites
: View your pending faction invites. -
/faction kick <player>
: Remove a player from your faction (owner only). -
/faction leave
: Leave your current faction (not available for owners). -
/faction disband
: Delete your faction (owner only). -
/faction owner <faction>
: Check who owns a specific faction. -
/faction transfer <player>
: Transfer faction ownership to another member (owner only). -
/faction rename <newname>
: Rename your faction (owner only). -
/faction order <message>
: Send an order message to all faction members (owner only). -
/faction chat <message>
: Send a message to all online faction members. -
/faction msg <player> <message>
: Send a private message to a specific faction member. -
/faction info <faction>
: Get the owner, members, and description for a faction. -
/faction chat <message>
: Send a message to all faction members.
Querying Functions
-
factions.get_factions()
: Retrieves all stored factions. -
factions.get_player_invites(player: str)
: Retrieves a player's pending faction invites. -
factions.get_player_faction(player: str)
: Gets the faction a player belongs to. -
factions.get_faction_players(faction: str)
: Returns a list of players in a given faction. -
factions.get_faction_by_name(name: str)
: Retrieves faction details by name. -
factions.get_faction_owner(faction: str)
: Returns the owner of a given faction. -
factions.get_faction_descrip(faction: str)
: Retrieves a faction's description.
Checking Conditions
-
factions.player_is_owner(player: str, faction: str)
: Checks if a player is the owner of a faction. -
factions.player_is_member(player: str, faction: str)
: Checks if a player is a member of a faction. -
factions.players_in_same_faction(player1: str, player2: str)
: Checks if two players belong to the same faction.
Creating Or Setting
-
factions.create_faction(owner: str, name: str)
: Creates a new faction. -
factions.update_faction(faction: str, data: dict)
: Updates a faction's data. -
factions.rename_faction(faction: str, new_name: str)
: Renames an existing faction. -
factions.change_faction_owner(faction: str, new_owner: str)
: Transfers faction ownership to another member.
Setting Or Updating Data
-
factions.save_factions(data: dict)
: Saves the provided faction data. -
factions.save_player_invites(player: str, invites: list)
: Saves a player's faction invites. -
factions.set_faction_descrip(faction: str, description: str)
: Sets a faction's description. -
factions.update_nametag(player: str)
: Updates a player's nametag with faction information. -
factions.update_all_member_nametags(faction: str)
: Updates nametags for all faction members.
Sending Orders and Messages
-
factions.send_faction_order(faction: str, message: str)
: Sends an order message to all faction members. -
factions.send_faction_message(faction: str, message: str, target_player: Optional[str] = None)
: Sends a message to faction members or a specific member.
Recommended
Add-ons that I recommend using with this mod.
Upcoming:
- Factions Bases: create bases for your faction.
- Factions Allies: create a list of allies and foes for your faction.
Great mod, with caveats
This is a great mod with intuitive commands syntax. I love it! Solves the leaky password issue of the other mod, and gives players a nice coloured prefix when they're part of a faction. They also don't do team damage which is great for big battles with lots of chaos.
A few caveats to note for server operators. When this mod is installed, player messages no longer display in the server console. If you have other mods which are intercepting chat messages, there's a chance this mod will prevent those mods from working. I learned this the hard way after my server's chat was intermittently not making it to discord via yl_matterbridge. Turns out this mod conflicts with that mod.
My workaround was to write my own message intercepter, which then calls yl_matterbridge and factions_redo.
I also had to comment out some lines in player_factions so it wouldn't intercept messages on it's own. There's probably a more elegant way to do this, but I'm not sure what that would look like.