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

Expand the Building Actions #1335

Open
wants to merge 70 commits into
base: develop
Choose a base branch
from

Conversation

CrimRecya
Copy link
Contributor

I will update the docs soon and these GIFs will show you the main function.
building
building2

Copy link

github-actions bot commented Aug 4, 2024

Nightly build for this pull request:

This comment is automatic and is meant to allow guests to get latest nightly builds for this pull request without registering. It is updated on every successful build.

@CrimRecya
Copy link
Contributor Author

CrimRecya commented Aug 5, 2024

Building placing and deploying logic enhancement

  • In vanilla games, buildings are always cannot placing or deploying on the cells that other infantries or units on. Now this can be changed by setting ExpandBuildingPlace to true, when you try to place the building on these cells, it will check whether the occupiers can be scatter by yourself (include your own technos and allies non-player technos) and whether there are enough spaces to scatter. If can, it will record which building you are placing and show a preview to you and your allies, then start a timer to record this placement and order the occupiers to leave this building area. When the area is cleared, the building will be truly place down and the production queue will be restored to original state. But when the timer expires or an unexpected situation has occurred which make the building impossible be constructed here anymore, it will stop the action and play "cannot deploy here", then you should re-place or re-deploy the building in a valid space. Note that when the building has been recorded and is trying to place, unless the production queue has vanished (such as construction yard is no longer exist), it will continue to function normally until the conditions are not met.
    • AutoUpgrade controls whether building upgrades can be automatically placed on the correct and earliest built building.
    • LimboBuild controls whether building can be automatically placed like LimboDelivery.
    • LimboBuildID defines the numeric ID of the building placed by LimboBuild.
  • You can now set CheckUnitBaseNormal to true to use units to expand the construction scope of the base.
    • UnitBaseNormal controls whether our own buildings can be place around it like vanilla BaseNormal do.
    • UnitBaseForAllyBuilding controls whether ally buildings can be place around it like vanilla EligibileForAllyBuilding do.
  • Now technos have CanBeBuiltOn=true can simply removed when building is placed on them.
  • If set DrawAdjacentBoundary to true, it will display the four corners of the Adjacent boundary. If set PlacementGrid.Expand to true, it will display the placing grids with place.shp and following corresponding frame number.
    • PlacementGrid.LandFrames controls the placing grids frames on non-water cell. The three numbers respectively represent "Some technos that can command departure have occupied this area", "This cell is actually beyond the scope, but there is still at least one cell inside the entire region" and "Here is no problem, everything is OK".
    • PlacementGrid.WaterFrames controls the placing grids frames on water cell. Each item corresponds to the same as above.
  • Cameo.AlwaysExist is a setting that allows you to preview information. This feature can be used as before, playing "new construction options" and clearing the specific production queue when prerequisites loss.
    • Cameo.AlwaysExist controls whether you can see the cameo when the prerequisite have not satisfied (TechnoLevel, Owner, RequiredHouses and ForbiddenHouses should be satisfied). Defaults to [AudioVisual] -> Cameo.AlwaysExist.
    • ShowBuildingStatistics controls whether the number of buildings of this type that you currently own needs to be displayed in the upper right corner of the building cameo (requires the cameo exist).
    • Cameo.OverlayShapes controls the drawn image file.
    • Cameo.OverlayFrames controls which frame in Cameo.OverlayShapes to draw in three different situations: currently owned this building type, grey cameo and have its prerequisite, grey cameo but have no prerequisite (The last situation requires Cameo.AlwaysExist to be true). When set to a negative number, it means that there is no need to draw under the corresponding conditions.
    • Cameo.OverlayPalette the color palette used when drawing Cameo.OverlayShapes.
    • If Cameo.AuxTechnos is not set, in addition to basic conditions, the grey cameo will only show when AIBasePlanningSide condition is satisfied. Otherwise, the grey cameo will only show when at least one of these types is owned by you or its TechnoLevel, Owner, RequiredHouses, ForbiddenHouses, Cameo.AuxTechnos (use AIBasePlanningSide if not set) and Cameo.NegTechnos (if set) conditions are satisfied.
    • If Cameo.NegTechnos is set, the grey cameo will not show when you have a techno in one of these types.
    • The UIDescription.Unbuildable is like UIDescription, but this only appearing when the techno is truly unbuildable.

In ra2md.ini:

[Phobos]
DrawAdjacentBoundary=false       ; boolean
ShowBuildingStatistics=false     ; boolean

In rulesmd.ini:

[General]
CheckUnitBaseNormal=false        ; boolean
ExpandBuildingPlace=false        ; boolean

[AudioVisual]
PlacementGrid.Expand=false       ; boolean
PlacementGrid.LandFrames=1,0,0   ; integer, zero-based frame index - have technos, near boundary, is normal
PlacementGrid.WaterFrames=1,0,0  ; integer, zero-based frame index - have technos, near boundary, is normal
Cameo.AlwaysExist=false          ; boolean
Cameo.OverlayShapes=pips.shp     ; filename - including the .shp extension
Cameo.OverlayFrames=-1,-1,-1     ; integer - owned this building, grey and have its prerequisite, grey but have no prerequisite
Cameo.OverlayPalette=palette.pal ; filename - including the .pal extension

[SOMEBUILDING]                   ; BuildingType
AutoUpgrade=false                ; boolean
LimboBuild=false                 ; boolean
LimboBuildID=-1                  ; boolean

[SOMETECHNO]                     ; TechnoType
CanBeBuiltOn=false               ; boolean
Cameo.AlwaysExist=               ; boolean
Cameo.AuxTechnos=                ; List of TechnoTypes
Cameo.NegTechnos=                ; List of TechnoTypes
UIDescription.Unbuildable=       ; CSF entry key

[SOMEUNIT]                       ; UnitType
UnitBaseNormal=false             ; boolean
UnitBaseForAllyBuilding=false    ; boolean

In artmd.ini:

[SOMETECHNO]                     ; TechnoType
GreyCameoPCX=                    ; PCX filename - including the .pcx extension

@8abs
Copy link

8abs commented Aug 13, 2024

this should be merged asap

@4SGX
Copy link
Contributor

4SGX commented Aug 14, 2024

If I may suggest some more appropriate English for these tags:
AlwaysExistTheCameoAlwaysShowCameo or AlwaysShowInSidebar
PrerequisiteForCameoSidebarPrerequisite or CameoPrerequisite
CheckExpandPlaceGridUseNewGrid
And possibly remove Expand from ExpandLandGridFrames and ExpandWaterGridFrames

And cannot EligibleForAllyBuilding be reused here instead of creating the new tag UnitBaseForAllyBuilding?

Copy link
Contributor

@Coronia Coronia left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not quite sure about its logical correctness yet, more reviewing is definitely needed

also perhaps it should be separated to 4 different pull request for baseNormal, cameo display, building grid display and units auto moving/killed when building

src/Ext/BuildingType/Hooks.Upgrade.cpp Outdated Show resolved Hide resolved
src/Ext/House/Hooks.cpp Show resolved Hide resolved
src/Ext/House/Hooks.cpp Outdated Show resolved Hide resolved
src/Ext/House/Hooks.cpp Outdated Show resolved Hide resolved
src/Ext/BuildingType/Hooks.Placing.cpp Outdated Show resolved Hide resolved
src/Ext/BuildingType/Hooks.Placing.cpp Outdated Show resolved Hide resolved
src/Ext/BuildingType/Body.cpp Show resolved Hide resolved
@Metadorius
Copy link
Member

Metadorius commented Aug 23, 2024

If the features are not very intertwined and it's not hard to do a split would be preferable. I understand that we're over our review capacity at the moment though and because of that maybe it's not necessary at least yet.

@CrimRecya
Copy link
Contributor Author

Get the idea. The placing grids and units base normal are hard to split, but I think it can still be divided into three parts, although it will take me some time. So later I will make modifications to the review that was just submitted, then do a split when I have time.

@CrimRecya
Copy link
Contributor Author

cameo
Add new functions for cameos. And will split this pr in a few days.

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.

6 participants