Add basic transport load/unload#936
Conversation
stavrosfa
left a comment
There was a problem hiding this comment.
Good stuff, I can imagine this being a slight pain to work out 😅
I have encountered some bugs and such, but i mostly think these can be attributed to the fact that anything can be loaded into anything with enough capacity. Should be ok once this is implemented.
| prototype.attack = prto.Attack; | ||
| prototype.defense = prto.Defense; | ||
| prototype.movement = prto.Movement; | ||
| prototype.capacity = prto.Capacity; |
There was a problem hiding this comment.
We are missing a couple of Unit special actions.
Looking at the editor, each unit (PRTO) than can be loaded into something (not sure if this means an Army as well, but I am pretty sure it means a transport unit), has a "Special Action" called Load
Check the Infantry for example, it has the Load action
In contrast, a Galley that can load, and subsequently unload units, has the Unload action
The Galley doesn't have the Load because, it can't be loaded into something else.
These two actions are located here
OpenCiv3/QueryCiv3/BiqSections/Prto.cs
Line 164 in 8119dd4
So that means, that we can directly check if a unit can be loaded into something that can load units, right now we can load anything, to a unit with enough capacity.
There was a problem hiding this comment.
Lines 1151-1152 in ImportCiv3.ImportBicUnits() solve this, I think. I added them in, but then commented out as I figured I'd get the capacity and some cleanup in first in the base ruleset. I can take another look.
For the base ruleset, I think the unit promotion stuff isn't quite lined up perfectly, as when I save, I seem to get unitPrototype upgrade paths featuring unique units instead of the regular ones.
There was a problem hiding this comment.
Not sure what lines 1151-1152 do, I checked yout PR and the dev branch, I don't see anything relevant to this. Can you link the lines from the current dev branch?
Regarding the unit upgrades, can you share a save and explain which ones don't work as expected? Also, do you mean that they broke during this feature development, or were they already broken?
There was a problem hiding this comment.
I've documented the drift between current base ruleset and what I'm seeing when applying the unitPrototype field from a saved game to the base ruleset here: #937
|
|
||
| [GlobalClass] | ||
| [Tool] | ||
| public partial class TransportInfoBox : Civ3TextureRect { |
There was a problem hiding this comment.
Feel free to ignore this, but my ocd doesn't let me ignore that the box is missalighned compared to the LowerInfoBox. I know it's the same in the original, feel free to leave this as is 😄
A few actual comments on the box:
- We can click throught, although we shouldn't
- The textures in the original are about half the texture size of the InfoBox. Perhaps to accomodate for larger capacities? Should we stick to that?
- In the original, there is a box outline around (only) the transport unit? Again, should we be replicating that?
- We should be able to select a unit inside a transport to activate/wake, etc.. That also probably means, that these are not simple texture, rather texture buttons.
There was a problem hiding this comment.
- Adjusted box position a bit -- sadly the visually heavy next turn blinker makes the simple box looks out of place still
- Removed the click-through, but need to revisit the texture button even capture
- Resized units sprites, but each unit still goes into a 50x50 unit button -- unit sprites don't seem to share a common baseline, or I'm missing something
- Added transport unit highlight box with Line2D
There was a problem hiding this comment.
unit sprites don't seem to share a common baseline, or I'm missing something
I think I know what you probably mean. Since these sprites are practically a single frame from a .flic file, you should know that each .flic animation, has a X and Y offset from the top left corner of the image in order to able to place them all at the same "baseline".
You can see some more details here
Line 136 in c2e56fa
here
OpenCiv3/C7/Animations/AnimationManager.cs
Line 331 in c2e56fa
and here
OpenCiv3/ConvertCiv3Media/ReadFlic.cs
Line 24 in c2e56fa
There was a problem hiding this comment.
Having said that, I had another look at the original, it doesn't seem to use the flic thumbnail, rather the units_32.pcx image that is also used in the city production pop-up/screen.
These are already the correct size and are alligned, the current implementation is missing the civ color tint for the small thumbnails, which I have implemented and sits on my hard drive.
Maybe for now, just use the units_32.pcx instead, even with the wrong colours, and this will be updated at some point along with the others.
There was a problem hiding this comment.
Added transport click buttons for selection.
Scaling unit sprites seems to work fine for the transported, inclined to leave as is.
Add basic support for transport mechanic: loading and unloading units from a vehicle with transport capacity.
move(..)to allow load/unloadmove(..)so transports can move other unitsL/U)Manual
Loading and Unloading
You can have a ship wait until it is loaded to capacity with units by clicking the Load order or pressing [L]. Boarding a
ship uses up all a unit’s movement points for the turn. If you attempt to move a naval unit into a land square that does not contain a port city, any passengers who have not already moved this turn are offered the option to disembark and make landfall. You can also order a ship to unload all its passengers by clicking the Unload order or pressing [L].
Demo