forked from github/server
delete intermittent test: ents have no special guarding powers.
This commit is contained in:
parent
cffcac8af7
commit
968f67a567
5 changed files with 28 additions and 28 deletions
|
@ -15,7 +15,7 @@ local function wedding_travellers(b)
|
|||
local units = {}
|
||||
|
||||
for u in b.units do
|
||||
if u:get_flag('wdgt') then
|
||||
if u:get_key('wdgt') then
|
||||
units[u] = u
|
||||
end
|
||||
end
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
function dump_messages(f)
|
||||
for k, v in ipairs(f.messages) do
|
||||
print(v)
|
||||
end
|
||||
end
|
||||
|
||||
require 'tests.e2.movement'
|
||||
require 'tests.e2.astral'
|
||||
require 'tests.e2.spells'
|
||||
|
|
|
@ -216,21 +216,3 @@ function test_sawmill()
|
|||
assert_equal(6, u:get_item("log"))
|
||||
assert_equal(97, r:get_resource("tree"))
|
||||
end
|
||||
|
||||
function test_ent_guards_trees()
|
||||
local r = region.create(0, 0, "plain")
|
||||
r:set_resource("tree", 100)
|
||||
local u = unit.create(faction.create("human"), r)
|
||||
u:set_skill("mining", 1)
|
||||
local guard = unit.create(get_monsters(), r, 1, "ent")
|
||||
u:set_skill("forestry", 1)
|
||||
guard:clear_orders()
|
||||
u:clear_orders()
|
||||
|
||||
guard:add_order("BEWACHEN")
|
||||
u:add_order("MACHE HOLZ")
|
||||
process_orders()
|
||||
assert_equal(1, u:get_item("log"))
|
||||
process_orders()
|
||||
assert_equal(1, u:get_item("log"))
|
||||
end
|
||||
|
|
|
@ -760,7 +760,7 @@ static int tolua_unit_has_attrib(lua_State *L) {
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_unit_get_flag(lua_State * L)
|
||||
static int tolua_unit_get_key(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
const char *name = tolua_tostring(L, 2, 0);
|
||||
|
@ -769,7 +769,7 @@ static int tolua_unit_get_flag(lua_State * L)
|
|||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_unit_set_flag(lua_State * L)
|
||||
static int tolua_unit_set_key(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
const char *name = tolua_tostring(L, 2, 0);
|
||||
|
@ -784,6 +784,28 @@ static int tolua_unit_set_flag(lua_State * L)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_unit_get_flag(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, NULL);
|
||||
int bit = (int)tolua_tonumber(L, 2, 0);
|
||||
|
||||
lua_pushboolean(L, (self->flags & (1 << bit)));
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int tolua_unit_set_flag(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, NULL);
|
||||
int bit = (int)tolua_tonumber(L, 2, 0);
|
||||
int set = tolua_toboolean(L, 3, 1);
|
||||
|
||||
if (set)
|
||||
self->flags |= (1 << bit);
|
||||
else
|
||||
self->flags &= ~(1 << bit);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int tolua_unit_get_weight(lua_State * L)
|
||||
{
|
||||
unit *self = (unit *)tolua_tousertype(L, 1, 0);
|
||||
|
@ -959,6 +981,8 @@ void tolua_unit_open(lua_State * L)
|
|||
tolua_function(L, TOLUA_CAST "has_attrib", tolua_unit_has_attrib);
|
||||
|
||||
/* key-attributes for named flags: */
|
||||
tolua_function(L, TOLUA_CAST "set_key", tolua_unit_set_key);
|
||||
tolua_function(L, TOLUA_CAST "get_key", tolua_unit_get_key);
|
||||
tolua_function(L, TOLUA_CAST "set_flag", tolua_unit_set_flag);
|
||||
tolua_function(L, TOLUA_CAST "get_flag", tolua_unit_get_flag);
|
||||
tolua_variable(L, TOLUA_CAST "guard", tolua_unit_get_guard,
|
||||
|
|
|
@ -442,7 +442,7 @@ static order *monster_move(region * r, unit * u)
|
|||
if (fval(u_race(u), RCF_DRAGON)) {
|
||||
d = richest_neighbour(r, u->faction, 1);
|
||||
}
|
||||
else if (get_race(RC_TREEMAN)==u_race(u)) {
|
||||
else if (get_race(RC_TREEMAN) == u_race(u)) {
|
||||
d = treeman_neighbour(r);
|
||||
}
|
||||
else {
|
||||
|
|
Loading…
Reference in a new issue