Page 1 of 1

Make "character_maximum_following_robot_count_bonus" works for standard entity and better documentation

Posted: Mon May 18, 2020 6:59 pm
by xlomkn
TL;DR
Better documentation of the LuaControl field "character_maximum_following_robot_count_bonus" in the LuaControl API page, and if it is relevant have a "maximum_following_robot_count_bonus" field that could be used on any kind of entity.

What ?
The LuaControl field "character_maximum_following_robot_count_bonus" needs to be called on an object that is associated with a character, but from a script, I can create combat robots and by setting the source parameter, make them follow a standard entity (let's say a vehicle):

Code: Select all

surface.create_entity({
      name = "defender-capsule",
      force = source_entity.force,
      source = source_entity, -- my vehicle
      ...
By the way, "source_entity.force.maximum_following_robot_count" includes the bonus from research, so I don't know what "character_maximum_following_robot_count_bonus" is for. Just trying to make my mod handle all situations smoothly.

My suggestion: better documentation of this field in the LuaControl API page, and if it is relevant have a "maximum_following_robot_count_bonus" field that could be used on any kind of entity and share the same value for characters or totally replace the field (which will breaks some mods).
Why ?
Because robots can follow a vehicle, I feel like it would be more coherent to also have this field for entity others than player / character.
And because I was unable to understand what this field is for !

Re: Make "character_maximum_following_robot_count_bonus" works for standard entity and better documentation

Posted: Mon May 18, 2020 8:00 pm
by Rseding91
The bonus and force effects are additive and only apply to the character entity. Specifically; the logic destroys any additional robots when they are attached to the character if the total robot count exceeds the 2 added values.

Past that, robots can attach to any entity in the game and follow them around. But there is no logic outside of the character entity to count and destroy "extras".

The counting logic in Character is special and requires additional memory to function. Additionally every time those bonus values change every character entity in the game has to be iterated over and told the value changed.

Those things mean the limit values are never going to be made to work on "all entities". Robots can continue to follow anything; they just "follow that entity".

Your confusion seems to come from thinking "if it can follow it, this limiter must effect it" and those are 2 separate things.

Re: Make "character_maximum_following_robot_count_bonus" works for standard entity and better documentation

Posted: Tue May 19, 2020 9:04 am
by xlomkn
Thanks for your reply.
Ok, I understand that the limit applies only to character. But I don't understand, what this bonus field is used for ? I've never seen it different from 0. Would it be possible to add extra words in the API doc about it's usage ?

Re: Make "character_maximum_following_robot_count_bonus" works for standard entity and better documentation

Posted: Tue May 19, 2020 10:54 am
by Rseding91
xlomkn wrote:
Tue May 19, 2020 9:04 am
Thanks for your reply.
Ok, I understand that the limit applies only to character. But I don't understand, what this bonus field is used for ? I've never seen it different from 0. Would it be possible to add extra words in the API doc about it's usage ?
It's the same as every other bonus field: another way to effect the total value. It's per-character-entity and is used in conjunction with the force-based ones: https://lua-api.factorio.com/latest/Lua ... d_modifier