I'm wondering if there might be a better way to do it, both gameplay and from a technical perspective. Like when you start crawling, the crawler "deploys" into another unit type, which is imobile (this deploying could be done as an upgrade methinks). That new unit type would then have a couple of options:
1) Set home city.
2) Undeploy. (returns to mobile crawler)
Now, the only custom information would be the deployed crawlers home city (lets call a deployed crawler an extractor). Each turn you'd iterate over every extractor and add the resources to the home city.
If you want to be ultra sneaky you could force-name the crawler/extractor to the city it's crawling too, as a bonus the information is then readily available to the player and you wouldn't have to store ANY custom data at all!
So this is how I think it could work:
A new crawler is built. Player sends it to a tile.
Player deploys crawler once it reaches tile, if there is already an extractor there, the deployment is cancelled.
Dialog pops up asking which city you want to crawl to, the default (first position) is the nearest city.
The crawler is renamed to that city.
During the appropriate event, use the extractors names to locate the city and add the resources, at some point perform sanity check like player ownership.
Edit the rename unit event function to prevent people renaming crawlers.
Something to think about, anyway.
1) Set home city.
2) Undeploy. (returns to mobile crawler)
Now, the only custom information would be the deployed crawlers home city (lets call a deployed crawler an extractor). Each turn you'd iterate over every extractor and add the resources to the home city.
If you want to be ultra sneaky you could force-name the crawler/extractor to the city it's crawling too, as a bonus the information is then readily available to the player and you wouldn't have to store ANY custom data at all!
So this is how I think it could work:
A new crawler is built. Player sends it to a tile.
Player deploys crawler once it reaches tile, if there is already an extractor there, the deployment is cancelled.
Dialog pops up asking which city you want to crawl to, the default (first position) is the nearest city.
The crawler is renamed to that city.
During the appropriate event, use the extractors names to locate the city and add the resources, at some point perform sanity check like player ownership.
Edit the rename unit event function to prevent people renaming crawlers.
Something to think about, anyway.
Comment