mirror of
https://github.com/TombEngine/TombEngine.git
synced 2025-05-09 12:08:17 +03:00
Add static mesh enable/disable and collision mode script functions
This commit is contained in:
parent
f55fcdca70
commit
d988abdc15
3 changed files with 37 additions and 0 deletions
|
@ -41,6 +41,8 @@ static constexpr char ScriptReserved_GetRotationY[] = "GetRotationY";
|
|||
static constexpr char ScriptReserved_SetRotationY[] = "SetRotationY";
|
||||
static constexpr char ScriptReserved_GetScale[] = "GetScale";
|
||||
static constexpr char ScriptReserved_SetScale[] = "SetScale";
|
||||
static constexpr char ScriptReserved_GetSolid[] = "GetSolid";
|
||||
static constexpr char ScriptReserved_SetSolid[] = "SetSolid";
|
||||
static constexpr char ScriptReserved_GetName[] = "GetName";
|
||||
static constexpr char ScriptReserved_SetName[] = "SetName";
|
||||
static constexpr char ScriptReserved_GetSlot[] = "GetSlot";
|
||||
|
|
|
@ -37,6 +37,20 @@ void Static::Register(sol::table & parent)
|
|||
// @function Static:Disable
|
||||
ScriptReserved_Disable, &Static::Disable,
|
||||
|
||||
/// Get static mesh visibility
|
||||
// @function Static:GetActive
|
||||
// @treturn bool visibility state
|
||||
ScriptReserved_GetActive, & Static::GetActive,
|
||||
|
||||
/// Get static mesh solid collision state
|
||||
// @function Static:GetSolid
|
||||
// @treturn bool solid collision state (true if solid, false if soft)
|
||||
ScriptReserved_GetSolid, & Static::GetSolid,
|
||||
|
||||
/// Set static mesh solid collision state
|
||||
// @function Static:SetSolid
|
||||
ScriptReserved_SetSolid, & Static::SetSolid,
|
||||
|
||||
/// Get the static's position
|
||||
// @function Static:GetPosition
|
||||
// @treturn Vec3 a copy of the static's position
|
||||
|
@ -113,6 +127,24 @@ void Static::Disable()
|
|||
m_mesh.flags &= ~StaticMeshFlags::SM_VISIBLE;
|
||||
}
|
||||
|
||||
bool Static::GetActive()
|
||||
{
|
||||
return (m_mesh.flags & StaticMeshFlags::SM_VISIBLE) != 0;
|
||||
}
|
||||
|
||||
bool Static::GetSolid()
|
||||
{
|
||||
return (m_mesh.flags & StaticMeshFlags::SM_SOLID) != 0;
|
||||
}
|
||||
|
||||
void Static::SetSolid(bool yes)
|
||||
{
|
||||
if (yes)
|
||||
m_mesh.flags |= StaticMeshFlags::SM_SOLID;
|
||||
else
|
||||
m_mesh.flags &= ~StaticMeshFlags::SM_SOLID;
|
||||
}
|
||||
|
||||
Vec3 Static::GetPos() const
|
||||
{
|
||||
return Vec3{ m_mesh.pos.Position.x, m_mesh.pos.Position.y, m_mesh.pos.Position.z };
|
||||
|
|
|
@ -25,6 +25,9 @@ public:
|
|||
|
||||
void Enable();
|
||||
void Disable();
|
||||
bool GetActive();
|
||||
bool GetSolid();
|
||||
void SetSolid(bool yes);
|
||||
Rotation GetRot() const;
|
||||
void SetRot(Rotation const& rot);
|
||||
Vec3 GetPos() const;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue