aboutsummaryrefslogtreecommitdiff
path: root/assets/blender/ks/signal_ks_singlemesh_lampuv.xcf
blob: b05c6f211e57edb5d257cd0dc99f18c962148b12 (plain)
ofshex dumpascii
0000 67 69 6d 70 20 78 63 66 20 66 69 6c 65 00 00 00 00 20 00 00 00 20 00 00 00 00 00 00 00 11 00 00 gimp.xcf.file...................
0020 00 01 01 00 00 00 13 00 00 00 08 42 90 04 9c 42 90 04 9c 00 00 00 14 00 00 00 04 00 00 00 0c 00 ...........B...B................
0040 00 00 16 00 00 00 04 00 00 00 01 00 00 00 15 00 00 01 1c 00 00 00 10 67 69 6d 70 2d 69 6d 61 67 .......................gimp-imag
0060 65 2d 67 72 69 64 00 00 00 00 01 00 00 01 00 28 73 74 79 6c 65 20 73 6f 6c 69 64 29 0a 28 66 67 e-grid.........(style.solid).(fg
0080 63 6f 6c 6f 72 20 28 63 6f 6c 6f 72 2d 72 67 62 61 20 30 2e 30 30 30 30 30 30 20 30 2e 30 30 30 color.(color-rgba.0.000000.0.000
00a0 30 30 30 20 30 2e 30 30 30 30 30 30 20 31 2e 30 30 30 30 30 30 29 29 0a 28 62 67 63 6f 6c 6f 72 000.0.000000.1.000000)).(bgcolor
00c0 20 28 63 6f 6c 6f 72 2d 72 67 62 61 20 31 2e 30 30 30 30 30 30 20 31 2e 30 30 30 30 30 30 20 31 .(color-rgba.1.000000.1.000000.1
00e0 2e 30 30 30 30 30 30 20 31 2e 30 30 30 30 30 30 29 29 0a 28 78 73 70 61 63 69 6e 67 20 31 30 2e .000000.1.000000)).(xspacing.10.
0100 30 30 30 30 30 30 29 0a 28 79 73 70 61 63 69 6e 67 20 31 30 2e 30 30 30 30 30 30 29 0a 28 73 70 000000).(yspacing.10.000000).(sp
0120 61 63 69 6e 67 2d 75 6e 69 74 20 69 6e 63 68 65 73 29 0a 28 78 6f 66 66 73 65 74 20 30 2e 30 30 acing-unit.inches).(xoffset.0.00
0140 30 30 30 30 29 0a 28 79 6f 66 66 73 65 74 20 30 2e 30 30 30 30 30 30 29 0a 28 6f 66 66 73 65 74 0000).(yoffset.0.000000).(offset
0160 2d 75 6e 69 74 20 69 6e 63 68 65 73 29 0a 00 00 00 00 00 00 00 00 00 00 00 01 8b 00 00 03 02 00 -unit.inches)...................
0180 00 00 00 00 00 05 44 00 00 00 00 00 00 00 20 00 00 00 20 00 00 00 01 00 00 00 09 45 62 65 6e 65 ......D....................Ebene
01a0 20 23 31 00 00 00 00 02 00 00 00 00 00 00 00 06 00 00 00 04 00 00 00 ff 00 00 00 08 00 00 00 04 .#1.............................
01c0 00 00 00 01 00 00 00 09 00 00 00 04 00 00 00 00 00 00 00 1c 00 00 00 04 00 00 00 00 00 00 00 0a ................................
01e0 00 00 00 04 00 00 00 00 00 00 00 0b 00 00 00 04 00 00 00 00 00 00 00 0c 00 00 00 04 00 00 00 00 ................................
0200 00 00 00 0d 00 00 00 04 00 00 00 00 00 00 00 0f 00 00 00 08 00 00 00 00 00 00 00 00 00 00 00 07 ................................
0220 00 00 00 04 00 00 00 03 00 00 00 14 00 00 00 04 00 00 00 04 00 00 00 00 00 00 00 00 00 00 02 44 ...............................D
0240 00 00 00 00 00 00 00 20 00 00 00 20 00 00 00 04 00 00 02 58 00 00 00 00 00 00 00 20 00 00 00 20 ...................X............
0260 00 00 02 68 00 00 00 00 16 ff 08 32 16 ff 08 32 16 ff 08 32 16 ff 08 32 16 ff 08 32 16 ff 08 32 ...h.......2...2...2...2...2...2
0280 16 ff 08 32 16 ff 08 32 16 ff 08 32 16 ff 08 32 16 ff 15 32 06 ff 7f 02 8c 32 16 ff 08 32 16 ff ...2...2...2...2...2.....2...2..
02a0 08 32 16 ff 08 32 16 ff 08 32 16 ff 08 32 16 ff 08 32 16 ff 08 32 16 ff 08 32 16 ff 08 32 16 ff .2...2...2...2...2...2...2...2..
02c0 08 32 16 ff 15 32 06 ff 7f 02 8c 32 16 ff 08 32 16 ff 08 32 16 ff 08 32 16 ff 08 32 16 ff 08 32 .2...2.....2...2...2...2...2...2
02e0 16 ff 08 32 16 ff 08 32 16 ff 08 32 16 ff 08 32 16 ff 08 32 16 ff 15 32 06 ff 7f 02 8c 32 7f 04 ...2...2...2...2...2...2.....2..
0300 00 ff 00 00 00 20 00 00 00 20 00 00 00 01 00 00 00 06 45 62 65 6e 65 00 00 00 00 06 00 00 00 04 ..................Ebene.........
0320 00 00 00 ff 00 00 00 08 00 00 00 04 00 00 00 01 00 00 00 09 00 00 00 04 00 00 00 00 00 00 00 1c ................................
0340 00 00 00 04 00 00 00 00 00 00 00 0a 00 00 00 04 00 00 00 00 00 00 00 0b 00 00 00 04 00 00 00 00 ................................
0360 00 00 00 0c 00 00 00 04 00 00 00 00 00 00 00 0d 00 00 00 04 00 00 00 00 00 00 00 0f 00 00 00 08 ................................
0380 00 00 00 00 00 00 00 00 00 00 00 07 00 00 00 04 00 00 00 00 00 00 00 14 00 00 00 04 00 00 00 03 ................................
03a0 00 00 00 00 00 00 00 00 00 00 03 b0 00 00 00 00 00 00 00 20 00 00 00 20 00 00 00 04 00 00 03 c4 ................................
03c0 00 00 00 00 00 00 00 20 00 00 00 20 00 00 03 d4 00 00 00 00 7f 01 74 ff 0b 46 13 ff 0b 46 13 ff ......................t..F...F..
03e0 0b 46 13 ff 0b 46 13 ff 0b 46 13 ff 0b 46 13 ff 0b 46 13 ff 0b 46 13 ff 0b 46 13 ff 0b 46 13 ff .F...F...F...F...F...F...F...F..
0400 0b 46 13 ff 0b 46 7f 01 20 ff 0a ff 0b 29 13 ff 0b 29 13 ff 0b 29 13 ff 0b 29 13 ff 0b 29 13 ff .F...F.......)...)...)...)...)..
0420 0b 29 13 ff 0b 29 13 ff 0b 29 13 ff 0b 29 13 ff 0b 29 13 ff 0b 29 09 ff 0b e9 06 29 0b dc fe ff .)...)...)...)...)...).....)....
0440 e9 0a e9 06 ff 0b dc fe ff e9 0a e9 06 ff 0b dc fe ff e9 0a e9 06 ff 0b dc fe ff e9 0a e9 06 ff ................................
0460 0b dc fe ff e9 0a e9 06 ff 0b dc fe ff e9 0a e9 06 ff 0b dc fe ff e9 0a e9 06 ff 0b dc fe ff e9 ................................
0480 0a e9 06 ff 0b dc fe ff e9 0a e9 06 ff 0b dc fe ff e9 0a e9 06 ff 0b dc fe ff e9 0a e9 06 ff 0b ................................
04a0 dc 7f 01 20 ff 0a ff 0b 29 13 ff 0b 29 13 ff 0b 29 13 ff 0b 29 13 ff 0b 29 13 ff 0b 29 13 ff 0b ........)...)...)...)...)...)...
04c0 29 13 ff 0b 29 13 ff 0b 29 13 ff 0b 29 13 ff 0b 29 09 ff 0b 00 06 29 0b 55 fe ff 00 0a 00 06 ff )...)...)...)...).....).U.......
04e0 0b 55 fe ff 00 0a 00 06 ff 0b 55 fe ff 00 0a 00 06 ff 0b 55 fe ff 00 0a 00 06 ff 0b 55 fe ff 00 .U........U........U........U...
0500 0a 00 06 ff 0b 55 fe ff 00 0a 00 06 ff 0b 55 fe ff 00 0a 00 06 ff 0b 55 fe ff 00 0a 00 06 ff 0b .....U........U........U........
0520 55 fe ff 00 0a 00 06 ff 0b 55 fe ff 00 0a 00 06 ff 0b 55 fe ff 00 0a 00 06 ff 0b 55 7f 01 20 ff U........U........U........U....
0540 7f 04 00 ff 00 00 00 20 00 00 00 20 00 00 00 0d 41 75 73 77 61 68 6c 6d 61 73 6b 65 00 00 00 00 ................Auswahlmaske....
0560 04 00 00 00 00 00 00 00 06 00 00 00 04 00 00 00 7f 00 00 00 08 00 00 00 04 00 00 00 01 00 00 00 ................................
0580 09 00 00 00 04 00 00 00 00 00 00 00 1c 00 00 00 04 00 00 00 00 00 00 00 0e 00 00 00 04 00 00 00 ................................
05a0 01 00 00 00 10 00 00 00 03 00 00 00 00 00 00 14 00 00 00 04 00 00 00 01 00 00 00 00 00 00 00 00 ................................
05c0 00 00 05 c4 00 00 00 20 00 00 00 20 00 00 00 01 00 00 05 d8 00 00 00 00 00 00 00 20 00 00 00 20 ................................
05e0 00 00 05 e8 00 00 00 00 0a ff 14 00 0a ff 14 00 0a ff 14 00 0a ff 14 00 0a ff 14 00 0a ff 14 00 ................................
0600 0a ff 14 00 0a ff 14 00 0a ff 14 00 0a ff 14 00 0a ff 7f 02 b5 00 ......................
d='n343' href='#n343'>343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>
Copyright (C) 2017 nerzhul, 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 "l_client.h"
#include "chatmessage.h"
#include "client/client.h"
#include "client/clientevent.h"
#include "client/sound.h"
#include "client/clientenvironment.h"
#include "common/c_content.h"
#include "common/c_converter.h"
#include "cpp_api/s_base.h"
#include "gettext.h"
#include "l_internal.h"
#include "lua_api/l_item.h"
#include "lua_api/l_nodemeta.h"
#include "gui/mainmenumanager.h"
#include "map.h"
#include "util/string.h"
#include "nodedef.h"

int ModApiClient::l_get_current_modname(lua_State *L)
{
	lua_rawgeti(L, LUA_REGISTRYINDEX, CUSTOM_RIDX_CURRENT_MOD_NAME);
	return 1;
}

// get_last_run_mod()
int ModApiClient::l_get_last_run_mod(lua_State *L)
{
	lua_rawgeti(L, LUA_REGISTRYINDEX, CUSTOM_RIDX_CURRENT_MOD_NAME);
	std::string current_mod = readParam<std::string>(L, -1, "");
	if (current_mod.empty()) {
		lua_pop(L, 1);
		lua_pushstring(L, getScriptApiBase(L)->getOrigin().c_str());
	}
	return 1;
}

// set_last_run_mod(modname)
int ModApiClient::l_set_last_run_mod(lua_State *L)
{
	if (!lua_isstring(L, 1))
		return 0;

	const char *mod = lua_tostring(L, 1);
	getScriptApiBase(L)->setOriginDirect(mod);
	lua_pushboolean(L, true);
	return 1;
}

// print(text)
int ModApiClient::l_print(lua_State *L)
{
	NO_MAP_LOCK_REQUIRED;
	std::string text = luaL_checkstring(L, 1);
	rawstream << text << std::endl;
	return 0;
}

// display_chat_message(message)
int ModApiClient::l_display_chat_message(lua_State *L)
{
	if (!lua_isstring(L, 1))
		return 0;

	std::string message = luaL_checkstring(L, 1);
	getClient(L)->pushToChatQueue(new ChatMessage(utf8_to_wide(message)));
	lua_pushboolean(L, true);
	return 1;
}

// send_chat_message(message)
int ModApiClient::l_send_chat_message(lua_State *L)
{
	if (!lua_isstring(L, 1))
		return 0;

	// If server disabled this API, discard

	// clang-format off
	if (getClient(L)->checkCSMRestrictionFlag(
			CSMRestrictionFlags::CSM_RF_CHAT_MESSAGES))
		return 0;
	// clang-format on

	std::string message = luaL_checkstring(L, 1);
	getClient(L)->sendChatMessage(utf8_to_wide(message));
	return 0;
}

// clear_out_chat_queue()
int ModApiClient::l_clear_out_chat_queue(lua_State *L)
{
	getClient(L)->clearOutChatQueue();
	return 0;
}

// get_player_names()
int ModApiClient::l_get_player_names(lua_State *L)
{
	// clang-format off
	if (getClient(L)->checkCSMRestrictionFlag(
			CSMRestrictionFlags::CSM_RF_READ_PLAYERINFO)) {
		return 0;
	}
	// clang-format on

	const std::list<std::string> &plist = getClient(L)->getConnectedPlayerNames();
	lua_createtable(L, plist.size(), 0);
	int newTable = lua_gettop(L);
	int index = 1;
	std::list<std::string>::const_iterator iter;
	for (iter = plist.begin(); iter != plist.end(); ++iter) {
		lua_pushstring(L, (*iter).c_str());
		lua_rawseti(L, newTable, index);
		index++;
	}
	return 1;
}

// show_formspec(formspec)
int ModApiClient::l_show_formspec(lua_State *L)
{
	if (!lua_isstring(L, 1) || !lua_isstring(L, 2))
		return 0;

	ClientEvent *event = new ClientEvent();
	event->type = CE_SHOW_LOCAL_FORMSPEC;
	event->show_formspec.formname = new std::string(luaL_checkstring(L, 1));
	event->show_formspec.formspec = new std::string(luaL_checkstring(L, 2));
	getClient(L)->pushToEventQueue(event);
	lua_pushboolean(L, true);
	return 1;
}

// send_respawn()
int ModApiClient::l_send_respawn(lua_State *L)
{
	getClient(L)->sendRespawn();
	return 0;
}

// disconnect()
int ModApiClient::l_disconnect(lua_State *L)
{
	// Stops badly written Lua code form causing boot loops
	if (getClient(L)->isShutdown()) {
		lua_pushboolean(L, false);
		return 1;
	}

	g_gamecallback->disconnect();
	lua_pushboolean(L, true);
	return 1;
}

// gettext(text)
int ModApiClient::l_gettext(lua_State *L)
{
	std::string text = strgettext(std::string(luaL_checkstring(L, 1)));
	lua_pushstring(L, text.c_str());

	return 1;
}

// get_node(pos)
// pos = {x=num, y=num, z=num}
int ModApiClient::l_get_node_or_nil(lua_State *L)
{
	// pos
	v3s16 pos = read_v3s16(L, 1);

	// Do it
	bool pos_ok;
	MapNode n = getClient(L)->getNode(pos, &pos_ok);
	if (pos_ok) {
		// Return node
		pushnode(L, n, getClient(L)->ndef());
	} else {
		lua_pushnil(L);
	}
	return 1;
}

int ModApiClient::l_get_language(lua_State *L)
{
	char *locale = setlocale(LC_ALL, "");
	lua_pushstring(L, locale);
	return 1;
}

int ModApiClient::l_get_wielded_item(lua_State *L)
{
	Client *client = getClient(L);
	LocalPlayer *player = client->getEnv().getLocalPlayer();
	if (!player)
		return 0;

	ItemStack selected_item;
	player->getWieldedItem(&selected_item, nullptr);
	LuaItemStack::create(L, selected_item);
	return 1;
}

// get_meta(pos)
int ModApiClient::l_get_meta(lua_State *L)
{
	v3s16 p = read_v3s16(L, 1);
	NodeMetadata *meta = getClient(L)->getEnv().getMap().getNodeMetadata(p);
	NodeMetaRef::createClient(L, meta);
	return 1;
}

int ModApiClient::l_sound_play(lua_State *L)
{
	ISoundManager *sound = getClient(L)->getSoundManager();

	SimpleSoundSpec spec;
	read_soundspec(L, 1, spec);
	float gain = 1.0f;
	float pitch = 1.0f;
	bool looped = false;
	s32 handle;

	if (lua_istable(L, 2)) {
		getfloatfield(L, 2, "gain", gain);
		getfloatfield(L, 2, "pitch", pitch);
		getboolfield(L, 2, "loop", looped);

		lua_getfield(L, 2, "pos");
		if (!lua_isnil(L, -1)) {
			v3f pos = read_v3f(L, -1) * BS;
			lua_pop(L, 1);
			handle = sound->playSoundAt(
					spec.name, looped, gain * spec.gain, pos, pitch);
			lua_pushinteger(L, handle);
			return 1;
		}
	}

	handle = sound->playSound(spec.name, looped, gain * spec.gain, 0.0f, pitch);
	lua_pushinteger(L, handle);

	return 1;
}

int ModApiClient::l_sound_stop(lua_State *L)
{
	u32 handle = luaL_checkinteger(L, 1);

	getClient(L)->getSoundManager()->stopSound(handle);

	return 0;
}

// get_server_info()
int ModApiClient::l_get_server_info(lua_State *L)
{
	Client *client = getClient(L);
	Address serverAddress = client->getServerAddress();
	lua_newtable(L);
	lua_pushstring(L, client->getAddressName().c_str());
	lua_setfield(L, -2, "address");
	lua_pushstring(L, serverAddress.serializeString().c_str());
	lua_setfield(L, -2, "ip");
	lua_pushinteger(L, serverAddress.getPort());
	lua_setfield(L, -2, "port");
	lua_pushinteger(L, client->getProtoVersion());
	lua_setfield(L, -2, "protocol_version");
	return 1;
}

// get_item_def(itemstring)
int ModApiClient::l_get_item_def(lua_State *L)
{
	IGameDef *gdef = getGameDef(L);
	assert(gdef);

	IItemDefManager *idef = gdef->idef();
	assert(idef);

	// clang-format off
	if (getClient(L)->checkCSMRestrictionFlag(
			CSMRestrictionFlags::CSM_RF_READ_ITEMDEFS))
		return 0;
	// clang-format on

	if (!lua_isstring(L, 1))
		return 0;

	std::string name = readParam<std::string>(L, 1);
	if (!idef->isKnown(name))
		return 0;
	const ItemDefinition &def = idef->get(name);

	push_item_definition_full(L, def);

	return 1;
}

// get_node_def(nodename)
int ModApiClient::l_get_node_def(lua_State *L)
{
	IGameDef *gdef = getGameDef(L);
	assert(gdef);

	const NodeDefManager *ndef = gdef->ndef();
	assert(ndef);

	if (!lua_isstring(L, 1))
		return 0;

	// clang-format off
	if (getClient(L)->checkCSMRestrictionFlag(
			CSMRestrictionFlags::CSM_RF_READ_NODEDEFS))
		return 0;
	// clang-format on

	std::string name = readParam<std::string>(L, 1);
	const ContentFeatures &cf = ndef->get(ndef->getId(name));
	if (cf.name != name) // Unknown node. | name = <whatever>, cf.name = ignore
		return 0;

	push_content_features(L, cf);

	return 1;
}

int ModApiClient::l_get_privilege_list(lua_State *L)
{
	const Client *client = getClient(L);
	lua_newtable(L);
	for (const std::string &priv : client->getPrivilegeList()) {
		lua_pushboolean(L, true);
		lua_setfield(L, -2, priv.c_str());
	}
	return 1;
}

// get_builtin_path()
int ModApiClient::l_get_builtin_path(lua_State *L)
{
	lua_pushstring(L, BUILTIN_MOD_NAME ":");
	return 1;
}

void ModApiClient::Initialize(lua_State *L, int top)
{
	API_FCT(get_current_modname);
	API_FCT(print);
	API_FCT(display_chat_message);
	API_FCT(send_chat_message);
	API_FCT(clear_out_chat_queue);
	API_FCT(get_player_names);
	API_FCT(set_last_run_mod);
	API_FCT(get_last_run_mod);
	API_FCT(show_formspec);
	API_FCT(send_respawn);
	API_FCT(gettext);
	API_FCT(get_node_or_nil);
	API_FCT(get_wielded_item);
	API_FCT(disconnect);
	API_FCT(get_meta);
	API_FCT(sound_play);
	API_FCT(sound_stop);
	API_FCT(get_server_info);
	API_FCT(get_item_def);
	API_FCT(get_node_def);
	API_FCT(get_privilege_list);
	API_FCT(get_builtin_path);
	API_FCT(get_language);
}