forked from github/server
LUA: region.herbtype
This commit is contained in:
parent
9fd87309c7
commit
d72c0ab07e
|
@ -70,6 +70,21 @@ lua_region_getowner(const region& r) {
|
||||||
return region_owner(&r);
|
return region_owner(&r);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
region_setherbtype(region& r, const char * str) {
|
||||||
|
const struct resource_type * rtype = rt_find(str);
|
||||||
|
if (rtype!=NULL && rtype->itype!=NULL) {
|
||||||
|
rsetherbtype(&r, rtype->itype);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
static const char *
|
||||||
|
region_getherbtype(const region& r) {
|
||||||
|
const struct item_type * itype = rherbtype(&r);
|
||||||
|
if (itype==NULL) return NULL;
|
||||||
|
return itype->rtype->_name[0];
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
region_setinfo(region& r, const char * info) {
|
region_setinfo(region& r, const char * info) {
|
||||||
set_string(&r.display, info);
|
set_string(&r.display, info);
|
||||||
|
@ -301,6 +316,7 @@ bind_region(lua_State * L)
|
||||||
.property("name", ®ion_getname, ®ion_setname)
|
.property("name", ®ion_getname, ®ion_setname)
|
||||||
.property("info", ®ion_getinfo, ®ion_setinfo)
|
.property("info", ®ion_getinfo, ®ion_setinfo)
|
||||||
.property("owner", &lua_region_getowner, &lua_region_setowner)
|
.property("owner", &lua_region_getowner, &lua_region_setowner)
|
||||||
|
.property("herbtype", ®ion_getherbtype, ®ion_setherbtype)
|
||||||
.property("terrain", ®ion_getterrain)
|
.property("terrain", ®ion_getterrain)
|
||||||
.def("add_notice", ®ion_addnotice)
|
.def("add_notice", ®ion_addnotice)
|
||||||
.def("add_direction", ®ion_adddirection)
|
.def("add_direction", ®ion_adddirection)
|
||||||
|
|
Loading…
Reference in New Issue