Helper for mods that create new characters

by Pi-C

If your mod lets players use a character that looks differently, you'll have to decide whether you must overwrite the default character. This mod will help you with this decision, and make it really simple to overwrite the default or update the new prototypes in a safe way.

Internal
11 months ago
1.1
29.2K
Owner:
Pi-C
Source:
N/A
Homepage:
N/A
License:
MIT
Created:
1 year, 11 months ago
Latest Version:
1.1.6 (11 months ago)
Factorio version:
1.1
Downloaded by:
29.2K users

Mod authors

Character mods

If you're the author of a mod that provides new characters that players can use to change the way they appear in the game, this mod is for you! Using it, you can concentrate in your mod on what it should do: providing new characters and character-corpses. Just add a dependency on this mod to ensure its functions are available, define the properties that are absolutely necessary (animations, localization, sounds etc. -- anything that must be different from the default), and let this mod create and post-process your characters.

If a character selector mod is active, this helper mod will make sure that all changes made to the default character will be applied to your new characters as well (unless that would overwrite a property you have changed yourself). If there is no character selector mod, this helper mod will not simply overwrite the default character completely, but just the properties you've changed. Thus, players can use your new character and mods that change, for example, mining speed, building reach, or light without breaking things. All it takes is just a single function call in data-final-fixes.lua.

Character selector mods

If you are the author of a character selector mod, or if you want to prevent character mods from overwriting the default character for some other reason, you just need one function call to this helper mod, and all character mods depending on it will leave the default character alone.

Usage

This mod comes with detailed information on how to use it. There's also some example code that you could easily adjust to your needs, so using this helper mod should be easy as pie.

If you think the documentation is not clear enough and should be improved, please don't hesitate to contact me!

Players

If you have removed the mod that provided the character you've used when your game was saved, you won't have a character next time you load the game. The same may happen if you've removed a character selector mod, as all character mods will overwrite the default character instead of creating new characters.

This helper mod provides commands you can use to leave god mode and get back into a character without disabling achievements.

The commands will not be created if the scenario you're currently playing doesn't expect players to have a character (e.g. the vanilla "Sandbox" scenario).

If your current scenario supports characters, the commands will only be available if no character selector mod is active AND if the default character has been replaced at least 2 times.

  • /CMH-make-character creates a character for the player issuing the command. If the character can't be placed at your current position, the algorithm will gradually move toward {0, 0} until a suitable position has been found. If this fails, you will be asked to move to another position and run the command again.

Hint: You really should move to a suitable position before creating a character, or it may end up in the middle of an ocean, on a tiny island, on a spot surrounded by cliffs on all sides, or in the center of a huge enemy base.

  • /CMH-move DIRECTION DISTANCE will move the player DISTANCE chunks into the specified DIRECTION. DIRECTION must be one of North, East, South, or West, alternatively you can use the shorthands N, E, S, and W. Both the long and the short forms are case insensitive, so "n" will work as well as "nOrtH". DISTANCE must be an integer value in the range 1 <= DISTANCE <= 20. The command will move you no matter whether you've already created a new character or not.

Hint: If you move far away into unexplored area, it may take a while until you can see anything as the game must create the missing chunks first. Therefore, you should use this command only to get out of impossible situations, e.g. if you've accidentally created your character at a position that it can't leave.