Skip to content

Commit

Permalink
add goto_x/y to unit lua proxy
Browse files Browse the repository at this point in the history
  • Loading branch information
gfgtdf committed Oct 21, 2018
1 parent cfd81d3 commit 5d26757
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions src/scripting/lua_unit.cpp
Expand Up @@ -279,6 +279,11 @@ static int impl_unit_get(lua_State *L)
lua_pushinteger(L, u.get_location().wml_y());
return 2;
}
if(strcmp(m, "goto") == 0) {
lua_pushinteger(L, u.get_goto().wml_x());
lua_pushinteger(L, u.get_goto().wml_y());
return 2;
}
return_int_attrib("side", u.side());
return_string_attrib("id", u.id());
return_string_attrib("type", u.type_id());
Expand Down Expand Up @@ -401,6 +406,7 @@ static int impl_unit_set(lua_State *L)
modify_tstring_attrib("name", u.set_name(value));
modify_string_attrib("role", u.set_role(value));
modify_string_attrib("facing", u.set_facing(map_location::parse_direction(value)));
modify_string_attrib("usage", u.set_usage(value));
modify_bool_attrib("hidden", u.set_hidden(value));
modify_bool_attrib("zoc", u.set_emit_zoc(value));
modify_bool_attrib("canrecruit", u.set_can_recruit(value));
Expand Down Expand Up @@ -486,6 +492,11 @@ static int impl_unit_set(lua_State *L)
}
}

if(strcmp(m, "goto") == 0) {
u.set_goto(luaW_checklocation(L, 3));
return 0;
}

std::string err_msg = "unknown modifiable property of unit: ";
err_msg += m;
return luaL_argerror(L, 2, err_msg.c_str());
Expand Down

0 comments on commit 5d26757

Please sign in to comment.