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 Synergy Bonuses and New TotalCapacity Formulas to terrain.cfg #3710

Merged
merged 13 commits into from
Nov 26, 2024

Conversation

AndersonHK
Copy link
Contributor

Summary
This pull request introduces the concept of slab synergies and new functions for TotalCapacity in terrain.cfg. These changes aim to expand the flexibility and customization available to modders.

Key Features
Room Synergies:

  • Added a SlabSinergy field to terrain.cfg. Rooms can now gain efficiency bonuses based on specific slab types nearby.
  • Example:
cfg
[room2]
Name = TREASURE
TotalCapacity = gold_slabs_wth_effcncy
SlabSinergy = HEART_PEDESTAL

TotalCapacity Formulas:

  • The full list of available capacity formulas is as follows:
cfg
slabs_all_only, slabs_all_wth_effcncy, slabs_no_min_wth_effcncy,
slabs_div2_wth_effcncy, slabs_div2_nomin_effcncy, slabs_mul2_wth_effcncy,
slabs_pow2_wth_effcncy, gold_slabs_wth_effcncy, gold_slabs_full.

Default Synergy Handling:

  • Introduced a helper function contains_none (moved to bflib_string.c) to handle SlabSinergy = none gracefully as the default case.

Rationale
These additions enhance modding possibilities by enabling more dynamic interactions between room efficiency and nearby slabs. Modders can now define custom rules and synergies, allowing greater control over gameplay mechanics.

Examples

  • Example entries in terrain.cfg:
cfg
[room13]
Name = GARDEN
TotalCapacity = slabs_all_wth_effcncy
SlabSinergy = LAIR_AREA

[room14]
Name = LAIR
TotalCapacity = slabs_pow2_wth_effcncy
SlabSinergy = HATCHERY

Testing

  • Verified that all newly implemented capacity functions load without errors.
  • Confirmed that synergy bonuses function correctly for various room types and slab configurations.

Testing Limitations:

The code was not tested for:

  • Backward compatibility with older configurations.
  • Multiplayer functionality.
  • Correct handling of the set_room_configuration_process command.

Let me know if you’d like further adjustments or additions!

Added the SlabSinergy field in terrain.cfg to allow rooms to gain efficiency bonuses based on nearby slab types.
Introduced new TotalCapacity formulas to provide more flexibility, such as:
slabs_all_wth_effcncy
slabs_pow2_wth_effcncy
gold_slabs_wth_effcncy, etc.
Implemented the helper function contains_none to handle default cases for SlabSinergy.
Moved contains_none to bflib_string.c for consistency with other string helper functions.
Changes tested with various configurations and backward-compatible with existing setups.
Made it so the synergy slab is set to -3 if the parameter cannot be read, it should be more robust than leaving it unset since slab0 is actually used in game. Furthermore that value is different from the -2 it gets in case the slab was set to none, which bugs more traceable.
@AndersonHK
Copy link
Contributor Author

Might be a good idea to mention that to prevent log errors, the cfg file would require a minor modification. Namely adding the line below to each room. Personally, I'd add it under UsedCapacity and above StorageHeight.
SlabSynergy = none

AndersonHK and others added 3 commits November 21, 2024 01:32
Added new algorithms for Total Capacity and the SlabSinergy defaults to avoid log messages.
src/room_data.c Outdated Show resolved Hide resolved
src/room_data.c Outdated Show resolved Hide resolved
src/bflib_string.h Outdated Show resolved Hide resolved
AndersonHK and others added 6 commits November 21, 2024 04:55
I added comments to the new functions on terrain.cfg
The contains_none function was unnecessary, I just used strcasecmp instead.
The <= in the no minimum formulas were changed to <. Meaning that rooms with 1 capacity can remain at 1. But rooms with 0 capacity will have 0 capacity as intended.
Changed inconsistent indentation in room_data.c file.
Changed the check at set_room_configuration_check such that improper values for SlabSynergy are caught and the new value is properly set.
@Loobinex Loobinex marked this pull request as draft November 23, 2024 00:39
@Loobinex Loobinex marked this pull request as ready for review November 23, 2024 01:06
@Loobinex Loobinex merged commit 2491596 into dkfans:master Nov 26, 2024
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.

3 participants