MCPcopy Create free account
hub / github.com/BohemiaInteractive/CWR / ObjSetVelocity

Function ObjSetVelocity

engine/Poseidon/Game/Commands/GameStateExtGrp.cpp:1886–1920  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1884}
1885
1886GameValue ObjSetVelocity(const GameState* state, GameValuePar oper1, GameValuePar oper2)
1887{
1888 Object* obj = GetObject(oper1);
1889 Entity* veh = dyn_cast<Entity>(obj);
1890 if (!veh)
1891 {
1892 return NOTHING;
1893 }
1894
1895 const GameArrayType& array = oper2;
1896 if (array.Size() != 3)
1897 {
1898 state->SetError(EvalDim, array.Size(), 3);
1899 return NOTHING;
1900 }
1901 if (array[0].GetType() != GameScalar)
1902 {
1903 state->TypeError(GameScalar, array[0].GetType());
1904 return NOTHING;
1905 }
1906 if (array[1].GetType() != GameScalar)
1907 {
1908 state->TypeError(GameScalar, array[1].GetType());
1909 return NOTHING;
1910 }
1911 if (array[2].GetType() != GameScalar)
1912 {
1913 state->TypeError(GameScalar, array[2].GetType());
1914 return NOTHING;
1915 }
1916
1917 Vector3 speed(array[0], array[2], array[1]);
1918 veh->SetSpeed(speed);
1919 return NOTHING;
1920}
1921
1922GameValue ObjSetFlyingHeight(const GameState* state, GameValuePar oper1, GameValuePar oper2)
1923{

Callers

nothing calls this directly

Calls 6

TypeErrorMethod · 0.80
GetObjectFunction · 0.70
SizeMethod · 0.45
SetErrorMethod · 0.45
GetTypeMethod · 0.45
SetSpeedMethod · 0.45

Tested by

no test coverage detected