Game Development Community

What happened to 'LiquidType'?

by Nicolai Dutka · in Torque Game Engine Advanced · 06/11/2009 (4:01 pm) · 8 replies

I recall using some 'onEnter' code for liquids and making various things happen based on the LiquidType.

In TGEA 1.8.1, it isn't working... Everything I try returns 0. I looked in my player.cpp and found mLiquidType is in there. I checked the waterBlock.h and see eWaterType mLiquidType, but in waterblock.cpp, there is NO mLiquidType. It would seem this has been removed... Any ideas?

#1
06/11/2009 (4:09 pm)
Sorry, grabbed docs from the wrong engine =/

Let me get the TGEA version.
#2
06/11/2009 (4:15 pm)
Interesting. Looks like it was removed from the addField(), initPersistFields(), and the pack/unpack updates.

In other words, it is not being initialized, exposed, or updated. You can add it back in following the same patterns as the other member variables.
#3
06/11/2009 (4:53 pm)
Tried to add it back in:

waterblock.cpp

Line 46
mLiquidType = eOceanWater;

Line 153
stream->write( (S32)mLiquidType );

Line 197-208
static EnumTable::Enums gLiquidTypeEnums[] =
{
   { WaterBlock::eWater,         "Water"         },
   { WaterBlock::eOceanWater,    "OceanWater"    },
   { WaterBlock::eRiverWater,    "RiverWater"    },
   { WaterBlock::eStagnantWater, "StagnantWater" },
   { WaterBlock::eLava,          "Lava"          },
   { WaterBlock::eHotLava,       "HotLava"       },
   { WaterBlock::eCrustyLava,    "CrustyLava"    },
   { WaterBlock::eQuicksand,     "Quicksand"     }
};
static EnumTable gLiquidTypeTable( 8, gLiquidTypeEnums );

Line 224
stream->read( &mLiquidType );

Line 814
addField("liquidType", TypeEnum, Offset(mLiquidType, WaterBlock), 1, &gLiquidTypeTable );


ERROR:
..\..\..\..\..\engine\source\terrain\waterBlock.cpp(224) : error C2664: 'void Stream::read(String *)' : cannot convert parameter 1 from 'WaterBlock::EWaterType *' to 'String *'


I was trying to copy the code from TGE 1.5.2 if that makes any difference....
#4
06/12/2009 (8:02 am)
Any ideas at all? I am not the best with C++, so I don't understand this yet...
#5
06/16/2009 (12:49 pm)
*Bump*

Need this for our prototype!
#6
06/16/2009 (1:05 pm)
I think this was left out as the water body entity can be edited to mimic these looks and the functionalities can be done with water entity settings and trigger volumes.
#7
06/16/2009 (1:09 pm)
Ya, we have been able to edit the settings and whatnot to get the desired looks, but we'd rather not have to use a trigger AND a waterblock when a waterblock alone could have the functionality we need... Doesn't that seem like a pain to have to place trigger volumes and line them up perfectly with the waterblock? Not to mention that triggers don't have the same 'pivot point' or world center as virtually everything else in the game, so if you try to line them up with a simple command, it doesnt work:

trigger.setTransform(water.getTransform()); // Result = NOT lined up, not even close.....
#8
06/16/2009 (1:29 pm)
k, well it's not so simple but it is not entirely impossible either.

Get the position and scale of the waterblock, create a trigger using that size/scale/position and then move it -z.half the height of the waterblock...or half the trigger's z scale and then move it -z.1/4 the waterblock height after setting the pos to that of the waterblock origin/transform.

I know the ideal solution is to have the selectable entity type..I bet most people would love to get that back.