add rigidbody.set/is_vdamping
This commit is contained in:
parent
848de01448
commit
9d98c40528
@ -15,11 +15,15 @@ end
|
||||
|
||||
local Rigidbody = {__index={
|
||||
is_enabled=function(self) return __rigidbody.is_enabled(self.eid) end,
|
||||
set_enabled=function(self, f) return __rigidbody.set_enabled(self.eid, f) end,
|
||||
set_enabled=function(self, b) return __rigidbody.set_enabled(self.eid, b) end,
|
||||
get_vel=function(self) return __rigidbody.get_vel(self.eid) end,
|
||||
set_vel=function(self, v) return __rigidbody.set_vel(self.eid, v) end,
|
||||
get_size=function(self) return __rigidbody.get_size(self.eid) end,
|
||||
set_size=function(self, v) return __rigidbody.set_size(self.eid, v) end,
|
||||
get_gravity_scale=function(self) return __rigidbody.get_gravity_scale(self.eid) end,
|
||||
set_gravity_scale=function(self, s) return __rigidbody.set_gravity_scale(self.eid, s) end,
|
||||
is_vdamping=function(self) return __rigidbody.is_vdamping(self.eid) end,
|
||||
set_vdamping=function(self, b) return __rigidbody.set_vdamping(self.eid, b) end,
|
||||
}}
|
||||
|
||||
local function new_Rigidbody(eid)
|
||||
|
||||
@ -56,6 +56,20 @@ static int l_rigidbody_set_gravity_scale(lua::State* L) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_rigidbody_is_vdamping(lua::State* L) {
|
||||
if (auto entity = get_entity(L, 1)) {
|
||||
return lua::pushboolean(L, entity->getRigidbody().hitbox.verticalDamping);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_rigidbody_set_vdamping(lua::State* L) {
|
||||
if (auto entity = get_entity(L, 1)) {
|
||||
entity->getRigidbody().hitbox.verticalDamping = lua::toboolean(L, 2);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
const luaL_Reg rigidbodylib [] = {
|
||||
{"is_enabled", lua::wrap<l_rigidbody_is_enabled>},
|
||||
{"set_enabled", lua::wrap<l_rigidbody_set_enabled>},
|
||||
@ -65,5 +79,7 @@ const luaL_Reg rigidbodylib [] = {
|
||||
{"set_size", lua::wrap<l_rigidbody_set_size>},
|
||||
{"get_gravity_scale", lua::wrap<l_rigidbody_get_gravity_scale>},
|
||||
{"set_gravity_scale", lua::wrap<l_rigidbody_set_gravity_scale>},
|
||||
{"is_vdamping", lua::wrap<l_rigidbody_is_vdamping>},
|
||||
{"set_vdamping", lua::wrap<l_rigidbody_set_vdamping>},
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user