Invoke can now only invoke method in class 'invoke', likewise for 'probe'
This commit is contained in:
@@ -461,6 +461,11 @@ void World::probe_lua_call(int64_t actor_id, int64_t place_id, std::string_view
|
||||
return;
|
||||
}
|
||||
|
||||
if (classname != "probe") {
|
||||
retvals->write_lua_value_type(LuaValueType::STRING);
|
||||
retvals->write_string("currently, can only probe functions in class 'probe'");
|
||||
}
|
||||
|
||||
LuaVar lclass, lfunc, actor, place, mt, tangibles, retvec, retval;
|
||||
LuaExtStack LS(L, lclass, lfunc, actor, place, mt, tangibles, retvec, retval);
|
||||
|
||||
@@ -944,6 +949,9 @@ void World::invoke_lua_call(int64_t actor_id, int64_t place_id, std::string_view
|
||||
} catch (const StreamException &ex) {
|
||||
return;
|
||||
}
|
||||
|
||||
// Currently, we only allow calling functions in class 'invoke'.
|
||||
if (classname != "invoke") return;
|
||||
|
||||
{
|
||||
lua_State *L = state();
|
||||
@@ -966,8 +974,6 @@ void World::invoke_lua_call(int64_t actor_id, int64_t place_id, std::string_view
|
||||
classname = LS.classname(lclass);
|
||||
if (classname.empty()) return;
|
||||
|
||||
// TODO: CHECK FOR PERMIT_INVOKE.
|
||||
|
||||
// Get the function from the class.
|
||||
LS.rawget(lfunc, lclass, funcname);
|
||||
if (!LS.isfunction(lfunc)) return;
|
||||
|
||||
@@ -29,9 +29,10 @@
|
||||
--
|
||||
----------------------------------------------------------------
|
||||
|
||||
makeclass('engio')
|
||||
makeclass('probe')
|
||||
makeclass('invoke')
|
||||
|
||||
function engio.gethotkeys()
|
||||
function probe.gethotkeys()
|
||||
local class = tangible.getclass(place)
|
||||
|
||||
-- if the tangible doesn't have a 'lookhotkeys' function, do nothing
|
||||
@@ -48,7 +49,7 @@ function engio.gethotkeys()
|
||||
return keys
|
||||
end
|
||||
|
||||
function engio.presshotkey(pressed)
|
||||
function invoke.presshotkey(pressed)
|
||||
local class = tangible.getclass(place)
|
||||
|
||||
-- if the tangible doesn't have a 'lookhotkeys' function, do nothing
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
makeclass("world")
|
||||
makeclass('world')
|
||||
makeclass('login')
|
||||
makeclass("engio")
|
||||
makeclass('probe')
|
||||
makeclass('invoke')
|
||||
makeclass('cube')
|
||||
makeclass('sphere')
|
||||
|
||||
@@ -23,7 +24,7 @@ function world.init()
|
||||
login.init()
|
||||
end
|
||||
|
||||
function engio.move(action, xyz, facing)
|
||||
function invoke.move(action, xyz, facing)
|
||||
-- todo: sanity check the parameters.
|
||||
tangible.animate{tan=actor, anim={action=action, interactive=true, xyz=xyz, facing=facing}}
|
||||
end
|
||||
@@ -54,7 +55,7 @@ function sphere.lookhotkeys(add)
|
||||
end
|
||||
|
||||
|
||||
function engio.getlookat()
|
||||
function probe.getlookat()
|
||||
local class = tangible.getclass(place)
|
||||
|
||||
-- if the tangible is not of any class, return empty string.
|
||||
|
||||
@@ -29,9 +29,10 @@
|
||||
--
|
||||
----------------------------------------------------------------
|
||||
|
||||
makeclass('engio')
|
||||
makeclass('probe')
|
||||
makeclass('invoke')
|
||||
|
||||
function engio.getmenu()
|
||||
function probe.getmenu()
|
||||
local class = tangible.getclass(place)
|
||||
|
||||
-- if the tangible doesn't have a 'lookmenu' function, do nothing
|
||||
@@ -47,7 +48,7 @@ function engio.getmenu()
|
||||
return items
|
||||
end
|
||||
|
||||
function engio.pressmenu(label)
|
||||
function invoke.pressmenu(label)
|
||||
local class = tangible.getclass(place)
|
||||
|
||||
-- if the tangible doesn't have a 'lookmenu' function, do nothing
|
||||
|
||||
Reference in New Issue
Block a user