kill lua triggers for npc logic, never used.

This commit is contained in:
Enno Rehling 2018-08-03 06:47:29 +02:00
parent 116ff7247d
commit fc0616ed1e
2 changed files with 0 additions and 71 deletions

View File

@ -338,45 +338,6 @@ function test_message()
return msg
end
function test_events()
local fail = 1
local function msg_handler(u, evt)
str = evt:get(0)
u2 = evt:get(1)
assert(u2~=nil)
assert(str=="Du Elf stinken")
message_unit(u, u2, "thanks unit, i got your message: " .. str)
message_faction(u, u2.faction, "thanks faction, i got your message: " .. str)
message_region(u, "thanks region, i got your message: " .. str)
fail = 0
end
plain = region.create(0, 0, "plain")
skill = 8
f = create_faction('elf')
f.age = 20
u = unit.create(f, plain)
u.number = 1
u:add_item("money", u.number*100)
u:clear_orders()
u:add_order("NUMMER PARTEI test")
u:add_handler("message", msg_handler)
msg = "BOTSCHAFT EINHEIT " .. itoa36(u.id) .. " Du~Elf~stinken"
f = create_faction('elf')
f.age = 20
u = unit.create(f, plain)
u.number = 1
u:add_item("money", u.number*100)
u:clear_orders()
u:add_order("NUMMER PARTEI eviL")
u:add_order(msg)
process_orders()
assert(fail==0)
end
function test_renumber_ship()
local r = region.create(0, 0, "plain")
local f = create_faction('human')

View File

@ -468,35 +468,6 @@ static void fctr_done(trigger * t)
free(fd);
}
static struct trigger_type tt_lua = {
"lua_event",
fctr_init,
fctr_done,
fctr_handle
};
static trigger *trigger_lua(struct unit *u, int handle)
{
trigger *t = t_new(&tt_lua);
fctr_data *td = (fctr_data *)t->data.v;
td->target = u;
td->fhandle = handle;
return t;
}
static int tolua_unit_addhandler(lua_State * L)
{
unit *self = (unit *)tolua_tousertype(L, 1, 0);
const char *ename = tolua_tostring(L, 2, 0);
int handle;
lua_pushvalue(L, 3);
handle = luaL_ref(L, LUA_REGISTRYINDEX);
add_trigger(&self->attribs, ename, trigger_lua(self, handle));
return 0;
}
static int tolua_unit_addnotice(lua_State * L)
{
unit *self = (unit *)tolua_tousertype(L, 1, 0);
@ -1046,9 +1017,6 @@ void tolua_unit_open(lua_State * L)
tolua_function(L, TOLUA_CAST "add_notice", tolua_unit_addnotice);
/* npc logic: */
tolua_function(L, TOLUA_CAST "add_handler", tolua_unit_addhandler);
tolua_variable(L, TOLUA_CAST "race_name", tolua_unit_get_racename,
tolua_unit_set_racename);
tolua_function(L, TOLUA_CAST "add_spell", tolua_unit_addspell);