redruin1 / factorio-draftsman

A complete, well-tested, and up-to-date module to manipulate Factorio blueprint strings. Compatible with mods.
MIT License
92 stars 17 forks source link

Failure to load blueprint strings with textplate in them #101

Closed OwenDurni closed 7 months ago

OwenDurni commented 11 months ago

Describe the bug Make a blueprint containing entities from the textplate mod.

Current Behavior Draftsman throws an InvalidEntityError from entity.py (new_entity function)

Expected behavior Draftsman supports blueprints with this entity type.

Additional context Textplates use the SimpleEntityWithForce factorio prototype. It seems reasonable that draftsman would allow placing these entities and modifying their location. It seems unreasonable to be able to do much of anything else.

Draftsman may need custom support for textplate entities because of how they handle the variations for different characters? I'm not too sure.

Please also include the following: Draftsman version: 1.0.6 Python version: 3.9

I personally would not consider this a very high priority. It does seem useful to be able to include documentation in the form of textplate in the blueprint itself (although you can emulate this with constant combinators in vanilla).

redruin1 commented 11 months ago

Thanks for the report, I honestly forgot that this prototype was used. In a similar vein I might also have to create classes for SimpleEntityWithOwner, and perhaps more depending on which others I've missed. This is fairly critical in my estimation, so I'll actually probably release a minor version with the missing classes implemented soonish:tm:.

OwenDurni commented 11 months ago

Can confirm that this fixes the reported issue with textplate.

If relevant, I do get the following warning on the console when calling draftsman.blueprintable.Blueprint(blueprint-string-containing-textplate)

DraftsmanWarning: <class 'draftsman.prototypes.simple_entity_with_force.SimpleEntityWithForce'> has no attribute 'direction'

redruin1 commented 11 months ago

Can text plate entities be rotated?

redruin1 commented 11 months ago

Horrifyingly, the answer is both yes and no. They can be rotated and own a "direction" key, but doing so is invisible in-game; the right character in the following blueprint is rotated once clockwise: image

0eNqdkN0KgzAMRt8l11Vmp6vrq4wxqoYRqLW0dSjSd1/Vm/1cDHaZcPKdJAs0ekTryASQC1A7GA/ysoCnu1F67YXZIkiggD0wMKpfq4BTsFoFzHyvtM7awVp0EBmQ6XACWcQrAzSBAuGeuBXzzYx9k0hZ/MpiYAefxgezbrFGloe8YjCDFDyvkuqhHKkdOEb2ZeB/GPi7oSOH7Q7wD186b3uJfPlgQtD5Ha+LUpy5EKeyELyO8Qmd5ng+

Positively evil. I assume then that entities of these types can be rotated in other mods, but in this case it has no effect. Do you know of any other mods that use this prototype that I can cross reference, or should I just cave and add a direction parameter to both SimpleEntityWithOwner and SimpleEntityWithForce?

OwenDurni commented 10 months ago

A friend wrote this mod https://mods.factorio.com/mod/arrowplates which makes sure that the 8-directional arrow textplates properly rotate when the textplate is rotated.

I'm not aware of other mods off-hand where this matters.

falsedrow commented 10 months ago

The prototypes are rotatable and do have direction. The textplates in particular don't have a four way sprite, so you can't see the result visually, but they do track their direction.

I wanted to make all of the textplates rotate but decided that I didn't want to deal with all the new graphics without talking to the mod author first :-)

redruin1 commented 10 months ago

Noted. I'll make sure both prototypes are Directional then.