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?
Do units use these tag for movment or just construction?
Moderator: Moderators
Re: Do units use these tag for movment or just construction?
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).
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).
Re: Do units use these tag for movment or just construction?
what is this "depth" key?
Re: Do units use these tag for movment or just construction?
It is defined in movedef.
Re: Do units use these tag for movment or just construction?
Somehow the other day my find function failed hard; depth is set to minWaterDepth for boats, maxWaterDepth for ground units.smoth wrote:what is this "depth" key?
Re: Do units use these tag for movment or just construction?
interesting. So that means my code needs to check min and max waterdepth then?
Re: Do units use these tag for movment or just construction?
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: }