mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
refactor Entities
This commit is contained in:
parent
36a522bee0
commit
3eae377024
23 changed files with 485 additions and 348 deletions
49
src/objects/ScriptComponents.hpp
Normal file
49
src/objects/ScriptComponents.hpp
Normal file
|
|
@ -0,0 +1,49 @@
|
|||
#pragma once
|
||||
|
||||
#include "typedefs.hpp"
|
||||
#include "data/dv.hpp"
|
||||
|
||||
#include <string>
|
||||
|
||||
struct EntityFuncsSet {
|
||||
bool init;
|
||||
bool on_despawn;
|
||||
bool on_grounded;
|
||||
bool on_fall;
|
||||
bool on_sensor_enter;
|
||||
bool on_sensor_exit;
|
||||
bool on_save;
|
||||
bool on_aim_on;
|
||||
bool on_aim_off;
|
||||
bool on_attacked;
|
||||
bool on_used;
|
||||
};
|
||||
|
||||
struct UserComponent {
|
||||
std::string name;
|
||||
EntityFuncsSet funcsset;
|
||||
scriptenv env;
|
||||
dv::value params;
|
||||
|
||||
UserComponent(
|
||||
const std::string& name,
|
||||
EntityFuncsSet funcsset,
|
||||
scriptenv env,
|
||||
dv::value params
|
||||
)
|
||||
: name(name),
|
||||
funcsset(funcsset),
|
||||
env(std::move(env)),
|
||||
params(std::move(params)) {
|
||||
}
|
||||
};
|
||||
|
||||
struct ScriptComponents {
|
||||
std::vector<std::unique_ptr<UserComponent>> components;
|
||||
|
||||
ScriptComponents() = default;
|
||||
|
||||
ScriptComponents(ScriptComponents&& other)
|
||||
: components(std::move(other.components)) {
|
||||
}
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue