Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add base camp construction markers #71084

Merged
merged 11 commits into from
Jan 25, 2024

Conversation

PatrikLundell
Copy link
Contributor

@PatrikLundell PatrikLundell commented Jan 19, 2024

Summary

None

Purpose of change

Fix #71016, as per the title

Describe the solution

Detect which tiles are changed by the application of a construction order by applying them to a fake map and then apply the construction site field to the corresponding tiles of the real map when initiating construction and doing the corresponding action to remove the construction field site after construction.

The logic was mostly stolen from an operation that counted number of changed terrain and furniture tiles.

This required the introduction of a new field, with the "looks like" selected to hopefully not cause any confusion.

It can be noted that the author can not be trusted to draw a stick figure without supervision, so tile support will have to be provided by competent people.

Apply the solution above to salt water pipes and remote fortifications.

Add new map operation to get rid of fields directly, rather than waiting for maintenance updates that don't happen.

Describe alternatives you've considered

  • Remove mid 0.F backward compatibility code from remote fortifications. Deemed a little early.
  • Change remote fortification implementation to use rotation/mirroring. Out of scope, provides no game play benefit, and would have insignificant effect on the code volume.

Testing

  • Order the construction of a livestock version 2 chicken coop (it's subjected to both rotation and mirroring, if I remember correctly).
  • Order the construction of a remote defense line.
  • Go out and check that it's marked.

Started the defense line project:
Screenshot (313)

  • Expand camp with a Workshop version 2.
  • Order the construction of the start of a salt water pipe.
  • Go outside and verify the fields appear on the ground for the chicken coop.

Started the chicken coop project:
Screenshot (314)

  • Continue and check on the salt water pipe project.

Started the salt water pipe project:
Screenshot (315)

  • Return, debug advance time, and finish the three project steps.
  • Go out and check on the progress.

Finished the chicken coop:
Screenshot (316)

Finished the trench part of the defense line:
Screenshot (317)

Finished the first part of the salt water pipe project (well in the swamp):
Screenshot (318)

  • Return back and order the construction of spikes in the defense line trenches, as well as a set of salt water pipes.
  • Go out and check the markings.

Ordered the spike part of the defense:
Screenshot (319)
line:

Ordered the construction of the first few sections of the salt water pipe:
Screenshot (320)

  • Return back, advance time, and finish the projects.
  • Go out and check on the projects.

Finished the defense line:
Screenshot (321)

Finished the first few sections of the salt water pipe:
Screenshot (322)

  • Return back and order the construction of the last salt water pipe segments.
  • Go out and check on the projects.

Ordered the last part of the salt water pipe construction:
Screenshot (323)

  • Return back and finish the projects.
  • Start the construction of the salt water pump itself.

Ordered the salt water pump construction (and finished the last segment of the pipes):
Screenshot (324)

  • Return back and finish the project.
  • Go out and check the results.

Finished the salt water pump:
Screenshot (325)

Additional context

The new delete field operation works, as far as I can see, and I don't think it should be unsafe when used with fields that don't have effects beyond being visible. Comments from competent people would be desirable, however.

@PatrikLundell PatrikLundell marked this pull request as draft January 19, 2024 15:51
@github-actions github-actions bot added [JSON] Changes (can be) made in JSON Map / Mapgen Overmap, Mapgen, Map extras, Map display [C++] Changes (can be) made in C++. Previously named `Code` Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. Player Faction Base / Camp All about the player faction base/camp/site <Bugfix> This is a fix for a bug (or closes open issue) astyled astyled PR, label is assigned by github actions json-styled JSON lint passed, label assigned by github actions labels Jan 19, 2024
@ANickelN
Copy link
Contributor

Does this work in showing the player a "preview" of what will change if the order is given? I find frequently that base camp changes overlap with items or constructions I've placed.

@PatrikLundell
Copy link
Contributor Author

PatrikLundell commented Jan 19, 2024

No. As the images show, it only shows which tiles are affected by the construction mission, not what the mission constructs. Also, the indications are generated upon giving the construction order, at which time you have committed resources to the construction.
It does, however, show you where not to store stuff and park vehicles (and remove things if located there).

Displaying what to place where would require some illusionary version of everything terrain, furniture, and combination thereof that can be constructed, plus logic to tie the illusionary version to the real one and handle the cases where the illusionary version doesn't exist (because nobody has defined it).
In addition to that, it would also require logic to turn these preview displays on and off.

It can also be noted that field basecamp version 2 and version 2 of expansions create indications of where things will be built in the future by removing the grass from those tiles.

@IdleSol
Copy link
Contributor

IdleSol commented Jan 19, 2024

It's probably stupid.

What happens if I overlay the same field with ````"display_field": false,```? And then delete it.

@Procyonae
Copy link
Contributor

This is great and I don't see any need for it to show a preview of the terrains and furniture

Displaying what to place where would require some illusionary version of everything terrain, furniture, and combination thereof that can be constructed, plus logic to tie the illusionary version to the real one and handle the cases where the illusionary version doesn't exist (because nobody has defined it).

That said I do disagree that it'd need any of this, it could just use the existing sprites/symbols with some way to differentiate them like the way that seeing down z levels does, for sprites it could give them a blue hue and cut them up in lines to make it look like a hologram for example and for symbols the background could cycle light blue and back for instance.
Obviously I'm not suggesting this would be remotely easy to implement code wise though and would be very extra, but would be cool for say nest constructions in the future where you actually get to decide where they place and hence seeing what's actually being placed would be more relevant, even then just a different field for walls would probably do though.

@PatrikLundell
Copy link
Contributor Author

You can't define the same thing twice (or if you can, only one of them would be active, probably "randomly", as that's what's happened in the past with duplicate definitions that weren't detected as duplicates).

It might be possible to hide it by defining a hiding field that has a blank as its symbol and has a higher priority, but then it would remain and clutter the memory (and hide any other future constructions in that space, such as e.g. the furnishing of a building just constructed). Much better to find out how to refresh the display of the fields.

I have no idea how to do any "graphic" display stuff, so illusory versions of things would have to be done by someone else. They'd have to be readily distinguishable from the real thing even in character mode.

@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jan 20, 2024
@github-actions github-actions bot removed the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jan 20, 2024
@PatrikLundell PatrikLundell marked this pull request as ready for review January 21, 2024 13:35
@github-actions github-actions bot added json-styled JSON lint passed, label assigned by github actions and removed json-styled JSON lint passed, label assigned by github actions labels Jan 24, 2024
@github-actions github-actions bot added the BasicBuildPassed This PR builds correctly, label assigned by github actions label Jan 24, 2024
@Maleclypse Maleclypse merged commit 283c7cb into CleverRaven:master Jan 25, 2024
20 of 27 checks passed
@Maleclypse
Copy link
Member

This is pretty cool!

@sparr
Copy link
Member

sparr commented Oct 20, 2024

Gonna steal this for another ui/visual-only field idea. Thanks for laying the groundwork!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
astyled astyled PR, label is assigned by github actions BasicBuildPassed This PR builds correctly, label assigned by github actions <Bugfix> This is a fix for a bug (or closes open issue) [C++] Changes (can be) made in C++. Previously named `Code` Fields / Furniture / Terrain / Traps Objects that are part of the map or its features. [JSON] Changes (can be) made in JSON json-styled JSON lint passed, label assigned by github actions Map / Mapgen Overmap, Mapgen, Map extras, Map display Player Faction Base / Camp All about the player faction base/camp/site
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Introduce a construction site indication for base camp/expansion construction in progress
6 participants