Major refactoring - internal server state machine implemented

This commit is contained in:
Vladislav Khorev committed 2026-10-29 00:09:16 +06:00
1 parent 71c654e5b6
commit 66e93d46f4
48 files changed
+3948 -3696

No files matched your search

+12 -12
View File
@@ -1,9 +1,6 @@
#pragma once
#include <string>
#include <memory>
#include <optional>
#include <functional>
#include <cstdint>
#include <Eigen/Core>
#include "render/Renderer.h"
#include "InteractiveObjectState.h"
@@ -21,25 +18,28 @@ namespace FRG {
};
struct InteractiveObject {
explicit InteractiveObject(InteractiveObjectState& boundState) : state(boundState) {}
std::string id;
LoadedGameObject loadedObject; // rendering assets
InteractiveObjectState state; // all mutable + creation state
// Factory: creates a fully-loaded InteractiveObject from a state descriptor.
// Loads textures and mesh from state.objectInfo, computes mesh centering,
// and sets state.position = jsonPosition + meshCenter.
static InteractiveObject createFromState(InteractiveObjectState st,
static InteractiveObject createFromState(InteractiveObjectState& state,
Renderer& renderer,
const std::string& zipPath = "");
// callbackName, if given, is the global Lua function name backing onComplete —
// stored in the AnimTask so it survives save/load (see ScriptEngine::rehydrateNamedCallback).
void moveTo(const Eigen::Vector3f& target, float durationSec, std::function<void()> onComplete = {}, std::string callbackName = "");
void rotateTo(float targetRotY, float durationSec, std::function<void()> onComplete = {}, std::string callbackName = "");
void scaleTo(float targetScale, float durationSec, std::function<void()> onComplete = {}, std::string callbackName = "");
void fadeTo(float targetAlpha, float durationSec, std::function<void()> onComplete = {}, std::string callbackName = "");
void update(int64_t deltaMs);
void draw(Renderer& renderer) const;
void drawDarklands(Renderer& renderer) const;
const std::string& entityId() const { return id; }
private:
friend class GameObjectLoader;
friend class Location;
friend class LocationEditor;
friend class ScriptEngine;
friend class InternalGameServer;
InteractiveObjectState& state; // non-owning binding to LocationGameState
};
} // namespace FRG