Only case that would still work as the original PR discussed in the OP (i.e. new colony set to happiness 0) is for NO_STOCKPILE species, which are the Exobots.
I am OK with that (it will be a problem for my current situation in ninth game, but I can live with it).
Ophiuchus wrote: ↑Thu Apr 16, 2020 12:50 pmI think there is currently no backend support/valueref/condition like TurnColonyEstablished.
I'll probably add something.
An issue: what counts as colonization? For colony ships, it calls an internal Colonize function. But colony buildings use the SetSpecies and SetPopulation effects. These can also be used on already-colonized planets, but should probably not always count as a new colonization event. I'll probably modify a planet's SetSpecies function to set the colonization turn if the species was previously empty.
Would it make sense to change how colony ship parts work so that their colonization effect is processed in FOCS? Something to make the Planet::Colonize() function call/trigger a FOCS effect.
If I understood it correctly, one of the problems encountered while trying to fix this FOCS-only (via specials) was that the colonization through the Planet::Colonize() function kicked in one turn earlier.
Ophiuchus wrote: ↑Thu Apr 16, 2020 12:50 pmI think there is currently no backend support/valueref/condition like TurnColonyEstablished.
I'll probably add something.
An issue: what counts as colonization? For colony ships, it calls an internal Colonize function. But colony buildings use the SetSpecies and SetPopulation effects. These can also be used on already-colonized planets, but should probably not always count as a new colonization event. I'll probably modify a planet's SetSpecies function to set the colonization turn if the species was previously empty.
https://github.com/freeorion/freeorion/ ... 04be90a46c provides a LastTurnColonized property for planets in FOCS (and the objects list). For loaded saves, it is set to the previous turn for already-colonzied planets (ie. those with a non-empty species). Otherwise the default is INVALID_GAME_TURN, which is a big negative number.
swaq wrote: ↑Thu Apr 16, 2020 9:21 pm
I could not figure out how to remove a special from a planet that had just lost its population without creating a new dedicated special that required a graphics file. Also, because of the difference in the way that colonies are formed by colony buildings versus colony ships I was finding that I had to account for two possible turns requiring not one but two specials to keep track of the state. It was getting really messy and I had spent hours on it before I found the much cleaner stockpile hack.
I am pretty sure the second special is not necessary.
You would have had to anchor the removal effect not on species (because that does not exists anymore), e.g. you could have added it to a starting tech (like it is done for sitreps). Or you would have to move the check from the Source/activation to the targets.
AFAIU you would not have to do anything special for the buildings case (you could just ignore it). Just add the AddSpecial and happiness effect to an effectgroup used in the species (so this would get checked for every planet and ship of the owner), filter the activation by Planet/PopulationCenters which do not have the Special already (maybe check for positive population).
Note this does not have a relevance for the current issue anymore as geoff the implementation for a lasting implementation - this is just general FOCS talk/explanation.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.
Geoff the Medio wrote: ↑Thu Apr 16, 2020 3:13 pmI'll probably add something.
An issue: what counts as colonization? For colony ships, it calls an internal Colonize function. But colony buildings use the SetSpecies and SetPopulation effects. These can also be used on already-colonized planets, but should probably not always count as a new colonization event. I'll probably modify a planet's SetSpecies function to set the colonization turn if the species was previously empty.
https://github.com/freeorion/freeorion/ ... 04be90a46c provides a LastTurnColonized property for planets in FOCS (and the objects list). For loaded saves, it is set to the previous turn for already-colonzied planets (ie. those with a non-empty species). Otherwise the default is INVALID_GAME_TURN, which is a big negative number.
Hm, I think depopulation and recolonisation is not covered? Don't have the brains currently to suggest something useful though. Something like INVALID_GAME_TURN on depopulate()/setPop(0).
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.
Geoff the Medio wrote: ↑Fri Apr 17, 2020 9:47 amhttps://github.com/freeorion/freeorion/ ... 04be90a46c provides a LastTurnColonized property for planets in FOCS (and the objects list). For loaded saves, it is set to the previous turn for already-colonzied planets (ie. those with a non-empty species). Otherwise the default is INVALID_GAME_TURN, which is a big negative number.
Hm, I think depopulation and recolonisation is not covered? Don't have the brains currently to suggest something useful though. Something like INVALID_GAME_TURN on depopulate()/setPop(0).
Could it be circumvented FOCS-only by checking population along with LastTurnColonized or sth like that?
Also, what is recolonization? When you colonize a planet with no species that had one before, right?
If it's being recolonized by a Colony Ship, it shall work with Geoff patch, isn't it?
If it's being recolonized by a Colony Building... can we have a SetLastTurnColonized keyword to invoke in that case?
A planet that depopulates was still last colonized at the same time as it was before the depopulation, so nothing needs to happen.
As indicated above, when SetSpecies is called, it sets the last colonized value to the current turn, if the species was initially empty, so both colony ships and the SetSpecies effect should set the last colonzied turn for an initially not-populated planet.
Geoff the Medio wrote: ↑Thu Apr 16, 2020 3:13 pmI'll probably add something.
An issue: what counts as colonization? For colony ships, it calls an internal Colonize function. But colony buildings use the SetSpecies and SetPopulation effects. These can also be used on already-colonized planets, but should probably not always count as a new colonization event. I'll probably modify a planet's SetSpecies function to set the colonization turn if the species was previously empty.
https://github.com/freeorion/freeorion/ ... 04be90a46c provides a LastTurnColonized property for planets in FOCS (and the objects list). For loaded saves, it is set to the previous turn for already-colonzied planets (ie. those with a non-empty species). Otherwise the default is INVALID_GAME_TURN, which is a big negative number.
Thanks! I'll play around a little with this today.
Geoff the Medio wrote: ↑Fri Apr 17, 2020 8:46 am
An issue: what counts as colonization? For colony ships, it calls an internal Colonize function. But colony buildings use the SetSpecies and SetPopulation effects. These can also be used on already-colonized planets, but should probably not always count as a new colonization event. I'll probably modify a planet's SetSpecies function to set the colonization turn if the species was previously empty.
https://github.com/freeorion/freeorion/ ... 04be90a46c provides a LastTurnColonized property for planets in FOCS (and the objects list). For loaded saves, it is set to the previous turn for already-colonzied planets (ie. those with a non-empty species). Otherwise the default is INVALID_GAME_TURN, which is a big negative number.
Thanks! I'll play around a little with this today.
This works great! I made a new pull request to use the new property instead of the stockpile hack.
What is the meaning of happiness for Exobots? Shouldn't they always have max happiness (or not have this property at all), as they are just semi-autonomous robots following orders?
ThinkSome wrote: ↑Wed Apr 22, 2020 8:24 pm
What is the meaning of happiness for Exobots? Shouldn't they always have max happiness (or not have this property at all), as they are just semi-autonomous robots following orders?
ThinkSome wrote: ↑Wed Apr 22, 2020 8:24 pm
What is the meaning of happiness for Exobots? Shouldn't they always have max happiness (or not have this property at all), as they are just semi-autonomous robots following orders?
There has been discussion of changing "Happiness" to the broader idea of "Stability", but I don't know if that's still in the works.
All of my contributions should be considered released under creative commons attribution share-alike license, CC-BY-SA 3.0 for use in, by and with the Free Orion project.
ThinkSome wrote: ↑Wed Apr 22, 2020 8:24 pm
What is the meaning of happiness for Exobots? Shouldn't they always have max happiness (or not have this property at all), as they are just semi-autonomous robots following orders?
There has been discussion of changing "Happiness" to the broader idea of "Stability", but I don't know if that's still in the works.
Probably after introducing influence we will pick it up again. Whatever the thing will be called then - probably having a low value means rebellion is likelier to happen.
Any code or patches in anything posted here is released under the CC and GPL licences in use for the FO project.