Determine max build/reach/etc distance?

Place to get help with not working mods / modding interface.
Post Reply
User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Determine max build/reach/etc distance?

Post by aubergine18 »

Using the Lua API, I can determine the bonuses applied to player distances (reach, build, etc) but don't seem to be able to determine the original distances, either via the player or character entities or their prototypes. Is there some way to ascertain the missing information? (I'm aware I can serpent-encode raw prototype data in to a .order property that's readable during control phase of mod operation, but would rather avoid that).
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.

User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Determine max build/reach/etc distance?

Post by aubergine18 »

bump
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.

Rseding91
Factorio Staff
Factorio Staff
Posts: 13221
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: Determine max build/reach/etc distance?

Post by Rseding91 »

There is no way to currently do it.

I still haven't thought of a decent way to expose all of the entity prototype properties runtime. There are a plethora of different properties that are of no use to mods and I don't want to just dump them all out slowing down everything else from them existing.

Stuff like render frame count, visual offsets, and sound data.
If you want to get ahold of me I'm almost always on Discord.

User avatar
aubergine18
Smart Inserter
Smart Inserter
Posts: 1264
Joined: Fri Jul 22, 2016 8:51 pm
Contact:

Re: Determine max build/reach/etc distance?

Post by aubergine18 »

Adding all the prototype properties would be unwise - I can't think of any use for knowing frame counts in animations for example. So I agree with the approach being taken currently.

When building certain entities, I want to show a map overlay indicating best placement for those entities, essentially making terrain a factor in the decision making process when building. Here's what I've got so far:

Image

(Aside: Would be great if flying-text accepted custom fonts)

At the moment, I've just hard-coded the build-distance for the player, however that will become cumbersome longer term as my mod also adds different character classes (human, metahuman, cyborg, android), each with their own set of characteristics and abilities. I could just hard-code them all, but ideally want to pull from the 'player' prototype of the selected .character so that additional character classes can be added without needing alterations to the code.
Better forum search for modders: Enclose your search term in quotes, eg. "font_color" or "custom-input" - it prevents the forum search from splitting on hypens and underscores, resulting in much more accurate results.

Post Reply

Return to “Modding help”