Skip to content

Conversation

@stavrosfa
Copy link
Contributor

This PR is a product of a discussion we had in discord regarding the implementation of "Wealth". Check it out here

There is a lot of boiler plate code because a new type of producable items was introduced.
I ended up calling it Inflow, not that it's a good name, but I spent at least 2 hours searching for a proper term, in the end I just went with something.

This type/category is meant to host items like "Wealth". The wealth producable is fully implemented. I have included 2 other examples with dummy code, I hope you will get the idea.

The point is to have stuff like wealth, that add to the city (and perhaps in the future globally), so in my examples you can see another item called "Cultivation" that is boosting the city's culture based on its current value, and another called "Expertise" that boosts science based on the city's beakers. So it's like Wealth but for Culture and Science.

These are fully exposed to the lua layer so it can do whatever it's instructed, so no need to hardcode anything in C#. We could add more restrictions like after what tech each is available and so on, this is I guess a more minimalistic example as I have simply hardcoded CanProduce() to true.

The triggers that call Lua eventually is in the Player and City classes. All 3 triggers send an integer so that Lua can use to calculate what it should do. At first I was passing the city object, but I had some infinite loop issues where I was calling from lua the method that was calling it in C#, so again, for now and for the sake of simplicity I pass an int to base the calcualtions on. This can change in the future.

If it's any easier for you to understand, I kind of tried to follow the way Terraform/TerraformImprovement is implemented and integrated with Lua.

FInal thing, this is not the "final" implementation, there are many things to be done for this to be actually merged, this is more of a POC.

Let me know what you think or if you have any questions.

@WildWeazel I hope you will like this!

Cheers!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant