Merge pull request #1443 from Azaezel/alpha41/controlModel

add a controlmap entry
This commit is contained in:
Brian Roberts 2025-04-28 10:50:02 -05:00 committed by GitHub
commit 2ac15f74f2
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
8 changed files with 32 additions and 3 deletions

View file

@ -460,6 +460,7 @@ PlayerData::PlayerData()
jumpTowardsNormal = true;
physicsPlayerType = StringTable->EmptyString();
mControlMap = StringTable->EmptyString();
dMemset( actionList, 0, sizeof(actionList) );
}
@ -739,7 +740,9 @@ void PlayerData::initPersistFields()
endGroup( "Camera" );
addGroup( "Movement" );
addField("controlMap", TypeString, Offset(mControlMap, PlayerData),
"@brief movemap used by these types of objects.\n\n");
addFieldV( "maxStepHeight", TypeRangedF32, Offset(maxStepHeight, PlayerData), &CommonValidators::PositiveFloat,
"@brief Maximum height the player can step up.\n\n"
"The player will automatically step onto changes in ground height less "

View file

@ -346,7 +346,7 @@ struct PlayerData: public ShapeBaseData {
// Jump off surfaces at their normal rather than straight up
bool jumpTowardsNormal;
StringTableEntry mControlMap;
// For use if/when mPhysicsPlayer is created
StringTableEntry physicsPlayerType;

View file

@ -127,6 +127,7 @@ TurretShapeData::TurretShapeData()
recoilSequence[i] = -1;
pitchSequence = -1;
headingSequence = -1;
mControlMap = StringTable->EmptyString();
}
void TurretShapeData::initPersistFields()
@ -134,6 +135,8 @@ void TurretShapeData::initPersistFields()
docsURL;
Parent::initPersistFields();
addGroup("Steering");
addField("controlMap", TypeString, Offset(mControlMap, TurretShapeData),
"@brief movemap used by these types of objects.\n\n");
addField("zRotOnly", TypeBool, Offset(zRotOnly, TurretShapeData),
"@brief Should the turret allow only z rotations.\n\n"
"True indicates that the turret may only be rotated on its z axis, just like the Item class. "

View file

@ -80,6 +80,7 @@ public:
bool startLoaded; ///< Should the turret's mounted weapon(s) start in a loaded state?
bool zRotOnly; ///< Should the turret allow only z rotations (like an item)?
StringTableEntry mControlMap;
public:
TurretShapeData();

View file

@ -141,6 +141,7 @@ VehicleData::VehicleData()
dMemset( damageEmitterOffset, 0, sizeof( damageEmitterOffset ) );
dMemset( damageEmitterIDList, 0, sizeof( damageEmitterIDList ) );
dMemset( damageLevelTolerance, 0, sizeof( damageLevelTolerance ) );
mControlMap = StringTable->EmptyString();
numDmgEmitterAreas = 0;
@ -321,6 +322,8 @@ void VehicleData::initPersistFields()
endGroup("Collision");
addGroup("Steering");
addField("controlMap", TypeString, Offset(mControlMap, VehicleData),
"@brief movemap used by these types of objects.\n\n");
addFieldV( "jetForce", TypeRangedF32, Offset(jetForce, VehicleData), &CommonValidators::PositiveFloat,
"@brief Additional force applied to the vehicle when it is jetting.\n\n"
"For WheeledVehicles, the force is applied in the forward direction. For "
@ -726,6 +729,9 @@ void Vehicle::updateMove(const Move* move)
if (mDamageState == Enabled) {
setImageTriggerState(0,move->trigger[0]);
setImageTriggerState(1,move->trigger[1]);
//legacy code has trigger 2 and 3 reserved
setImageTriggerState(2, move->trigger[4]);
setImageTriggerState(3, move->trigger[5]);
}
// Throttle

View file

@ -69,6 +69,7 @@ struct VehicleData : public RigidShapeData
F32 damageLevelTolerance[ VC_NUM_DAMAGE_LEVELS ];
F32 numDmgEmitterAreas;
StringTableEntry mControlMap;
bool enablePhysicsRep;
//

View file

@ -162,3 +162,16 @@ function disconnectedCleanup()
moduleExec("onDestroyClientConnection", "Game");
}
function clientCmdsetMoveMap(%movemap)
{
if (!isObject(%movemap)) return;
if(isObject(ServerConnection) && isObject(ServerConnection.curMoveMap))
ServerConnection.curMoveMap.pop();
// clear movement
$mvForwardAction = 0;
$mvBackwardAction = 0;
%movemap.push();
ServerConnection.curMoveMap = %movemap;
}

View file

@ -275,7 +275,9 @@ function GameConnection::onPostSpawn( %this )
if (%this.numModsNeedingLoaded)
callOnObjectList("onPostSpawn", %modulesIdList, %this);
else
%this.listener.onPostSpawnComplete(%this);
%this.listener.onPostSpawnComplete(%this);
if (isObject(%this.player.getDatablock().controlMap))
commandToClient(%this, 'setMoveMap', %this.player.getDatablock().controlMap);
}
function GameConnectionListener::onPostSpawnComplete(%this, %client)