Skip to content

Commit

Permalink
Added DumpFlightTubes command
Browse files Browse the repository at this point in the history
  • Loading branch information
DRKV333 committed Jan 8, 2024
1 parent b5cce35 commit adba867
Show file tree
Hide file tree
Showing 5 changed files with 134 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,4 @@
!README.md
!HappyBug/**
!Engine/Classes/RUSeqEvent_CinematicActivated.uc
!Otherland/**
82 changes: 82 additions & 0 deletions HappyBug/Classes/HappyBugPlayerController.uc
Original file line number Diff line number Diff line change
Expand Up @@ -96,4 +96,86 @@ exec function HBSpeed(float NewSpeed = -1)
}

ClientMessage("Set camera speed to"@SpectatorCameraSpeed);
}

exec function DumpFlightTubes()
{
local JsonObject Json;
local JsonObject TubeJson;
local JsonObject ControlPointArrayJson;
local JsonObject ControlPointJson;
local JsonObject PathPortionArrayJson;
local JsonObject PathPortionJson;
local OLFlightTubeActor ATube;
local OLBaseSplineActor.CurvePointStruct AControlPoint;
local OLBaseSplineActor.PathPortionStruct APathPortion;

Json = new class'JsonObject';

foreach AllActors(class'OLFlightTubeActor', ATube)
{
TubeJson = new class'JsonObject';
Json.ObjectArray.AddItem(TubeJson);

TubeJson.SetFloatValue("RingDensity", ATube.RingDensity);
TubeJson.SetFloatValue("SurfingSpeed", ATube.SurfingSpeed);
TubeJson.SetFloatValue("SplineTransitAcceleration", ATube.SplineTransitAcceleration);

TubeJson.SetObject("UniqueGUID", Guid2Json(ATube.UniqueGUID));
TubeJson.SetObject("TravelTargetGUID", Guid2Json(ATube.TravelTargetGUID));
TubeJson.SetObject("Location", Vec2Json(ATube.Location));

ControlPointArrayJson = new class'JsonObject';
TubeJson.SetObject("ControlPoints", ControlPointArrayJson);

foreach ATube.ControlPoints(AControlPoint)
{
ControlPointJson = new class'JsonObject';
ControlPointArrayJson.ObjectArray.AddItem(ControlPointJson);

ControlPointJson.SetObject("Point", Vec2Json(AControlPoint.Point));
ControlPointJson.SetObject("Tangent", Vec2Json(AControlPoint.Tangent));
}

PathPortionArrayJson = new class'JsonObject';
TubeJson.SetObject("PathPortions", PathPortionArrayJson);

foreach ATube.PathPortions(APathPortion)
{
PathPortionJson = new class'JsonObject';
PathPortionArrayJson.ObjectArray.AddItem(PathPortionJson);

PathPortionJson.SetFloatValue("PathPortionStart", APathPortion.PathPortionStart);
PathPortionJson.SetFloatValue("PathPortionEnd", APathPortion.PathPortionEnd);
PathPortionJson.SetFloatValue("Value", APathPortion.Value);

PathPortionJson.SetIntValue("PathPortionType", int(APathPortion.PathPortionType));
}
}

`Log(class'JsonObject'.static.EncodeJson(Json));
ClientMessage("Check the log!");
}

function JsonObject Vec2Json(Vector vec)
{
local JsonObject Json;

Json = new class'JsonObject';
Json.SetFloatValue("X", vec.X);
Json.SetFloatValue("Y", vec.Y);
Json.SetFloatValue("Z", vec.Z);
return Json;
}

function JsonObject Guid2Json(Guid g)
{
local JsonObject Json;

Json = new class'JsonObject';
Json.SetIntValue("A", g.A);
Json.SetIntValue("B", g.B);
Json.SetIntValue("C", g.C);
Json.SetIntValue("D", g.D);
return Json;
}
47 changes: 47 additions & 0 deletions Otherland/Classes/OLBaseSplineActor.uc
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
class OLBaseSplineActor extends Actor;

enum EPathPortionType
{
PPT_Acceleration,
PPT_Braking,
PPT_MAX
};

struct native CurvePointStruct
{
var() Vector Point;
var() Vector Tangent;

structdefaultproperties
{
Point=(X=0,Y=0,Z=0)
Tangent=(X=0,Y=0,Z=0)
}
};

struct native PathPortionStruct
{
var() float PathPortionStart;
var() float PathPortionEnd;
var() MaterialInterface PathPortionMaterial;
var transient MaterialInstanceConstant PathPortionMaterialInst;
var() OLBaseSplineActor.EPathPortionType PathPortionType;
var() float Value;

structdefaultproperties
{
PathPortionStart=0
PathPortionEnd=0
PathPortionMaterial=none
PathPortionMaterialInst=none
PathPortionType=PPT_Acceleration
Value=100
}
};

var const Guid UniqueGUID;
var const Guid TravelTargetGUID;
var(Spline) array<CurvePointStruct> ControlPoints;
var(Spline) array<PathPortionStruct> PathPortions;
var(Spline) float SurfingSpeed;
var(Spline) float SplineTransitAcceleration;
3 changes: 3 additions & 0 deletions Otherland/Classes/OLFlightTubeActor.uc
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
class OLFlightTubeActor extends OLBaseSplineActor;

var(FlightTube) float RingDensity;
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ git branch --set-upstream-to=origin/master master
Open `UDKGame/Config/DefaultEngine.ini` and at the end of the `[UnrealEd.EditorEngine]` section, add these lines:

```
+EditPackages=Otherland
+EditPackages=HappyBug
```

Expand Down

0 comments on commit adba867

Please sign in to comment.