[15.35] get_cease_fire is false for neutral force

Bugs that are actually features.
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

[15.35] get_cease_fire is false for neutral force

Post by Adil »

Entities of player and neutral forces do not attack each other. Yet the command:

Code: Select all

game.player.force.get_cease_fire"neutral"
returns false. (As well as other variants of obtaining the diplomatic stance between the player and the trees.)
Actually, the neutral force seems to be at war with every other force.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
Rseding91
Factorio Staff
Factorio Staff
Posts: 14250
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [15.35] get_cease_fire is false for neutral force

Post by Rseding91 »

Thanks for the report. The cease_fire mechanic was added long after the neutral force system was put in place and was never intended to be used with it. Similarly how the "get_friend" function says false when you check it against itself - it's just outside of the scope of what it's meant to do.

The neutral force is neutral to everyone - implicitly. Adding it to every force that exists would do nothing but add more data to the save file and complicate the logic further.
If you want to get ahold of me I'm almost always on Discord.
User avatar
Adil
Filter Inserter
Filter Inserter
Posts: 945
Joined: Fri Aug 15, 2014 8:36 pm
Contact:

Re: [15.35] get_cease_fire is false for neutral force

Post by Adil »

Well, for now it complicates the checks of two forces relations and introduces behavior contradicting to the documentation.
The documentation for the functions simply says:
get_cease_fire(other) → boolean
Will this force attack members of another force?
get_friend(other) → boolean
Is this force a friend?
There is no "you should check yourself if the force is neutral" warning there.

And is there any reason not to put something like this:

Code: Select all

if (force.name=="neutral") {return true; }; 
inside the function, rather than inside the code that expects the function to do its thing.
I do mods. Modding wiki is friend, it teaches how to mod. Api docs is friend too...
I also update mods, some of them even work.
Recently I did a mod tutorial.
Post Reply

Return to “Not a bug”