aboutsummaryrefslogtreecommitdiff
path: root/textures/base/pack/unknown_node.png
blob: cb59ff4677a745d8e9b5c4f4ccd9a357e3f4db0c (plain)
ofshex dumpascii
0000 89 50 4e 47 0d 0a 1a 0a 00 00 00 0d 49 48 44 52 00 00 00 10 00 00 00 10 08 03 00 00 00 28 2d 0f .PNG........IHDR.............(-.
0020 53 00 00 00 0f 50 4c 54 45 2d 29 24 48 41 36 56 4f 48 89 7d 70 ff 80 80 d2 04 c5 6d 00 00 00 6d S....PLTE-)$HA6VOH.}p......m...m
0040 49 44 41 54 78 da 25 8c 89 0d 00 31 0c c2 f8 f6 9f f9 e2 9e 52 88 8a 82 65 a9 71 7a 9e 5a 61 cc IDATx.%....1........R...e.qz.Za.
0060 9b a4 2a d1 b4 6e c9 3c b1 f9 7a c4 84 37 f2 a6 85 f8 9c 62 9b f8 cc 52 92 42 8a eb 30 ba 57 2a ..*..n.<..z..7.....b...R.B..0.W*
0080 0f e1 9b 71 f7 57 91 91 25 2e 4a 26 82 2a 4e 6d 8b 76 0d d5 8e 05 70 12 64 48 3b 3b 19 c1 83 0b ...q.W..%.J&.*Nm.v....p.dH;;....
00a0 93 5d 02 b8 a8 5b 02 4b 75 5c 5b c0 3e 1a b0 02 22 0d f8 63 86 00 00 00 00 49 45 4e 44 ae 42 60 .]...[.Ku\[.>..."..c.....IEND.B`
00c0 82 .
id='n56' href='#n56'>56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227
/*
Minetest
Copyright (C) 2017 Loic Blot <loic.blot@unix-experience.fr>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/


#include "lua_api/l_minimap.h"
#include "lua_api/l_internal.h"
#include "common/c_converter.h"
#include "client/client.h"
#include "client/minimap.h"
#include "settings.h"

LuaMinimap::LuaMinimap(Minimap *m) : m_minimap(m)
{
}

void LuaMinimap::create(lua_State *L, Minimap *m)
{
	LuaMinimap *o = new LuaMinimap(m);
	*(void **)(lua_newuserdata(L, sizeof(void *))) = o;
	luaL_getmetatable(L, className);
	lua_setmetatable(L, -2);

	// Keep minimap object stack id
	int minimap_object = lua_gettop(L);

	lua_getglobal(L, "core");
	lua_getfield(L, -1, "ui");
	luaL_checktype(L, -1, LUA_TTABLE);
	int uitable = lua_gettop(L);

	lua_pushvalue(L, minimap_object); // Copy object to top of stack
	lua_setfield(L, uitable, "minimap");
}

int LuaMinimap::l_get_pos(lua_State *L)
{
	LuaMinimap *ref = checkobject(L, 1);
	Minimap *m = getobject(ref);

	push_v3s16(L, m->getPos());
	return 1;
}

int LuaMinimap::l_set_pos(lua_State *L)
{
	LuaMinimap *ref = checkobject(L, 1);
	Minimap *m = getobject(ref);

	m->setPos(read_v3s16(L, 2));
	return 1;
}

int LuaMinimap::l_get_angle(lua_State *L)
{
	LuaMinimap *ref = checkobject(L, 1);
	Minimap *m = getobject(ref);

	lua_pushinteger(L, m->getAngle());
	return 1;
}

int LuaMinimap::l_set_angle(lua_State *L)
{
	LuaMinimap *ref = checkobject(L, 1);
	Minimap *m = getobject(ref);

	m->setAngle(lua_tointeger(L, 2));
	return 1;
}

int LuaMinimap::l_get_mode(lua_State *L)
{
	LuaMinimap *ref = checkobject(L, 1);
	Minimap *m = getobject(ref);

	lua_pushinteger(L, m->getMinimapMode());
	return 1;
}

int LuaMinimap::l_set_mode(lua_State *L)
{
	LuaMinimap *ref = checkobject(L, 1);
	Minimap *m = getobject(ref);

	s32 mode = lua_tointeger(L, 2);
	if (mode < MINIMAP_MODE_OFF ||
		mode >= MINIMAP_MODE_COUNT) {
		return 0;
	}

	m->setMinimapMode((MinimapMode) mode);
	return 1;
}

int LuaMinimap::l_set_shape(lua_State *L)
{
	LuaMinimap *ref = checkobject(L, 1);
	Minimap *m = getobject(ref);
	if (!lua_isnumber(L, 2))
		return 0;