Skip to content

Commit

Permalink
Implement braking in updateEngineForces(). Add braking fields to Engi…
Browse files Browse the repository at this point in the history
…neEditGui. Clean up some console spam.
  • Loading branch information
yourarcade committed Oct 16, 2016
1 parent a35a7d3 commit 43edf75
Show file tree
Hide file tree
Showing 8 changed files with 7,071 additions and 42 deletions.
106 changes: 104 additions & 2 deletions resource/game/art/gui/vehicle/vehicleEditGui.gui
Expand Up @@ -3765,7 +3765,7 @@
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "200 155";
position = "200 235";
extent = "61 18";
minExtent = "8 2";
horizSizing = "right";
Expand All @@ -3792,7 +3792,7 @@
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "264 154";
position = "264 234";
extent = "28 18";
minExtent = "8 2";
horizSizing = "right";
Expand Down Expand Up @@ -4014,6 +4014,108 @@
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiTextCtrl() {
text = "Brake Rate";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "193 152";
extent = "65 18";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiTextProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiTextEditCtrl(C_BrakeRate) {
historySize = "0";
tabComplete = "0";
sinkAllKeyEvents = "0";
password = "0";
passwordMask = "*";
text = "4500";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "260 153";
extent = "41 18";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiTextEditProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiTextCtrl() {
text = "Brake Increse";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "193 174";
extent = "65 18";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiTextProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
new GuiTextEditCtrl(C_BrakeIncrease) {
historySize = "0";
tabComplete = "0";
sinkAllKeyEvents = "0";
password = "0";
passwordMask = "*";
text = "4500";
maxLength = "1024";
margin = "0 0 0 0";
padding = "0 0 0 0";
anchorTop = "1";
anchorBottom = "0";
anchorLeft = "1";
anchorRight = "0";
position = "260 175";
extent = "41 18";
minExtent = "8 2";
horizSizing = "right";
vertSizing = "bottom";
profile = "GuiTextEditProfile";
visible = "1";
active = "1";
tooltipProfile = "GuiToolTipProfile";
hovertime = "1000";
isContainer = "1";
canSave = "1";
canSaveDynamicFields = "0";
};
};
new GuiButtonCtrl(VEdit_Save) {
text = "Save to File";
Expand Down
7 changes: 7 additions & 0 deletions resource/game/scripts/client/vehicle.bind.cs
Expand Up @@ -14,6 +14,11 @@
$pref::vehicle::brakeTrigger = 4;


if (isJoystickDetected()){
//exec("./joystick.cs");
enableJoystick();
}

if ( isObject( vehicleDriverMap ) )
vehicleDriverMap.delete();
new ActionMap(vehicleDriverMap);
Expand Down Expand Up @@ -143,13 +148,15 @@ function brake(%val)
vehicleMap.bind(joystick0, "button1", accelerate);
vehicleMap.bind(joystick0, "button0", decelerate);
vehicleMap.bind(joystick0, "button2", brake);
vehicleMap.bind(joystick0, "button2", headLights);
vehicleMap.bindCmd(joystick0, "button7", "commandToServer(\'DismountVehicle\');", "");
//vehicleDriverMap.bind(joystick0, "button4", "commandToServer(\'dnShift\');");
//vehicleDriverMap.bind(joystick0, "button5", "commandToServer(\'upShift\');");
vehicleMap.bindCmd(joystick0, "button4", "commandToServer('DnShift');", "");
vehicleMap.bindCmd(joystick0, "button5", "commandToServer('UpShift');", "");
vehicleMap.bindCmd(joystick0, "button6", "commandToServer('carHop');", "");


vehicleMap.bind(keyboard, tab, toggleFirstPerson );

/******************************************************
Expand Down
9 changes: 8 additions & 1 deletion resource/game/scripts/gui/vehicleEditGui.cs
Expand Up @@ -177,7 +177,8 @@ function loadEngineGui(%vehicle, %engine, %tire, %spring)
C_BodyRestitution.setText(%vehicle.bodyRestitution);
C_MassBox.setText(%vehicle.massBox);


C_BrakeRate.setText(%vehicle.brakeRate);
C_BrakeIncrease.setText(%vehicle.brakeIncrease);

C_SteeringReturn.setText(%vehicle.steeringReturn);
C_SteeringReturnSpeedScale.setText(%vehicle.steeringReturnSpeedScale);
Expand Down Expand Up @@ -241,6 +242,9 @@ function saveEngineGuiData(%vehicle, %engine, %tire, %spring)

%vehicle.DustVolume = C_DustVolume.getText();
%vehicle.brakeTorque = C_BrakeTorque.getText();
%vehicle.brakeRate = C_BrakeRate.getText();
%vehicle.brakeIncrease = C_BrakeIncrease.getText();

%vehicle.maxSteeringAngle = C_MaxSteer.getText();
%vehicle.mass = C_Mass.getText();
%vehicle.massCenter = C_MassCenter.getText();
Expand Down Expand Up @@ -326,6 +330,9 @@ function saveEngineGuiData(%vehicle, %engine, %tire, %spring)
//C_SteerBoostSpeed.setText("");
//C_SteerBoostAngle.setText("");
C_BrakeTorque.setText("");
C_BrakeRate.setText("");
C_BrakeIncrease.setText("");

C_MaxSteer.setText("");
C_Mass.setText("");
C_MassCenter.setText("");
Expand Down
2 changes: 1 addition & 1 deletion resource/game/scripts/server/jeep.cs
Expand Up @@ -26,7 +26,7 @@

// ** Add vehicle-specific engine here
%obj.setEngine( JeepEngine );
%obj.fuelFlow = .2;
%obj.fuelFlow = .3;
%obj.hop = 3000;

%obj.setWheelTire(0,JeepCarTire);
Expand Down
12 changes: 6 additions & 6 deletions resource/game/scripts/server/vehicleWheeled.cs
Expand Up @@ -71,7 +71,7 @@
function WheeledVehicleData::onCollision(%this, %obj, %col, %vec, %speed)
{
// Collision with other objects, including items
warn("Collision:"@%obj@" was hit by "@%col@" @ "@%speed@" from "@%vec);
//warn("Collision:"@%obj@" was hit by "@%col@" @ "@%speed@" from "@%vec);
}

// We have hit something
Expand All @@ -84,8 +84,8 @@


function WheeledVehicleEngine::onShift(%this, %obj, %gear, %rpm){
echo("(engine)Shifted to:" @ %gear SPC "RPM:" @ %rpm);
echo("%obj:" SPC %obj SPC %obj.cli);
//echo("(engine)Shifted to:" @ %gear SPC "RPM:" @ %rpm);
//echo("%obj:" SPC %obj SPC %obj.cli);
commandToClient(%obj.getControllingClient(), 'updateGearDisplay', %gear); // Tell the client to update their screen score.
}

Expand Down Expand Up @@ -189,15 +189,15 @@ function serverCmdUpShift(%client)
echo(">"@%p);
if (%p.isMounted == true){
%o = %p.mVehicle;
echo("o:" @ %o SPC "Gear:" @ %o.getGear() SPC "RPM:" @ %o.rpm SPC "Speed:" @ %o.getSpeed());
//echo("o:" @ %o SPC "Gear:" @ %o.getGear() SPC "RPM:" @ %o.rpm SPC "Speed:" @ %o.getSpeed());
}
error("UPSHIFT Command");
//error("UPSHIFT Command");
upshiftVehicle(%client.player);

}
function serverCmdDnShift(%client)
{
error("Downshift Command");
//error("Downshift Command");
downshiftVehicle(%client.player);
}

Expand Down

0 comments on commit 43edf75

Please sign in to comment.