This commit is contained in:
peterino2 2025-10-10 21:51:04 -07:00
parent d89915ee4e
commit 5c63afb96e
2 changed files with 60 additions and 0 deletions

View File

@ -239,6 +239,31 @@ pub const ExternGameObject = struct {
core.engine_log("map loaded", .{});
}
pub fn fuckNazis(self: *@This()) !void {
const MultiJob = struct {
threadName: []const u8,
pub fn func(ctx: @This(), job: *core.JobContext) void {
_ = job;
core.tracy.SetThreadName(self.threadName);
while (true) {
ctx.tick();
}
}
pub fn tick(ctx: @This()) void {
_ = ctx;
core.tracy.ZoneN(@src(), "MultiJob Tick");
std.time.sleep(0.01);
}
};
for (0..12) |i| {
const name = try std.fmt.allocPrint(self.heap.c_allocator, "MultiJob{d}", .{i});
try core.dispatchJob(MultiJob{ .threadName = name });
}
}
pub fn create(allocator: std.mem.Allocator) !*@This() {
const self = try Slack.create(allocator);
self.* = .{
@ -252,6 +277,8 @@ pub const ExternGameObject = struct {
const args = try core.ParseArgs(ExternGameArgs);
try self.fuckNazis();
if (args.asClient) {
self.launchAsClient = args.clientTarget;
self.clientIndex = args.clientIndex;

View File

@ -0,0 +1,33 @@
pub const Slack = core.SlackStruct(@This(), 1024);
allocator: std.mem.Allocator = undefined,
entity: core.Entity = undefined,
camera: *extras.FpCamera = undefined,
pub var NeonObjectTable: core.EngineObjectVTable = core.EngineObjectVTable.from(@This(), "extern.FpPlayer");
pub fn create(allocator: std.mem.Allocator) !*@This() {
const self = try Slack.create(allocator);
self.* = .{
.allocator = allocator,
.entity = try core.createEntity(),
.camera = try extras.FpCamera.create(allocator),
};
return self;
}
pub fn objectReload(self: *@This()) void {
_ = self;
}
pub fn destroy(self: *@This()) void {
self.camera.destroy();
self.allocator.destroy(Slack.fromPtr(self));
}
const backlog = @import("backlog");
const core = backlog.core;
const std = @import("std");
const extras = @import("gameExtras");