tengri/Content/UE/SystemLibrary.ts

131 lines
3.8 KiB
TypeScript

// UE/SystemLibrary.ts
import type { Actor } from '#root/UE/Actor.ts';
import { BlueprintFunctionLibrary } from '#root/UE/BlueprintFunctionLibrary.ts';
import { EDrawDebugTrace } from '#root/UE/EDrawDebugTrace.ts';
import { ETraceTypeQuery } from '#root/UE/ETraceTypeQuery.ts';
import type { Float } from '#root/UE/Float.ts';
import { HitResult } from '#root/UE/HitResult.ts';
import { LinearColor } from '#root/UE/LinearColor.ts';
import { Name } from '#root/UE/Name.ts';
import type { UEObject } from '#root/UE/UEObject.ts';
import { Vector } from '#root/UE/Vector.ts';
class SystemLibraryClass extends BlueprintFunctionLibrary {
constructor(
outer: null | BlueprintFunctionLibrary = null,
name: string = 'SystemLibrary'
) {
super(outer, name);
}
public IsValid<T extends UEObject>(
object: T | null | undefined
): object is T {
return object !== null && object !== undefined;
}
public GetGameTimeInSeconds(): number {
// Placeholder implementation; replace with actual game time retrieval logic
return Date.now() / 1000;
}
public PrintString(
string: string = 'Hello',
printToScreen: boolean = true,
printToLog: boolean = true,
textColor: LinearColor = new LinearColor(0, 0.66, 1, 1),
duration: Float = 2.0,
key: Name = Name.NONE
): void {
if (printToScreen) {
console.log(
`%c${string}`,
`color: rgba(${textColor.R * 255}, ${textColor.G * 255}, ${
textColor.B * 255
}, ${textColor.A}); font-weight: bold;`
);
// In a real game engine, this would display the string on the screen for the specified duration
}
if (printToLog) {
console.log(string);
// In a real game engine, this would log the string to the console or log file
}
console.log(duration);
console.log(key);
}
public CapsuleTraceByChannel(
Start: Vector = new Vector(0, 0, 0),
End: Vector = new Vector(0, 0, 0),
Radius: Float = 0.0,
HalfHeight: Float = 0.0,
TraceChannel: ETraceTypeQuery = ETraceTypeQuery.Visibility,
TraceComplex: boolean = false,
ActorsToIgnore: Actor[] = [],
DrawDebugType: EDrawDebugTrace = EDrawDebugTrace.None,
IgnoreSelf: boolean = true,
TraceColor: LinearColor = new LinearColor(1, 0, 0, 1),
TraceHitColor: LinearColor = new LinearColor(0, 1, 0, 1),
DrawTime: Float = 5.0
): { OutHit: HitResult; ReturnValue: boolean } {
console.log('CapsuleTraceByChannel called with:', {
Start,
End,
Radius,
HalfHeight,
TraceChannel,
TraceComplex,
ActorsToIgnore,
DrawDebugType,
IgnoreSelf,
TraceColor,
TraceHitColor,
DrawTime,
});
return {
OutHit: new HitResult(),
ReturnValue: false,
};
// Placeholder implementation; replace with actual trace logic
}
public LineTraceByChannel(
Start: Vector = new Vector(0, 0, 0),
End: Vector = new Vector(0, 0, 0),
TraceChannel: ETraceTypeQuery = ETraceTypeQuery.Visibility,
TraceComplex: boolean = false,
ActorsToIgnore: Actor[] = [],
DrawDebugType: EDrawDebugTrace = EDrawDebugTrace.None,
IgnoreSelf: boolean = true,
TraceColor: LinearColor = new LinearColor(1, 0, 0, 1),
TraceHitColor: LinearColor = new LinearColor(0, 1, 0, 1),
DrawTime: Float = 5.0
): { OutHit: HitResult; ReturnValue: boolean } {
console.log('CapsuleTraceByChannel called with:', {
Start,
End,
TraceChannel,
TraceComplex,
ActorsToIgnore,
DrawDebugType,
IgnoreSelf,
TraceColor,
TraceHitColor,
DrawTime,
});
return {
OutHit: new HitResult(),
ReturnValue: false,
};
// Placeholder implementation; replace with actual trace logic
}
}
export const SystemLibrary = new SystemLibraryClass();