#pragma once #include #include #include #include "typedefs.hpp" #include "data/dv.hpp" #include "maths/aabb.hpp" #include "physics/Hitbox.hpp" #include "animation/rigging.hpp" struct ComponentInstance { std::string component; dv::value params; }; struct EntityDef { /// @brief Entity string id (with prefix included) std::string const name; /// @brief Component instances std::vector components; /// @brief Physic body type BodyType bodyType = BodyType::DYNAMIC; /// @brief Hitbox size glm::vec3 hitbox {0.25f}; /// @brief 'aabb' sensors std::vector> boxSensors {}; /// @brief 'radius' sensors std::vector> radialSensors {}; /// @brief Skeleton ID std::string skeletonName = name; /// @brief Solid entity material material std::string material; /// @brief Model lighting mode ModelLightingMode lightingMode = ModelLightingMode::SOLID; /// @brief Can the entity be interacted with cursor (on_attack, on_use) bool selectable = true; /// @brief Does entity prevent blocks setup bool blocking = true; /// @brief Is the entity solid (blocks other entities) bool solid = false; /// @brief Mass for physics calculations float mass = 1.0f; /// @brief Elasticity for physics calculations float elasticity = 0.0f; /// @brief Max obstacle height that does not require jumping float stepHeight = 0.5f; /// @brief save-** flags struct { bool enabled = true; struct { bool textures = false; bool pose = false; } skeleton; struct { bool velocity = true; bool settings = true; } body; } save {}; struct { entityid_t id; rigging::SkeletonConfig* skeleton; } rt {}; EntityDef(const std::string& name) : name(name) {} EntityDef(const EntityDef&) = delete; void cloneTo(EntityDef& dst); };