Bob's Character classes


Adds character classes to the game.

2 months ago
0.16 - 1.1
87.6K

b Can you raise the created event when creating the character entity

4 years ago

My Construction drone mod listens to the build events to find characters,
Without raising the event, my construction drones won't work with any of the custom classes

4 years ago
(updated 4 years ago)

I can understand the request for an event specifically for this... but... The characters aren't created by a script.
You build an item, and place it, so any on_player_built_entity event could be a character. (standard respawn rules still apply too)
Could you just check that event and look to see if entity.type == "character"? the name may not be "character" though, as currently there are 4 classes.

Alternatively, if you just want to snapshot a list (EG, when your mod is added to an existing game that has mine in it), I add all of a player's characters to associated character's list.
https://lua-api.factorio.com/0.18.13/LuaPlayer.html#LuaPlayer.get_associated_characters
https://lua-api.factorio.com/0.18.13/LuaEntity.html#LuaEntity.associated_player

If this is not sufficient, let me know.

4 years ago

No i mean, just raise the 'script_raised_build' event, when you create the character using your script.

I catch all the other events for entities being built.

4 years ago

Here in your control.lua:

https://i.imgur.com/zB4HqpV.png

4 years ago

You just need to put raise_built = true after fast_replace = true:
https://lua-api.factorio.com/latest/LuaSurface.html#LuaSurface.create_entity

4 years ago
(updated 4 years ago)

oh... Derp, the part that replaces the entity when you choose a class.
Yeah, sure, I can add that to the list for next release.

New response