#ifndef STAR_LUA_GAME_CONVERTERS_HPP #define STAR_LUA_GAME_CONVERTERS_HPP #include "StarLuaConverters.hpp" #include "StarCollisionBlock.hpp" #include "StarPlatformerAStar.hpp" #include "StarActorMovementController.hpp" #include "StarDamage.hpp" #include "StarCollectionDatabase.hpp" #include "StarBehaviorState.hpp" #include "StarSystemWorld.hpp" namespace Star { template <> struct LuaConverter { static LuaValue from(LuaEngine& engine, CollisionKind k); static Maybe to(LuaEngine& engine, LuaValue const& v); }; template <> struct LuaConverter { static LuaValue from(LuaEngine& engine, CollisionSet const& s); static Maybe to(LuaEngine& engine, LuaValue const& v); }; template struct LuaConverter> : LuaUserDataConverter> {}; template struct LuaUserDataMethods> { static LuaMethods> make(); }; template <> struct LuaConverter { static LuaValue from(LuaEngine& engine, PlatformerAStar::Path const& path); }; template <> struct LuaConverter : LuaUserDataConverter {}; template <> struct LuaUserDataMethods { static LuaMethods make(); }; template <> struct LuaConverter { static Maybe to(LuaEngine& engine, LuaValue const& v); }; template <> struct LuaConverter { static LuaValue from(LuaEngine& engine, ActorJumpProfile const& v); static Maybe to(LuaEngine& engine, LuaValue const& v); }; template <> struct LuaConverter { static LuaValue from(LuaEngine& engine, ActorMovementParameters const& v); static Maybe to(LuaEngine& engine, LuaValue const& v); }; template <> struct LuaConverter { static LuaValue from(LuaEngine& engine, ActorMovementModifiers const& v); static Maybe to(LuaEngine& engine, LuaValue const& v); }; template <> struct LuaConverter { static LuaValue from(LuaEngine& engine, StatModifier const& v); static Maybe to(LuaEngine& engine, LuaValue v); }; template <> struct LuaConverter { static LuaValue from(LuaEngine& engine, EphemeralStatusEffect const& v); static Maybe to(LuaEngine& engine, LuaValue const& v); }; template <> struct LuaConverter { static LuaValue from(LuaEngine& engine, DamageRequest const& v); static Maybe to(LuaEngine& engine, LuaValue const& v); }; template <> struct LuaConverter { static LuaValue from(LuaEngine& engine, DamageNotification const& v); static Maybe to(LuaEngine& engine, LuaValue const& v); }; template <> struct LuaConverter { static LuaValue from(LuaEngine& engine, LiquidLevel const& v); static Maybe to(LuaEngine& engine, LuaValue const& v); }; template LuaMethods> LuaUserDataMethods>::make() { LuaMethods> methods; methods.template registerMethodWithSignature&>("finished", mem_fn(&RpcPromise::finished)); methods.template registerMethodWithSignature&>("succeeded", mem_fn(&RpcPromise::succeeded)); methods.template registerMethodWithSignature, RpcPromise&>("result", mem_fn(&RpcPromise::result)); methods.template registerMethodWithSignature, RpcPromise&>("error", mem_fn(&RpcPromise::error)); return methods; } template <> struct LuaConverter { static LuaValue from(LuaEngine& engine, Collection const& c); static Maybe to(LuaEngine& engine, LuaValue const& v); }; template <> struct LuaConverter { static LuaValue from(LuaEngine& engine, Collectable const& c); static Maybe to(LuaEngine& engine, LuaValue const& v); }; // BehaviorState contains Lua references, putting it in a UserData violates // the "don't put lua references in userdata, just don't" rule. We get around it by keeping // a weak pointer to the behavior state, forcing it to be destroyed elsewhere. template <> struct LuaConverter : LuaUserDataConverter {}; template <> struct LuaUserDataMethods { static LuaMethods make(); }; template <> struct LuaConverter { static LuaValue from(LuaEngine& engine, NodeStatus const& status); static NodeStatus to(LuaEngine& engine, LuaValue const& v); }; // Weak pointer for the same reasons as BehaviorState. template <> struct LuaConverter : LuaUserDataConverter {}; template <> struct LuaUserDataMethods { static LuaMethods make(); }; } #endif