auto handling_mode = get_deprecated_handling_mode();
if (handling_mode != DeprecatedHandlingMode::Ignore) {
std::ostringstream os;
- os << warning << " (" << spec.name << " at " << spec.path << ")" << std::endl;
+ os << warning << " (" << spec.name << " at " << spec.path << ")"
+ << std::endl;
if (handling_mode == DeprecatedHandlingMode::Error) {
throw ModError(os.str());
if (info.exists("name"))
spec.name = info.get("name");
else
- log_mod_deprecation(spec, "Mods not having a mod.conf file with the name is deprecated.");
+ log_mod_deprecation(spec, "Mods not having a mod.conf file with "
+ "the name is deprecated.");
if (info.exists("author"))
spec.author = info.get("author");
std::ifstream is((spec.path + DIR_DELIM + "depends.txt").c_str());
if (is.good())
- log_mod_deprecation(spec, "depends.txt is deprecated, please use mod.conf instead.");
+ log_mod_deprecation(spec, "depends.txt is deprecated, "
+ "please use mod.conf instead.");
while (is.good()) {
std::string dep;
if (info.exists("description"))
spec.desc = info.get("description");
- else if (fs::ReadFile(spec.path + DIR_DELIM + "description.txt", spec.desc))
- log_mod_deprecation(spec, "description.txt is deprecated, please use mod.conf instead.");
+ else if (fs::ReadFile(spec.path + DIR_DELIM + "description.txt",
+ spec.desc))
+ log_mod_deprecation(spec, "description.txt is deprecated, please "
+ "use mod.conf instead.");
}
}
GenericCAO *ClientObjectRef::get_generic_cao(ClientObjectRef *ref, lua_State *L)
{
ClientActiveObject *obj = get_cao(ref);
- if (! obj)
+ if (!obj)
return nullptr;
ClientEnvironment &env = getClient(L)->getEnv();
GenericCAO *gcao = env.getGenericCAO(obj->getId());
{
ClientObjectRef *ref = checkobject(L, 1);
ClientActiveObject *cao = get_cao(ref);
- if (! cao)
+ if (!cao)
return 0;
push_v3f(L, cao->getPosition() / BS);
return 1;
{
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
- if (! gcao)
+ if (!gcao)
return 0;
push_v3f(L, gcao->getVelocity() / BS);
return 1;
{
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
- if (! gcao)
+ if (!gcao)
return 0;
push_v3f(L, gcao->getAcceleration() / BS);
return 1;
{
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
- if (! gcao)
+ if (!gcao)
return 0;
push_v3f(L, gcao->getRotation());
return 1;
{
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
- if (! gcao)
+ if (!gcao)
return 0;
lua_pushboolean(L, gcao->isPlayer());
return 1;
{
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
- if (! gcao)
+ if (!gcao)
return 0;
lua_pushboolean(L, gcao->isLocalPlayer());
return 1;
{
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
- if (! gcao)
+ if (!gcao)
return 0;
lua_pushstring(L, gcao->getName().c_str());
return 1;
{
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
- if (! gcao)
+ if (!gcao)
return 0;
ClientActiveObject *parent = gcao->getParent();
- if (! parent)
+ if (!parent)
return 0;
push_objectRef(L, parent->getId());
return 1;
int ClientObjectRef::l_get_nametag(lua_State *L)
{
- log_deprecated(L,"Deprecated call to get_nametag, use get_properties().nametag instead");
+ log_deprecated(L, "Deprecated call to get_nametag, use get_properties().nametag "
+ "instead");
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
- if (! gcao)
+ if (!gcao)
return 0;
ObjectProperties *props = gcao->getProperties();
lua_pushstring(L, props->nametag.c_str());
int ClientObjectRef::l_get_item_textures(lua_State *L)
{
- log_deprecated(L,"Deprecated call to get_item_textures, use get_properties().textures instead");
+ log_deprecated(L, "Deprecated call to get_item_textures, use "
+ "get_properties().textures instead");
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
- if (! gcao)
+ if (!gcao)
return 0;
ObjectProperties *props = gcao->getProperties();
lua_newtable(L);
int ClientObjectRef::l_get_max_hp(lua_State *L)
{
- log_deprecated(L,"Deprecated call to get_max_hp, use get_properties().hp_max instead");
+ log_deprecated(L, "Deprecated call to get_max_hp, use get_properties().hp_max "
+ "instead");
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
- if (! gcao)
+ if (!gcao)
return 0;
ObjectProperties *props = gcao->getProperties();
lua_pushnumber(L, props->hp_max);
{
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
- if (! gcao)
+ if (!gcao)
return 0;
ObjectProperties *prop = gcao->getProperties();
push_object_properties(L, prop);
{
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
- if (! gcao)
+ if (!gcao)
return 0;
ObjectProperties prop = *gcao->getProperties();
read_object_properties(L, 2, nullptr, &prop, getClient(L)->idef());
{
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
- if (! gcao)
+ if (!gcao)
return 0;
lua_pushnumber(L, gcao->getHp());
return 1;
{
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
- if (! gcao)
+ if (!gcao)
return 0;
PointedThing pointed(gcao->getId(), v3f(0, 0, 0), v3s16(0, 0, 0), 0);
getClient(L)->interact(INTERACT_START_DIGGING, pointed);
{
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
- if (! gcao)
+ if (!gcao)
return 0;
PointedThing pointed(gcao->getId(), v3f(0, 0, 0), v3s16(0, 0, 0), 0);
getClient(L)->interact(INTERACT_PLACE, pointed);
{
ClientObjectRef *ref = checkobject(L, 1);
ClientActiveObject *cao = get_cao(ref);
- if (! cao)
+ if (!cao)
return 0;
getClient(L)->getEnv().removeActiveObject(cao->getId());
{
ClientObjectRef *ref = checkobject(L, 1);
GenericCAO *gcao = get_generic_cao(ref, L);
- if (! gcao)
+ if (!gcao)
return 0;
gcao->nametag_images.clear();
- if(lua_istable(L, 2)){
+ if (lua_istable(L, 2)) {
lua_pushnil(L);
- while(lua_next(L, 2) != 0){
+ while (lua_next(L, 2) != 0) {
gcao->nametag_images.push_back(lua_tostring(L, -1));
lua_pop(L, 1);
}
luamethod(ClientObjectRef, get_properties),
luamethod(ClientObjectRef, set_properties),
luamethod(ClientObjectRef, get_hp),
- luamethod(ClientObjectRef, get_max_hp),
- luamethod(ClientObjectRef, punch),
+ luamethod(ClientObjectRef, get_max_hp), luamethod(ClientObjectRef, punch),
luamethod(ClientObjectRef, rightclick),
luamethod(ClientObjectRef, set_nametag_images), {0, 0}};