Phobos icon indicating copy to clipboard operation
Phobos copied to clipboard

Expand the Building Actions

Open CrimRecya opened this issue 1 year ago • 9 comments

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

CrimRecya avatar Aug 04 '24 16:08 CrimRecya

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.

github-actions[bot] avatar Aug 04 '24 16:08 github-actions[bot]

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

CrimRecya avatar Aug 05 '24 10:08 CrimRecya

this should be merged asap

8abs avatar Aug 13 '24 22:08 8abs

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

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

4SGX avatar Aug 14 '24 12:08 4SGX

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.

Metadorius avatar Aug 23 '24 08:08 Metadorius

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 avatar Aug 23 '24 08:08 CrimRecya

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

CrimRecya avatar Sep 08 '24 11:09 CrimRecya

I have been really busy lately, so I will wait until I have some free time to do the splitting. Even if it is split, I won't have the energy to make any modifications, so wait for now. Here may be no need for review at the moment, this can be focused on other good places. If you are interested in this, maybe you can give it a try, at least so far the feedback I've received says it's good.

CrimRecya avatar Sep 26 '24 17:09 CrimRecya

I have been really busy lately, so I will wait until I have some free time to do the splitting. Even if it is split, I won't have the energy to make any modifications, so wait for now. Here may be no need for review at the moment, this can be focused on other good places. If you are interested in this, maybe you can give it a try, at least so far the feedback I've received says it's good.

Take your time! It's not a big priority to split the features at all, the pull request isn't as big. More of a "nice to have" than a requirement in this case.

Metadorius avatar Sep 26 '24 17:09 Metadorius

I‘m going to repull the split request in two weeks, so close this now.

CrimRecya avatar Dec 16 '24 07:12 CrimRecya