Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Exposing id of `om_terrain`/`overmap_special` to LUA #21738

Closed
ZhilkinSerg opened this issue Aug 28, 2017 · 1 comment

Comments

2 participants
@ZhilkinSerg
Copy link
Contributor

commented Aug 28, 2017

Does someone know how to expose id/name of om_terrain/overmap_special to LUA?

There are following attributes in overmap table:

overmap = {
attributes = {
},
functions = {
{ name = "add_note", rval = nil, args = { "int", "int", "int", "string" } },
{ name = "clear_mon_groups", rval = nil, args = { } },
{ name = "delete_note", rval = nil, args = { "int", "int", "int" } },
{ name = "find_random_omt", rval = "tripoint", args = { "string" } },
{ name = "has_note", rval = "bool", args = { "int", "int", "int" } },
{ name = "is_explored", rval = "bool", args = { "int", "int", "int" } },
{ name = "note", rval = "string", args = { "int", "int", "int" } },
}
},

Which attribute and/or function should be added to class_definitions.lua?

Edit by @Leland: moved code to embed

@ZhilkinSerg

This comment has been minimized.

Copy link
Contributor Author

commented Aug 30, 2017

Looking through the source code of catalua.cpp, I've found that terrain type and current turn are already being exposed to global variables tertype and turn, so one can use them like this:

print ("degrading:".._G.tertype.." in turn:"..tostring(_G.turn))
game.add_msg ("degrading:".._G.tertype.." in turn:"..tostring(_G.turn))

It will be also possible to get a rotation of the building as tertype variable contains not only id of the overmap terrain, but also direction suffix (_north, _south, _east or _west).

default

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.