Do units use these tag for movment or just construction?

Do units use these tag for movment or just construction?

Discuss game development here, from a distinct game project to an accessible third-party mutator, down to the interaction and design of individual units if you like.

Moderator: Moderators

Post Reply
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Do units use these tag for movment or just construction?

Post by smoth »

minwaterdepth
maxwaterdepth
maxslope

The same tags exist both in movdefs and unit defs. Do they actually effect the unit's movement when in the unit def or are they JUST used for construction?
slogic
AI Developer
Posts: 626
Joined: 17 Mar 2008, 19:03

Re: Do units use these tag for movment or just construction?

Post by slogic »

maxWaterDepth & minWaterDepth of unitdef are used in GetAllowedTerrainHeight() only. For static units they are not tweaked. For mobile units (units with movedef):
1) with ship movement minWaterDepth is adjusted based on "depth" key
2) without ship movement maxWaterDepth is adjusted based on "depth" key

Note, that they are adjusted within GetAllowedTerrainHeight(), self properties left the same.

Of cause as they are exposed to lua layer i can't predict their usage from mod/game developer point of view.

EDIT. GetAllowedTerrainHeight() is used (directly or indirectly) in CUnitHandler::TestBuildSquare() and CTransportUnit::GetLoadUnloadHeight(), and also in CTransportUnit::KillUnit() to prevent some lua hacks (according to sourcecode comments).
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Do units use these tag for movment or just construction?

Post by smoth »

what is this "depth" key?
slogic
AI Developer
Posts: 626
Joined: 17 Mar 2008, 19:03

Re: Do units use these tag for movment or just construction?

Post by slogic »

It is defined in movedef.
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Do units use these tag for movment or just construction?

Post by FLOZi »

smoth wrote:what is this "depth" key?
Somehow the other day my find function failed hard; depth is set to minWaterDepth for boats, maxWaterDepth for ground units.
User avatar
smoth
Posts: 22309
Joined: 13 Jan 2005, 00:46

Re: Do units use these tag for movment or just construction?

Post by smoth »

interesting. So that means my code needs to check min and max waterdepth then?
User avatar
FLOZi
MC: Legacy & Spring 1944 Developer
Posts: 6242
Joined: 29 Apr 2005, 01:14

Re: Do units use these tag for movment or just construction?

Post by FLOZi »

Code: Select all

00967: float UnitDef::GetAllowedTerrainHeight(float height) const {
00968: float maxwd = maxWaterDepth;
00969: float minwd = minWaterDepth;
00970:
00971: if (movedata) {
00972: if (movedata->moveType == MoveData::Ship_Move)
00973: minwd = movedata->depth;
00974: else
00975: maxwd = movedata->depth;
00976: }
If that is indeed the only function where they are used, then it is quite clear that for any unit which has an assigned movedef, they are effectively ignored.
Post Reply

Return to “Game Development”