Vinifera-Developers / Vinifera

Vinifera is a C&C: Tiberian Sun engine extension implementing new logics and fixing bugs.
GNU General Public License v3.0
43 stars 10 forks source link

[Vanilla Bug] Fully enforced Dock= #129

Open CCTiberius opened 3 years ago

CCTiberius commented 3 years ago

Description:

While you can already specify a dock for an aircraft, the problem is that players can still manually order it to land on other types of helipad/airstrip etc. and it will be able to land and reload there.

Expected Behaviour:

An aircraft with Dock= should only be capable of docking there, and should refuse an order to land on other docks.

Actual Behaviour:

If you give an aircraft Dock=X it will only automatically return to dock X, but, if the player manually gives it a move order onto dock Y, it will land on dock Y and even get reloaded.

Rampastring commented 3 years ago

Thinking about it, this is probably an easy fix.

When you move the mouse cursor over a building, the aircraft send a radio message RADIO_CAN_LOAD to the building. In Red Alert, the building then checks if the building can accept the aircraft in question and replies accordingly: https://github.com/electronicarts/CnC_Remastered_Collection/blob/master/REDALERT/BUILDING.CPP#L173

Instead of having hardcoded building types for the check, buildings in Tiberian Sun probably just check for the Helipad=yes key on the building when deciding whether to allow the aircraft to land. In addition to that, the building should check whether its type is listed in the aircraft's Dock=. Note that this is just an educated guess though.

CCHyper commented 3 years ago

I think introducing a new key for AircraftTypes (and UnitTypes if we think in terms of the Harvester) such as DockOnlyWith=<BuildingType> would be ideal here.

Rampastring commented 3 years ago

@CCHyper Doesn't that kinda defeat the purpose of the Dock= key though? Currently it otherwise works as intended, but the Dock= buildings are only used for automatic docking and the player is able to override that. I can't think of a case where it'd be beneficial for the player to be able to manually dock an aircraft into a building that is not listed in the aircraft's Dock= for automatic landing.