Compare commits
	
		
			273 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 03c00a831d | ||
|  | 60520b8032 | ||
|  | a9137e8c21 | ||
|  | 75ea7e3160 | ||
|  | 047ecea3a2 | ||
|  | 5518c277f3 | ||
|  | 4468015cbe | ||
|  | 0755a8fa05 | ||
|  | 5d8b2442ce | ||
|  | 6157982787 | ||
|  | 07dcae7258 | ||
|  | d546a5a1fa | ||
|  | 3689bdad75 | ||
|  | 4ce47528e1 | ||
|  | 2edfb55c29 | ||
|  | d1e715ebac | ||
|  | c654c9fd11 | ||
|  | 2c0f716a13 | ||
|  | 64bf6c1b89 | ||
|  | 047bfb9ad1 | ||
|  | cab01b6694 | ||
|  | 554d15fadb | ||
|  | a9ac480dcd | ||
|  | 1237bc3a4b | ||
|  | 854415fd33 | ||
|  | 99cfe73bbf | ||
|  | 697b39d40d | ||
|  | 2b7ca68805 | ||
|  | bd24c15db4 | ||
|  | 69614dc20d | ||
|  | 75dfcdb1e7 | ||
|  | c332081e81 | ||
|  | 608e51f16d | ||
|  | b0fb180e4d | ||
|  | 2ebd6b3839 | ||
|  | 5a06de184c | ||
|  | 957f94534b | ||
|  | 4ec4672f01 | ||
|  | 954d64afdc | ||
|  | ef0eb4d435 | ||
|  | 11a7b88434 | ||
|  | 9ec33f34f1 | ||
|  | 2c2edfad04 | ||
|  | 22dd46dcc6 | ||
|  | 20f938e44a | ||
|  | fd34872de8 | ||
|  | 31edc5a9ff | ||
|  | 19bdcb26f6 | ||
|  | 5b7db48372 | ||
|  | 128f0adb24 | ||
|  | 6fb072e5ff | ||
|  | 8007c142de | ||
|  | e707ba3cf1 | ||
|  | 6680a51988 | ||
|  | 3bf3249d71 | ||
|  | e71b71c1a9 | ||
|  | a90338d40d | ||
|  | 929559fe85 | ||
|  | c41762d211 | ||
|  | f06d4b8547 | ||
|  | dcce6e9795 | ||
|  | d57cb0a110 | ||
|  | ba8cbbcdbd | ||
|  | 56cc4191ca | ||
|  | 6532978a58 | ||
|  | 349a63ed14 | ||
|  | 7f44a49d99 | ||
|  | 5047540db2 | ||
|  | 9dfaab7f20 | ||
|  | 8fe62ea7f6 | ||
|  | c4969665e7 | ||
|  | 9670c27161 | ||
|  | c32957f942 | ||
|  | c95cd8414b | ||
|  | cc2573acdf | ||
|  | 44dc611088 | ||
|  | 49a8ddc822 | ||
|  | 11c04e984d | ||
|  | ef1f66a64e | ||
|  | a1aee9a68f | ||
|  | 5dbc738dbd | ||
|  | 5b5aa493b5 | ||
|  | 6967232619 | ||
|  | 263b6f2fdf | ||
|  | 0ca4520cc2 | ||
|  | ea3fcdd077 | ||
|  | 820e48badc | ||
|  | c39b9b29de | ||
|  | a8ad9bfc9d | ||
|  | d4c24a30e9 | ||
|  | c8845e8d44 | ||
|  | 5175897cdc | ||
|  | c521cb06bf | ||
|  | 3180bdfe6c | ||
|  | c993e14084 | ||
|  | 955f3cf310 | ||
|  | 814c17631d | ||
|  | ca7f6bb97a | ||
|  | 5e0c49345a | ||
|  | 584718a2a7 | ||
|  | 46b6cee1fc | ||
|  | 7e5dc6c374 | ||
|  | 30e57bcc99 | ||
|  | e0673908bf | ||
|  | 7ea81f0906 | ||
|  | 49ad1c1bf7 | ||
|  | ff80b87783 | ||
|  | e106fd51ca | ||
|  | 18d0bdd2bb | ||
|  | 60ccb522d4 | ||
|  | d0aa09dd8d | ||
|  | 13dfc2c0e9 | ||
|  | 1e628ed92a | ||
|  | b468a23f60 | ||
|  | 7d63db1703 | ||
|  | f85e9ba691 | ||
|  | fa485f7d63 | ||
|  | da9579846c | ||
|  | 8dc6b0124e | ||
|  | 4602bd5999 | ||
|  | a3e92c4524 | ||
|  | 72f9f64c04 | ||
|  | 8bf344e461 | ||
|  | a32751800c | ||
|  | d47201f813 | ||
|  | f2255ccba0 | ||
|  | 16b625d963 | ||
|  | bb76f17703 | ||
|  | 104018d711 | ||
|  | 5e2902fd92 | ||
|  | 43b1608f86 | ||
|  | abdc707f28 | ||
|  | 15e2470493 | ||
|  | 07d3981d61 | ||
|  | d0a98b5331 | ||
|  | 195fec2689 | ||
|  | 664b45ac75 | ||
|  | b3f4f406c4 | ||
|  | 9559f695ec | ||
|  | 919c9d152b | ||
|  | 253af00743 | ||
|  | 579c279be2 | ||
|  | 15740ffd3d | ||
|  | a5dcf123e0 | ||
|  | d5fcae085d | ||
|  | 3e2781bc00 | ||
|  | e134282093 | ||
|  | 428a8127cb | ||
|  | 04e560328f | ||
|  | c971ec7dc7 | ||
|  | d09d8f02a4 | ||
|  | 1a9362afed | ||
|  | 8eff7ba0cd | ||
|  | 5dcc5cb305 | ||
|  | 4ea001fa37 | ||
|  | e8bcfdcd0e | ||
|  | 64fdb49a32 | ||
|  | 47a49eccf4 | ||
|  | ba4c80644e | ||
|  | 81e9a7cb36 | ||
|  | a5a59e3552 | ||
|  | bdd22db33d | ||
|  | 51de4236ab | ||
|  | 5d0795a1a7 | ||
|  | 4c0c7ae146 | ||
|  | 4bd6bce86e | ||
|  | 3653859961 | ||
|  | 9fdbc1f407 | ||
|  | 1d4eb43f26 | ||
|  | 91849c3b4e | ||
|  | 2d9f34cf29 | ||
|  | c21dccd7fa | ||
|  | a4b4de6d0e | ||
|  | 672fdbcc11 | ||
|  | 3c0fa5f8b0 | ||
|  | 7b8ad5786c | ||
|  | 066d23cdfd | ||
|  | cf6f458906 | ||
|  | e547d279ab | ||
|  | 3804d8a078 | ||
|  | a4823a4261 | ||
|  | 9df85d7752 | ||
|  | fa9424c31b | ||
|  | eb71e01887 | ||
|  | 83133210cc | ||
|  | 90fde974a2 | ||
|  | 02bfcae53d | ||
|  | 9bbde070a1 | ||
|  | 6fed6867cb | ||
|  | c4bb058421 | ||
|  | b0ab4fb4ab | ||
|  | d7784c0729 | ||
|  | 179f4c3f91 | ||
|  | 486509876a | ||
|  | c3c5f8a228 | ||
|  | 29f1f01f37 | ||
|  | a654c0dbbd | ||
|  | d6ce09a3ff | ||
|  | c2ce3d032e | ||
|  | 866f7b841c | ||
|  | 31a74ede18 | ||
|  | dfad095884 | ||
|  | 814959cc28 | ||
|  | 8dd2a77ff1 | ||
|  | 5d11a34b04 | ||
|  | 0dd813b5f8 | ||
|  | c1cd24c378 | ||
|  | d015f0e2e6 | ||
|  | ea6d504b01 | ||
|  | a65f5b1564 | ||
|  | fcf0816fa8 | ||
|  | 7f765f5f6c | ||
|  | 76398aac4a | ||
|  | 7acad11a50 | ||
|  | c46260945e | ||
|  | c43718a434 | ||
|  | 3db7bafb39 | ||
|  | d8c6a4f2ea | ||
|  | d2550ab761 | ||
|  | 7e843c92a6 | ||
|  | d6ec56811b | ||
|  | c809fc9655 | ||
|  | b4e9ef269b | ||
|  | 4e20ed6153 | ||
|  | 79856c914d | ||
|  | 648a11263b | ||
|  | 467e2029e2 | ||
|  | 3a617bcb6e | ||
|  | d5c373e290 | ||
|  | 4c5cb106c3 | ||
|  | 9ff8f8038e | ||
|  | a4426e4bd4 | ||
|  | e82c122822 | ||
|  | e43573b46b | ||
|  | 2f91ec0f73 | ||
|  | 57980cb49d | ||
|  | 034010a371 | ||
|  | 4b9914fdcb | ||
|  | 0d924e7e4d | ||
|  | 90aaa1fb62 | ||
|  | 6c70e0295a | ||
|  | 230747c748 | ||
|  | 86cff038a4 | ||
|  | 0823f16acb | ||
|  | e1d17b1747 | ||
|  | 2817db19d4 | ||
|  | 716397819d | ||
|  | 67fa74ac01 | ||
|  | d5cc51a396 | ||
|  | cd604fa9c8 | ||
|  | 686c0d087c | ||
|  | c27afe7ee8 | ||
|  | 9e23e9ecbf | ||
|  | 97db50a2fe | ||
|  | a0ba7cf973 | ||
|  | c1b1f2aa49 | ||
|  | 0beabfc755 | ||
|  | 5fa8852115 | ||
|  | 0eb46a01ff | ||
|  | de8726a9f7 | ||
|  | 33ec25caed | ||
|  | deb39ddcd4 | ||
|  | 2d1e7463d3 | ||
|  | 7505fbce51 | ||
|  | 9232734a48 | ||
|  | 1bf62bbad4 | ||
|  | 95cbfc50d8 | ||
|  | 61e60724f6 | ||
|  | 8c977451a8 | ||
|  | 73d078fd27 | ||
|  | 0636d574af | ||
|  | c4f2bee9a6 | ||
|  | 4763fa635a | 
							
								
								
									
										14
									
								
								README.txt
									
									
									
									
									
								
							
							
						
						| @@ -1,12 +1,12 @@ | |||||||
| The main game for the Minetest game engine [minetest_game] | The main game for the Minetest game engine [minetest_game] | ||||||
| ========================================================== | ========================================================== | ||||||
|  |  | ||||||
| To build the wholeness of the Minetest project, insert this repository as | To use this game with Minetest, insert this repository as | ||||||
|   /games/minetest_game |   /games/minetest_game | ||||||
| in the Minetest Engine. | in the Minetest Engine. | ||||||
|  |  | ||||||
| The Minetest Engine can be found in: | The Minetest Engine can be found in: | ||||||
|   https://github.com/celeron55/minetest/ |   https://github.com/minetest/minetest/ | ||||||
|  |  | ||||||
| Compatibility | Compatibility | ||||||
| -------------- | -------------- | ||||||
| @@ -14,10 +14,10 @@ The minetest_game github master HEAD is generally compatible with the github | |||||||
| master HEAD of minetest. | master HEAD of minetest. | ||||||
|  |  | ||||||
| Additionally, when the minetest engine is tagged to be a certain version (eg. | Additionally, when the minetest engine is tagged to be a certain version (eg. | ||||||
| 0.4.dev-20120326), minetest_game is tagged with the version too. | 0.4.10), minetest_game is tagged with the version too. | ||||||
|  |  | ||||||
| When stable releases are made, minetest_game is packaged and made available in | When stable releases are made, minetest_game is packaged and made available in | ||||||
|   https://github.com/celeron55/minetest_game/downloads |   http://minetest.net/download | ||||||
| and in case the repository has grown too much, it may be reset. In that sense, | and in case the repository has grown too much, it may be reset. In that sense, | ||||||
| this is not a "real" git repository. (Package maintainers please note!) | this is not a "real" git repository. (Package maintainers please note!) | ||||||
|  |  | ||||||
| @@ -45,6 +45,8 @@ License of media (textures and sounds) | |||||||
| Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com> | Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com> | ||||||
| See README.txt in each mod directory for information about other authors. | See README.txt in each mod directory for information about other authors. | ||||||
|  |  | ||||||
| Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)                                  | Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) | ||||||
| http://creativecommons.org/licenses/by-sa/3.0/ | http://creativecommons.org/licenses/by-sa/3.0/ | ||||||
|    |  | ||||||
|  | License of menu/header.png | ||||||
|  | Copyright (C) 2013 BlockMen CC BY-3.0 | ||||||
|   | |||||||
							
								
								
									
										314
									
								
								game_api.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,314 @@ | |||||||
|  | minetest_game API | ||||||
|  | ====================== | ||||||
|  | GitHub Repo: https://github.com/minetest/minetest_game | ||||||
|  |  | ||||||
|  | Introduction | ||||||
|  | ------------ | ||||||
|  | The minetest_game gamemode offers multiple new possibilities in addition to Minetest's built-in API, allowing you to | ||||||
|  | add new plants to farming mod, buckets for new liquids, new stairs and custom panes. | ||||||
|  | For information on the Minetest API, visit https://github.com/minetest/minetest/blob/master/doc/lua_api.txt | ||||||
|  | Please note: | ||||||
|  | 	[XYZ] refers to a section the Minetest API | ||||||
|  | 	[#ABC] refers to a section in this document | ||||||
|  | 	^ Explanation for line above | ||||||
|  |  | ||||||
|  | Bucket API | ||||||
|  | ---------- | ||||||
|  | The bucket API allows registering new types of buckets for non-default liquids. | ||||||
|  |  | ||||||
|  | 	bucket.register_liquid( | ||||||
|  | 		"default:lava_source",		-- Source node name | ||||||
|  | 		"default:lava_flowing",		-- Flowing node name | ||||||
|  | 		"bucket:bucket_lava",		-- Name to be used for bucket | ||||||
|  | 		"bucket_lava.png",			-- Bucket texture (for wielditem and inventory_image) | ||||||
|  | 		"Lava Bucket"				-- Bucket description | ||||||
|  | 	) | ||||||
|  |  | ||||||
|  | Doors API | ||||||
|  | --------- | ||||||
|  | The doors mod allows modders to register custom doors and trapdoors. | ||||||
|  |  | ||||||
|  | doors.register_door(name, def) | ||||||
|  | ^ name: "Door name" | ||||||
|  | ^ def: See [#Door definition] | ||||||
|  |  -> Registers new door | ||||||
|  |  | ||||||
|  | doors.register_trapdoor(name, def) | ||||||
|  | ^ name: "Trapdoor name" | ||||||
|  | ^ def: See [#Trapdoor definition] | ||||||
|  |  -> Registers new trapdoor | ||||||
|  |  | ||||||
|  | #Door definition | ||||||
|  | ---------------- | ||||||
|  | { | ||||||
|  | 	description = "Door description", | ||||||
|  | 	inventory_image = "mod_door_inv.png", | ||||||
|  | 	groups = {group = 1}, | ||||||
|  | 	tiles_bottom: [Tile definition], | ||||||
|  | 	^ the tiles of the bottom part of the door {front, side} | ||||||
|  | 	tiles_top: [Tile definition], | ||||||
|  | 	^ the tiles of the bottom part of the door {front, side} | ||||||
|  | 	node_box_bottom = regular nodebox, see [Node boxes], OPTIONAL, | ||||||
|  | 	node_box_top = regular nodebox, see [Node boxes], OPTIONAL, | ||||||
|  | 	selection_box_bottom = regular nodebox, see [Node boxes], OPTIONAL, | ||||||
|  | 	selection_box_top = regular nodebox, see [Node boxes], OPTIONAL, | ||||||
|  | 	sound_open_door = sound play for open door, OPTIONAL, | ||||||
|  | 	sound_close_door = sound play for close door, OPTIONAL, | ||||||
|  | 	only_placer_can_open = true/false, | ||||||
|  | 	^ If true, only placer can open the door (locked for others) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #Trapdoor definition | ||||||
|  | ---------------- | ||||||
|  | { | ||||||
|  | 	tile_front = "doors_trapdoor.png", | ||||||
|  | 	^ the texture for the front and back of the trapdoor | ||||||
|  | 	tile_side: "doors_trapdoor_side.png", | ||||||
|  | 	^ the tiles of the four side parts of the trapdoor | ||||||
|  | 	sound_open = sound to play when opening the trapdoor, OPTIONAL, | ||||||
|  | 	sound_close = sound to play when closing the trapdoor, OPTIONAL, | ||||||
|  | 	-> You can add any other node definition properties for minetest.register_node, | ||||||
|  | 	   such as wield_image, inventory_image, sounds, groups, description, ... | ||||||
|  | 	   Only node_box, selection_box, tiles, drop, drawtype, paramtype, paramtype2, on_rightclick | ||||||
|  | 	   will be overwritten by the trapdoor registration function | ||||||
|  | } | ||||||
|  |  | ||||||
|  | Farming API | ||||||
|  | ----------- | ||||||
|  | The farming API allows you to easily register plants and hoes. | ||||||
|  |  | ||||||
|  | farming.register_hoe(name, hoe definition) | ||||||
|  |  -> Register a new hoe, see [#hoe definition] | ||||||
|  |  | ||||||
|  | farming.register_plant(name, Plant definition) | ||||||
|  |  -> Register a new growing plant, see [#Plant definition] | ||||||
|  |  | ||||||
|  | #Hoe Definition | ||||||
|  | --------------- | ||||||
|  | { | ||||||
|  | 	description = "",	-- Description for tooltip | ||||||
|  | 	inventory_image = "unknown_item.png",	-- Image to be used as wield- and inventory image | ||||||
|  | 	max_uses = 30,	-- Uses until destroyed | ||||||
|  | 	recipe = {	-- Craft recipe | ||||||
|  | 		{"air", "air", "air"}, | ||||||
|  | 		{"", "group:stick"}, | ||||||
|  | 		{"", "group:stick"}, | ||||||
|  | 	} | ||||||
|  | } | ||||||
|  |  | ||||||
|  | #Plant definition | ||||||
|  | ----------------- | ||||||
|  | { | ||||||
|  | 	description = "",	-- Description of seed item | ||||||
|  | 	inventory_image = "unknown_item.png",	-- Image to be used as seed's wield- and inventory image | ||||||
|  | 	steps = 8,	-- How many steps the plant has to grow, until it can be harvested | ||||||
|  | 	^ Always provide a plant texture for ech step, format: modname_plantname_i.png (i = stepnumber) | ||||||
|  | 	minlight = 13, -- Minimum light to grow | ||||||
|  | 	maxlight = default.LIGHT_MAX -- Maximum light to grow | ||||||
|  | } | ||||||
|  |  | ||||||
|  | Stairs API | ||||||
|  | ---------- | ||||||
|  | The stairs API lets you register stairs and slabs and ensures that they are registered the same way as those | ||||||
|  | delivered with minetest_game, to keep them compatible with other mods. | ||||||
|  |  | ||||||
|  | stairs.register_stair(subname, recipeitem, groups, images, description, sounds) | ||||||
|  |  -> Registers a stair. | ||||||
|  |  -> subname: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_subname" | ||||||
|  |  -> recipeitem: Item used in the craft recipe, e.g. "default:cobble" | ||||||
|  |  -> groups: see [Known damage and digging time defining groups] | ||||||
|  |  -> images: see [Tile definition] | ||||||
|  |  -> description: used for the description field in the stair's definition | ||||||
|  |  -> sounds: see [#Default sounds] | ||||||
|  |  | ||||||
|  | stairs.register_slab(subname, recipeitem, groups, images, description, sounds) | ||||||
|  |  -> Registers a slabs | ||||||
|  |  -> subname: Basically the material name (e.g. cobble) used for the stair name. Nodename pattern: "stairs:stair_subname" | ||||||
|  |  -> recipeitem: Item used in the craft recipe, e.g. "default:cobble" | ||||||
|  |  -> groups: see [Known damage and digging time defining groups] | ||||||
|  |  -> images: see [Tile definition] | ||||||
|  |  -> description: used for the description field in the stair's definition | ||||||
|  |  -> sounds: see [#Default sounds] | ||||||
|  |  | ||||||
|  | stairs.register_stair_and_slab(subname, recipeitem, groups, images, desc_stair, desc_slab, sounds) | ||||||
|  |  -> A wrapper for stairs.register_stair and stairs.register_slab | ||||||
|  |  -> Uses almost the same arguments as stairs.register_stair | ||||||
|  |  -> desc_stair: Description for stair node | ||||||
|  |  -> desc_slab: Description for slab node | ||||||
|  |  | ||||||
|  | Xpanes API | ||||||
|  | ---------- | ||||||
|  | Creates panes that automatically connect to each other | ||||||
|  |  | ||||||
|  | xpanes.register_pane(subname, def) | ||||||
|  |  -> subname: used for nodename. Result: "xpanes:subname" and "xpanes:subname_{2..15}" | ||||||
|  |  -> def: See [#Pane definition] | ||||||
|  |  | ||||||
|  | #Pane definition | ||||||
|  | ---------------- | ||||||
|  | { | ||||||
|  | 	textures = {"texture_Bottom_top", "texture_left_right", "texture_front_back"}, | ||||||
|  | 	^ More tiles aren't supported | ||||||
|  | 	groups = {group = rating}, | ||||||
|  | 	^ Uses the known node groups, see [Known damage and digging time defining groups] | ||||||
|  | 	sounds = SoundSpec, | ||||||
|  | 	^ See [#Default sounds] | ||||||
|  | 	recipe = {{"","","","","","","","",""}}, | ||||||
|  | 	^ Recipe field only | ||||||
|  | } | ||||||
|  |  | ||||||
|  | Default sounds | ||||||
|  | -------------- | ||||||
|  | Sounds inside the default table can be used within the sounds field of node definitions. | ||||||
|  |  | ||||||
|  | default.node_sound_defaults() | ||||||
|  | default.node_sound_stone_defaults() | ||||||
|  | default.node_sound_dirt_defaults() | ||||||
|  | default.node_sound_sand_defaults() | ||||||
|  | default.node_sound_wood_defaults() | ||||||
|  | default.node_sound_leaves_defaults() | ||||||
|  | default.node_sound_glass_defaults() | ||||||
|  |  | ||||||
|  | Default constants | ||||||
|  | ----------------- | ||||||
|  | default.LIGHT_MAX | ||||||
|  | ^ The maximum light level (see [Node definition] light_source) | ||||||
|  |  | ||||||
|  | Player API | ||||||
|  | ---------- | ||||||
|  | The player API can register player models and update the player's appearence | ||||||
|  |  | ||||||
|  | default.player_register_model(name, def) | ||||||
|  | ^ Register a new model to be used by players. | ||||||
|  |  -> name: model filename such as "character.x", "foo.b3d", etc. | ||||||
|  |  -> def: See [#Model definition] | ||||||
|  |  | ||||||
|  | default.registered_player_models[name] | ||||||
|  | ^ Get a model's definition | ||||||
|  |  -> see [#Model definition] | ||||||
|  |  | ||||||
|  | default.player_set_model(player, model_name) | ||||||
|  | ^ Change a player's model | ||||||
|  |  -> player: PlayerRef | ||||||
|  |  -> model_name: model registered with player_register_model() | ||||||
|  |  | ||||||
|  | default.player_set_animation(player, anim_name [, speed]) | ||||||
|  | ^ Applies an animation to a player | ||||||
|  |  -> anim_name: name of the animation. | ||||||
|  |  -> speed: frames per second. If nil, default from the model is used | ||||||
|  |  | ||||||
|  | default.player_set_textures(player, textures) | ||||||
|  | ^ Sets player textures | ||||||
|  |  -> player: PlayerRef | ||||||
|  |  -> textures: array of textures | ||||||
|  |  ^ If <textures> is nil, the default textures from the model def are used | ||||||
|  |  | ||||||
|  | default.player_get_animation(player) | ||||||
|  | ^ Returns a table containing fields "model", "textures" and "animation". | ||||||
|  | ^ Any of the fields of the returned table may be nil. | ||||||
|  |  -> player: PlayerRef | ||||||
|  |  | ||||||
|  | Model Definition | ||||||
|  | ---------------- | ||||||
|  | { | ||||||
|  | 	animation_speed = 30, -- Default animation speed, in FPS. | ||||||
|  | 	textures = {"character.png", }, -- Default array of textures. | ||||||
|  | 	visual_size = {x=1, y=1,}, -- Used to scale the model. | ||||||
|  | 	animations = { | ||||||
|  | 		-- <anim_name> = { x=<start_frame>, y=<end_frame>, }, | ||||||
|  | 		foo = { x= 0, y=19, }, | ||||||
|  | 		bar = { x=20, y=39, }, | ||||||
|  | 		-- ... | ||||||
|  | 	}, | ||||||
|  | } | ||||||
|  |  | ||||||
|  | Leafdecay | ||||||
|  | --------- | ||||||
|  | To enable leaf decay for a node, add it to the "leafdecay" group. | ||||||
|  |  | ||||||
|  | The rating of the group determines how far from a node in the group "tree" | ||||||
|  | the node can be without decaying. | ||||||
|  |  | ||||||
|  | If param2 of the node is ~= 0, the node will always be preserved. Thus, if | ||||||
|  | the player places a node of that kind, you will want to set param2=1 or so. | ||||||
|  |  | ||||||
|  | The function default.after_place_leaves can be set as after_place_node of a node | ||||||
|  | to set param2 to 1 if the player places the node (should not be used for nodes | ||||||
|  | that use param2 otherwise (e.g. facedir)). | ||||||
|  |  | ||||||
|  | If the node is in the leafdecay_drop group then it will always be dropped as an | ||||||
|  | item. | ||||||
|  |  | ||||||
|  | Dyes | ||||||
|  | ---- | ||||||
|  | To make recipes that will work with any dye ever made by anybody, define | ||||||
|  | them based on groups. You can select any group of groups, based on your need for | ||||||
|  | amount of colors. | ||||||
|  |  | ||||||
|  | #Color groups | ||||||
|  | ------------- | ||||||
|  | Base color groups: | ||||||
|  | - basecolor_white | ||||||
|  | - basecolor_grey | ||||||
|  | - basecolor_black | ||||||
|  | - basecolor_red | ||||||
|  | - basecolor_yellow | ||||||
|  | - basecolor_green | ||||||
|  | - basecolor_cyan | ||||||
|  | - basecolor_blue | ||||||
|  | - basecolor_magenta | ||||||
|  |  | ||||||
|  | Extended color groups (* = equal to a base color): | ||||||
|  | * excolor_white | ||||||
|  | - excolor_lightgrey | ||||||
|  | * excolor_grey | ||||||
|  | - excolor_darkgrey | ||||||
|  | * excolor_black | ||||||
|  | * excolor_red | ||||||
|  | - excolor_orange | ||||||
|  | * excolor_yellow | ||||||
|  | - excolor_lime | ||||||
|  | * excolor_green | ||||||
|  | - excolor_aqua | ||||||
|  | * excolor_cyan | ||||||
|  | - excolor_sky_blue | ||||||
|  | * excolor_blue | ||||||
|  | - excolor_violet | ||||||
|  | * excolor_magenta | ||||||
|  | - excolor_red_violet | ||||||
|  |  | ||||||
|  | The whole unifieddyes palette as groups: | ||||||
|  | - unicolor_<excolor> | ||||||
|  | For the following, no white/grey/black is allowed: | ||||||
|  | - unicolor_medium_<excolor> | ||||||
|  | - unicolor_dark_<excolor> | ||||||
|  | - unicolor_light_<excolor> | ||||||
|  | - unicolor_<excolor>_s50 | ||||||
|  | - unicolor_medium_<excolor>_s50 | ||||||
|  | - unicolor_dark_<excolor>_s50 | ||||||
|  |  | ||||||
|  | Example of one shapeless recipe using a color group: | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "shapeless", | ||||||
|  | 	output = '<mod>:item_yellow', | ||||||
|  | 	recipe = {'<mod>:item_no_color', 'group:basecolor_yellow'}, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | #Color lists | ||||||
|  | ------------ | ||||||
|  | dye.basecolors | ||||||
|  | ^ Array containing the names of available base colors | ||||||
|  |  | ||||||
|  | dye.excolors | ||||||
|  | ^ Array containing the names of the available extended colors | ||||||
|  |  | ||||||
|  | Trees | ||||||
|  | ----- | ||||||
|  | default.grow_tree(pos, is_apple_tree) | ||||||
|  | ^ Grows a tree or apple tree at pos | ||||||
|  |  | ||||||
|  | default.grow_jungle_tree(pos) | ||||||
|  | ^ Grows a jungletree at pos | ||||||
|  |  | ||||||
|  | default.grow_pine_tree(pos) | ||||||
|  | ^ Grows a pinetree at pos | ||||||
							
								
								
									
										
											BIN
										
									
								
								menu/header.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 152 KiB | 
							
								
								
									
										
											BIN
										
									
								
								menu/icon.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 5.6 KiB | 
							
								
								
									
										3
									
								
								minetest.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,3 @@ | |||||||
|  | mg_flags = dungeons | ||||||
|  | mgv6_spflags = biomeblend, jungles | ||||||
|  |  | ||||||
							
								
								
									
										24
									
								
								minetest.conf.example
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,24 @@ | |||||||
|  | # This file contains settings of minetest_game that can be changed in | ||||||
|  | # minetest.conf | ||||||
|  | # | ||||||
|  | # By default, all the settings are commented and not functional. | ||||||
|  | # Uncomment settings by removing the preceding #. | ||||||
|  |  | ||||||
|  | # Whether creative mode (fast digging of all blocks, unlimited resources) should be enabled | ||||||
|  | #creative_mode = false | ||||||
|  |  | ||||||
|  | # The time in seconds after which the bones of a dead player can be looted by everyone | ||||||
|  | # 0 to disable | ||||||
|  | #share_bones_time = 1200 | ||||||
|  |  | ||||||
|  | # Whether fire should be disabled (all fire nodes will instantly disappear) | ||||||
|  | #disable_fire = false | ||||||
|  |  | ||||||
|  | # Whether steel tools, torches and cobblestone should be given to new players | ||||||
|  | #give_initial_stuff = false | ||||||
|  |  | ||||||
|  | # Whether the TNT mod should be enabled | ||||||
|  | #enable_tnt = <true in singleplayer, false in multiplayer> | ||||||
|  |  | ||||||
|  | # The radius of a TNT explosion | ||||||
|  | #tnt_radius = 3 | ||||||
							
								
								
									
										16
									
								
								mods/boats/README.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,16 @@ | |||||||
|  | Minetest 0.4 mod: boats | ||||||
|  | ======================= | ||||||
|  | by PilzAdam, slightly modified for NeXt | ||||||
|  |  | ||||||
|  | License of source code: | ||||||
|  | ----------------------- | ||||||
|  | WTFPL | ||||||
|  |  | ||||||
|  | License of media (textures and sounds): | ||||||
|  | --------------------------------------- | ||||||
|  | WTFPL | ||||||
|  |  | ||||||
|  | Authors of media files: | ||||||
|  | ----------------------- | ||||||
|  | textures: Zeg9 | ||||||
|  | model: thetoon and Zeg9, modified by PavelS(SokolovPavel) | ||||||
| @@ -1,2 +1 @@ | |||||||
| default | default | ||||||
| 
 |  | ||||||
							
								
								
									
										217
									
								
								mods/boats/init.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,217 @@ | |||||||
|  |  | ||||||
|  | -- | ||||||
|  | -- Helper functions | ||||||
|  | -- | ||||||
|  |  | ||||||
|  | local function is_water(pos) | ||||||
|  | 	local nn = minetest.get_node(pos).name | ||||||
|  | 	return minetest.get_item_group(nn, "water") ~= 0 | ||||||
|  | end | ||||||
|  |  | ||||||
|  | local function get_sign(i) | ||||||
|  | 	if i == 0 then | ||||||
|  | 		return 0 | ||||||
|  | 	else | ||||||
|  | 		return i / math.abs(i) | ||||||
|  | 	end | ||||||
|  | end | ||||||
|  |  | ||||||
|  | local function get_velocity(v, yaw, y) | ||||||
|  | 	local x = -math.sin(yaw) * v | ||||||
|  | 	local z =  math.cos(yaw) * v | ||||||
|  | 	return {x = x, y = y, z = z} | ||||||
|  | end | ||||||
|  |  | ||||||
|  | local function get_v(v) | ||||||
|  | 	return math.sqrt(v.x ^ 2 + v.z ^ 2) | ||||||
|  | end | ||||||
|  |  | ||||||
|  | -- | ||||||
|  | -- Boat entity | ||||||
|  | -- | ||||||
|  |  | ||||||
|  | local boat = { | ||||||
|  | 	physical = true, | ||||||
|  | 	collisionbox = {-0.5, -0.4, -0.5, 0.5, 0.3, 0.5}, | ||||||
|  | 	visual = "mesh", | ||||||
|  | 	mesh = "boat.x", | ||||||
|  | 	textures = {"default_wood.png"}, | ||||||
|  |  | ||||||
|  | 	driver = nil, | ||||||
|  | 	v = 0, | ||||||
|  | 	last_v = 0, | ||||||
|  | 	removed = false | ||||||
|  | } | ||||||
|  |  | ||||||
|  | function boat.on_rightclick(self, clicker) | ||||||
|  | 	if not clicker or not clicker:is_player() then | ||||||
|  | 		return | ||||||
|  | 	end | ||||||
|  | 	local name = clicker:get_player_name() | ||||||
|  | 	if self.driver and clicker == self.driver then | ||||||
|  | 		self.driver = nil | ||||||
|  | 		clicker:set_detach() | ||||||
|  | 		default.player_attached[name] = false | ||||||
|  | 		default.player_set_animation(clicker, "stand" , 30) | ||||||
|  | 	elseif not self.driver then | ||||||
|  | 		self.driver = clicker | ||||||
|  | 		clicker:set_attach(self.object, "", {x = 0, y = 11, z = -3}, {x = 0, y = 0, z = 0}) | ||||||
|  | 		default.player_attached[name] = true | ||||||
|  | 		minetest.after(0.2, function() | ||||||
|  | 			default.player_set_animation(clicker, "sit" , 30) | ||||||
|  | 		end) | ||||||
|  | 		self.object:setyaw(clicker:get_look_yaw() - math.pi / 2) | ||||||
|  | 	end | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function boat.on_activate(self, staticdata, dtime_s) | ||||||
|  | 	self.object:set_armor_groups({immortal = 1}) | ||||||
|  | 	if staticdata then | ||||||
|  | 		self.v = tonumber(staticdata) | ||||||
|  | 	end | ||||||
|  | 	self.last_v = self.v | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function boat.get_staticdata(self) | ||||||
|  | 	return tostring(self.v) | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function boat.on_punch(self, puncher, time_from_last_punch, tool_capabilities, direction) | ||||||
|  | 	if not puncher or not puncher:is_player() or self.removed then | ||||||
|  | 		return | ||||||
|  | 	end | ||||||
|  | 	if self.driver and puncher == self.driver then | ||||||
|  | 		self.driver = nil | ||||||
|  | 		puncher:set_detach() | ||||||
|  | 		default.player_attached[puncher:get_player_name()] = false | ||||||
|  | 	end | ||||||
|  | 	if not self.driver then | ||||||
|  | 		self.removed = true | ||||||
|  | 		-- delay remove to ensure player is detached | ||||||
|  | 		minetest.after(0.1, function() | ||||||
|  | 			self.object:remove() | ||||||
|  | 		end) | ||||||
|  | 		if not minetest.setting_getbool("creative_mode") then | ||||||
|  | 			puncher:get_inventory():add_item("main", "boats:boat") | ||||||
|  | 		end | ||||||
|  | 	end | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function boat.on_step(self, dtime) | ||||||
|  | 	self.v = get_v(self.object:getvelocity()) * get_sign(self.v) | ||||||
|  | 	if self.driver then | ||||||
|  | 		local ctrl = self.driver:get_player_control() | ||||||
|  | 		local yaw = self.object:getyaw() | ||||||
|  | 		if ctrl.up then | ||||||
|  | 			self.v = self.v + 0.1 | ||||||
|  | 		elseif ctrl.down then | ||||||
|  | 			self.v = self.v - 0.1 | ||||||
|  | 		end | ||||||
|  | 		if ctrl.left then | ||||||
|  | 			if self.v < 0 then | ||||||
|  | 				self.object:setyaw(yaw - (1 + dtime) * 0.03) | ||||||
|  | 			else | ||||||
|  | 				self.object:setyaw(yaw + (1 + dtime) * 0.03) | ||||||
|  | 			end | ||||||
|  | 		elseif ctrl.right then | ||||||
|  | 			if self.v < 0 then | ||||||
|  | 				self.object:setyaw(yaw + (1 + dtime) * 0.03) | ||||||
|  | 			else | ||||||
|  | 				self.object:setyaw(yaw - (1 + dtime) * 0.03) | ||||||
|  | 			end | ||||||
|  | 		end | ||||||
|  | 	end | ||||||
|  | 	local velo = self.object:getvelocity() | ||||||
|  | 	if self.v == 0 and velo.x == 0 and velo.y == 0 and velo.z == 0 then | ||||||
|  | 		self.object:setpos(self.object:getpos()) | ||||||
|  | 		return | ||||||
|  | 	end | ||||||
|  | 	local s = get_sign(self.v) | ||||||
|  | 	self.v = self.v - 0.02 * s | ||||||
|  | 	if s ~= get_sign(self.v) then | ||||||
|  | 		self.object:setvelocity({x = 0, y = 0, z = 0}) | ||||||
|  | 		self.v = 0 | ||||||
|  | 		return | ||||||
|  | 	end | ||||||
|  | 	if math.abs(self.v) > 4.5 then | ||||||
|  | 		self.v = 4.5 * get_sign(self.v) | ||||||
|  | 	end | ||||||
|  |  | ||||||
|  | 	local p = self.object:getpos() | ||||||
|  | 	p.y = p.y - 0.5 | ||||||
|  | 	local new_velo = {x = 0, y = 0, z = 0} | ||||||
|  | 	local new_acce = {x = 0, y = 0, z = 0} | ||||||
|  | 	if not is_water(p) then | ||||||
|  | 		local nodedef = minetest.registered_nodes[minetest.get_node(p).name] | ||||||
|  | 		if (not nodedef) or nodedef.walkable then | ||||||
|  | 			self.v = 0 | ||||||
|  | 			new_acce = {x = 0, y = 1, z = 0} | ||||||
|  | 		else | ||||||
|  | 			new_acce = {x = 0, y = -9.8, z = 0} | ||||||
|  | 		end | ||||||
|  | 		new_velo = get_velocity(self.v, self.object:getyaw(), self.object:getvelocity().y) | ||||||
|  | 		self.object:setpos(self.object:getpos()) | ||||||
|  | 	else | ||||||
|  | 		p.y = p.y + 1 | ||||||
|  | 		if is_water(p) then | ||||||
|  | 			local y = self.object:getvelocity().y | ||||||
|  | 			if y >= 4.5 then | ||||||
|  | 				y = 4.5 | ||||||
|  | 			elseif y < 0 then | ||||||
|  | 				new_acce = {x = 0, y = 20, z = 0} | ||||||
|  | 			else | ||||||
|  | 				new_acce = {x = 0, y = 5, z = 0} | ||||||
|  | 			end | ||||||
|  | 			new_velo = get_velocity(self.v, self.object:getyaw(), y) | ||||||
|  | 			self.object:setpos(self.object:getpos()) | ||||||
|  | 		else | ||||||
|  | 			new_acce = {x = 0, y = 0, z = 0} | ||||||
|  | 			if math.abs(self.object:getvelocity().y) < 1 then | ||||||
|  | 				local pos = self.object:getpos() | ||||||
|  | 				pos.y = math.floor(pos.y) + 0.5 | ||||||
|  | 				self.object:setpos(pos) | ||||||
|  | 				new_velo = get_velocity(self.v, self.object:getyaw(), 0) | ||||||
|  | 			else | ||||||
|  | 				new_velo = get_velocity(self.v, self.object:getyaw(), self.object:getvelocity().y) | ||||||
|  | 				self.object:setpos(self.object:getpos()) | ||||||
|  | 			end | ||||||
|  | 		end | ||||||
|  | 	end | ||||||
|  | 	self.object:setvelocity(new_velo) | ||||||
|  | 	self.object:setacceleration(new_acce) | ||||||
|  | end | ||||||
|  |  | ||||||
|  | minetest.register_entity("boats:boat", boat) | ||||||
|  |  | ||||||
|  | minetest.register_craftitem("boats:boat", { | ||||||
|  | 	description = "Boat", | ||||||
|  | 	inventory_image = "boat_inventory.png", | ||||||
|  | 	wield_image = "boat_wield.png", | ||||||
|  | 	wield_scale = {x = 2, y = 2, z = 1}, | ||||||
|  | 	liquids_pointable = true, | ||||||
|  |  | ||||||
|  | 	on_place = function(itemstack, placer, pointed_thing) | ||||||
|  | 		if pointed_thing.type ~= "node" then | ||||||
|  | 			return | ||||||
|  | 		end | ||||||
|  | 		if not is_water(pointed_thing.under) then | ||||||
|  | 			return | ||||||
|  | 		end | ||||||
|  | 		pointed_thing.under.y = pointed_thing.under.y + 0.5 | ||||||
|  | 		minetest.add_entity(pointed_thing.under, "boats:boat") | ||||||
|  | 		if not minetest.setting_getbool("creative_mode") then | ||||||
|  | 			itemstack:take_item() | ||||||
|  | 		end | ||||||
|  | 		return itemstack | ||||||
|  | 	end, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = "boats:boat", | ||||||
|  | 	recipe = { | ||||||
|  | 		{"",           "",           ""          }, | ||||||
|  | 		{"group:wood", "",           "group:wood"}, | ||||||
|  | 		{"group:wood", "group:wood", "group:wood"}, | ||||||
|  | 	}, | ||||||
|  | }) | ||||||
|  |  | ||||||
							
								
								
									
										11110
									
								
								mods/boats/models/boat.x
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								mods/boats/textures/boat_inventory.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 1.4 KiB | 
							
								
								
									
										
											BIN
										
									
								
								mods/boats/textures/boat_wield.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 847 B | 
							
								
								
									
										17
									
								
								mods/bones/README.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,17 @@ | |||||||
|  | Minetest 0.4 mod: bones | ||||||
|  | ======================= | ||||||
|  |  | ||||||
|  | License of source code: | ||||||
|  | ----------------------- | ||||||
|  | Copyright (C) 2012 PilzAdam | ||||||
|  |  | ||||||
|  | WTFPL | ||||||
|  |  | ||||||
|  | License of media (textures and sounds) | ||||||
|  | -------------------------------------- | ||||||
|  | Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) | ||||||
|  | http://creativecommons.org/licenses/by-sa/3.0/ | ||||||
|  |  | ||||||
|  | Authors of media files | ||||||
|  | ---------------------- | ||||||
|  | Bad_Command_ | ||||||
							
								
								
									
										1
									
								
								mods/bones/depends.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1 @@ | |||||||
|  | default | ||||||
							
								
								
									
										219
									
								
								mods/bones/init.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,219 @@ | |||||||
|  | -- Minetest 0.4 mod: bones | ||||||
|  | -- See README.txt for licensing and other information.  | ||||||
|  |  | ||||||
|  | bones = {} | ||||||
|  |  | ||||||
|  | local function is_owner(pos, name) | ||||||
|  | 	local owner = minetest.get_meta(pos):get_string("owner") | ||||||
|  | 	if owner == "" or owner == name then | ||||||
|  | 		return true | ||||||
|  | 	end | ||||||
|  | 	return false | ||||||
|  | end | ||||||
|  |  | ||||||
|  | bones.bones_formspec = | ||||||
|  | 	"size[8,9]".. | ||||||
|  | 	default.gui_bg.. | ||||||
|  | 	default.gui_bg_img.. | ||||||
|  | 	default.gui_slots.. | ||||||
|  | 	"list[current_name;main;0,0.3;8,4;]".. | ||||||
|  | 	"list[current_player;main;0,4.85;8,1;]".. | ||||||
|  | 	"list[current_player;main;0,6.08;8,3;8]".. | ||||||
|  | 	default.get_hotbar_bg(0,4.85) | ||||||
|  |  | ||||||
|  | local share_bones_time = tonumber(minetest.setting_get("share_bones_time") or 1200) | ||||||
|  | local share_bones_time_early = tonumber(minetest.setting_get("share_bones_time_early") or (share_bones_time/4)) | ||||||
|  |  | ||||||
|  | minetest.register_node("bones:bones", { | ||||||
|  | 	description = "Bones", | ||||||
|  | 	tiles = { | ||||||
|  | 		"bones_top.png", | ||||||
|  | 		"bones_bottom.png", | ||||||
|  | 		"bones_side.png", | ||||||
|  | 		"bones_side.png", | ||||||
|  | 		"bones_rear.png", | ||||||
|  | 		"bones_front.png" | ||||||
|  | 	}, | ||||||
|  | 	paramtype2 = "facedir", | ||||||
|  | 	groups = {dig_immediate=2}, | ||||||
|  | 	sounds = default.node_sound_dirt_defaults({ | ||||||
|  | 		footstep = {name="default_gravel_footstep", gain=0.5}, | ||||||
|  | 		dug = {name="default_gravel_footstep", gain=1.0}, | ||||||
|  | 	}), | ||||||
|  | 	 | ||||||
|  | 	can_dig = function(pos, player) | ||||||
|  | 		local inv = minetest.get_meta(pos):get_inventory() | ||||||
|  | 		return is_owner(pos, player:get_player_name()) and inv:is_empty("main") | ||||||
|  | 	end, | ||||||
|  | 	 | ||||||
|  | 	allow_metadata_inventory_move = function(pos, from_list, from_index, to_list, to_index, count, player) | ||||||
|  | 		if is_owner(pos, player:get_player_name()) then | ||||||
|  | 			return count | ||||||
|  | 		end | ||||||
|  | 		return 0 | ||||||
|  | 	end, | ||||||
|  | 	 | ||||||
|  | 	allow_metadata_inventory_put = function(pos, listname, index, stack, player) | ||||||
|  | 		return 0 | ||||||
|  | 	end, | ||||||
|  | 	 | ||||||
|  | 	allow_metadata_inventory_take = function(pos, listname, index, stack, player) | ||||||
|  | 		if is_owner(pos, player:get_player_name()) then | ||||||
|  | 			return stack:get_count() | ||||||
|  | 		end | ||||||
|  | 		return 0 | ||||||
|  | 	end, | ||||||
|  | 	 | ||||||
|  | 	on_metadata_inventory_take = function(pos, listname, index, stack, player) | ||||||
|  | 		local meta = minetest.get_meta(pos) | ||||||
|  | 		if meta:get_inventory():is_empty("main") then | ||||||
|  | 			minetest.remove_node(pos) | ||||||
|  | 		end | ||||||
|  | 	end, | ||||||
|  | 	 | ||||||
|  | 	on_punch = function(pos, node, player) | ||||||
|  | 		if(not is_owner(pos, player:get_player_name())) then | ||||||
|  | 			return | ||||||
|  | 		end | ||||||
|  | 		 | ||||||
|  | 		local inv = minetest.get_meta(pos):get_inventory() | ||||||
|  | 		local player_inv = player:get_inventory() | ||||||
|  | 		local has_space = true | ||||||
|  | 		 | ||||||
|  | 		for i=1,inv:get_size("main") do | ||||||
|  | 			local stk = inv:get_stack("main", i) | ||||||
|  | 			if player_inv:room_for_item("main", stk) then | ||||||
|  | 				inv:set_stack("main", i, nil) | ||||||
|  | 				player_inv:add_item("main", stk) | ||||||
|  | 			else | ||||||
|  | 				has_space = false | ||||||
|  | 				break | ||||||
|  | 			end | ||||||
|  | 		end | ||||||
|  | 		 | ||||||
|  | 		-- remove bones if player emptied them | ||||||
|  | 		if has_space then | ||||||
|  | 			minetest.remove_node(pos) | ||||||
|  | 		end | ||||||
|  | 	end, | ||||||
|  | 	 | ||||||
|  | 	on_timer = function(pos, elapsed) | ||||||
|  | 		local meta = minetest.get_meta(pos) | ||||||
|  | 		local time = meta:get_int("time") + elapsed | ||||||
|  | 		if time >= share_bones_time then | ||||||
|  | 			meta:set_string("infotext", meta:get_string("owner").."'s old bones") | ||||||
|  | 			meta:set_string("owner", "") | ||||||
|  | 		else | ||||||
|  | 			meta:set_int("time", time) | ||||||
|  | 			return true | ||||||
|  | 		end | ||||||
|  | 	end, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | local function may_replace(pos, player) | ||||||
|  | 	local node_name = minetest.get_node(pos).name | ||||||
|  | 	local node_definition = minetest.registered_nodes[node_name] | ||||||
|  |  | ||||||
|  | 	-- if the node is unknown, we let the protection mod decide | ||||||
|  | 	-- this is consistent with when a player could dig or not dig it | ||||||
|  | 	-- unknown decoration would often be removed | ||||||
|  | 	-- while unknown building materials in use would usually be left | ||||||
|  | 	if not node_definition then | ||||||
|  | 		-- only replace nodes that are not protected | ||||||
|  | 		return not minetest.is_protected(pos, player:get_player_name()) | ||||||
|  | 	end | ||||||
|  |  | ||||||
|  | 	-- allow replacing air and liquids | ||||||
|  | 	if node_name == "air" or node_definition.liquidtype ~= "none" then | ||||||
|  | 		return true | ||||||
|  | 	end | ||||||
|  |  | ||||||
|  | 	-- don't replace filled chests and other nodes that don't allow it | ||||||
|  | 	local can_dig_func = node_definition.can_dig | ||||||
|  | 	if can_dig_func and not can_dig_func(pos, player) then | ||||||
|  | 		return false | ||||||
|  | 	end | ||||||
|  |  | ||||||
|  | 	-- default to each nodes buildable_to; if a placed block would replace it, why shouldn't bones? | ||||||
|  | 	-- flowers being squished by bones are more realistical than a squished stone, too | ||||||
|  | 	-- exception are of course any protected buildable_to | ||||||
|  | 	return node_definition.buildable_to and not minetest.is_protected(pos, player:get_player_name()) | ||||||
|  | end | ||||||
|  |  | ||||||
|  | minetest.register_on_dieplayer(function(player) | ||||||
|  | 	if minetest.setting_getbool("creative_mode") then | ||||||
|  | 		return | ||||||
|  | 	end | ||||||
|  | 	 | ||||||
|  | 	local player_inv = player:get_inventory() | ||||||
|  | 	if player_inv:is_empty("main") and | ||||||
|  | 		player_inv:is_empty("craft") then | ||||||
|  | 		return | ||||||
|  | 	end | ||||||
|  |  | ||||||
|  | 	local pos = player:getpos() | ||||||
|  | 	pos.x = math.floor(pos.x+0.5) | ||||||
|  | 	pos.y = math.floor(pos.y+0.5) | ||||||
|  | 	pos.z = math.floor(pos.z+0.5) | ||||||
|  | 	local param2 = minetest.dir_to_facedir(player:get_look_dir()) | ||||||
|  | 	local player_name = player:get_player_name() | ||||||
|  | 	local player_inv = player:get_inventory() | ||||||
|  |  | ||||||
|  | 	if (not may_replace(pos, player)) then | ||||||
|  | 		if (may_replace({x=pos.x, y=pos.y+1, z=pos.z}, player)) then | ||||||
|  | 			-- drop one node above if there's space | ||||||
|  | 			-- this should solve most cases of protection related deaths in which players dig straight down | ||||||
|  | 			-- yet keeps the bones reachable | ||||||
|  | 			pos.y = pos.y+1 | ||||||
|  | 		else | ||||||
|  | 			-- drop items instead of delete | ||||||
|  | 			for i=1,player_inv:get_size("main") do | ||||||
|  | 				minetest.add_item(pos, player_inv:get_stack("main", i)) | ||||||
|  | 			end | ||||||
|  | 			for i=1,player_inv:get_size("craft") do | ||||||
|  | 				minetest.add_item(pos, player_inv:get_stack("craft", i)) | ||||||
|  | 			end | ||||||
|  | 			-- empty lists main and craft | ||||||
|  | 			player_inv:set_list("main", {}) | ||||||
|  | 			player_inv:set_list("craft", {}) | ||||||
|  | 			return | ||||||
|  | 		end | ||||||
|  | 	end | ||||||
|  | 	 | ||||||
|  | 	minetest.set_node(pos, {name="bones:bones", param2=param2}) | ||||||
|  | 	 | ||||||
|  | 	local meta = minetest.get_meta(pos) | ||||||
|  | 	local inv = meta:get_inventory() | ||||||
|  | 	inv:set_size("main", 8*4) | ||||||
|  | 	inv:set_list("main", player_inv:get_list("main")) | ||||||
|  | 	 | ||||||
|  | 	for i=1,player_inv:get_size("craft") do | ||||||
|  | 		local stack = player_inv:get_stack("craft", i) | ||||||
|  | 		if inv:room_for_item("main", stack) then | ||||||
|  | 			inv:add_item("main", stack) | ||||||
|  | 		else | ||||||
|  | 			--drop if no space left | ||||||
|  | 			minetest.add_item(pos, stack) | ||||||
|  | 		end | ||||||
|  | 	end | ||||||
|  | 	 | ||||||
|  | 	player_inv:set_list("main", {}) | ||||||
|  | 	player_inv:set_list("craft", {}) | ||||||
|  | 	 | ||||||
|  | 	meta:set_string("formspec", bones.bones_formspec) | ||||||
|  | 	meta:set_string("owner", player_name) | ||||||
|  | 	 | ||||||
|  | 	if share_bones_time ~= 0 then | ||||||
|  | 		meta:set_string("infotext", player_name.."'s fresh bones") | ||||||
|  |  | ||||||
|  | 		if share_bones_time_early == 0 or not minetest.is_protected(pos, player_name) then | ||||||
|  | 			meta:set_int("time", 0) | ||||||
|  | 		else | ||||||
|  | 			meta:set_int("time", (share_bones_time - share_bones_time_early)) | ||||||
|  | 		end | ||||||
|  |  | ||||||
|  | 		minetest.get_node_timer(pos):start(10) | ||||||
|  | 	else | ||||||
|  | 		meta:set_string("infotext", player_name.."'s bones") | ||||||
|  | 	end | ||||||
|  | end) | ||||||
							
								
								
									
										
											BIN
										
									
								
								mods/bones/textures/bones_bottom.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 181 B | 
							
								
								
									
										
											BIN
										
									
								
								mods/bones/textures/bones_front.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 183 B | 
							
								
								
									
										
											BIN
										
									
								
								mods/bones/textures/bones_rear.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 187 B | 
							
								
								
									
										
											BIN
										
									
								
								mods/bones/textures/bones_side.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 188 B | 
							
								
								
									
										
											BIN
										
									
								
								mods/bones/textures/bones_top.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 182 B | 
| @@ -16,13 +16,26 @@ minetest.register_craft({ | |||||||
| bucket = {} | bucket = {} | ||||||
| bucket.liquids = {} | bucket.liquids = {} | ||||||
|  |  | ||||||
|  | local function check_protection(pos, name, text) | ||||||
|  | 	if minetest.is_protected(pos, name) then | ||||||
|  | 		minetest.log("action", (name ~= "" and name or "A mod") | ||||||
|  | 			.. " tried to " .. text | ||||||
|  | 			.. " at protected position " | ||||||
|  | 			.. minetest.pos_to_string(pos) | ||||||
|  | 			.. " with a bucket") | ||||||
|  | 		minetest.record_protection_violation(pos, name) | ||||||
|  | 		return true | ||||||
|  | 	end | ||||||
|  | 	return false | ||||||
|  | end | ||||||
|  |  | ||||||
| -- Register a new liquid | -- Register a new liquid | ||||||
| --   source = name of the source node | --   source = name of the source node | ||||||
| --   flowing = name of the flowing node | --   flowing = name of the flowing node | ||||||
| --   itemname = name of the new bucket item (or nil if liquid is not takeable) | --   itemname = name of the new bucket item (or nil if liquid is not takeable) | ||||||
| --   inventory_image = texture of the new bucket item (ignored if itemname == nil) | --   inventory_image = texture of the new bucket item (ignored if itemname == nil) | ||||||
| -- This function can be called from any mod (that depends on bucket). | -- This function can be called from any mod (that depends on bucket). | ||||||
| function bucket.register_liquid(source, flowing, itemname, inventory_image) | function bucket.register_liquid(source, flowing, itemname, inventory_image, name) | ||||||
| 	bucket.liquids[source] = { | 	bucket.liquids[source] = { | ||||||
| 		source = source, | 		source = source, | ||||||
| 		flowing = flowing, | 		flowing = flowing, | ||||||
| @@ -32,25 +45,52 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image) | |||||||
|  |  | ||||||
| 	if itemname ~= nil then | 	if itemname ~= nil then | ||||||
| 		minetest.register_craftitem(itemname, { | 		minetest.register_craftitem(itemname, { | ||||||
|  | 			description = name, | ||||||
| 			inventory_image = inventory_image, | 			inventory_image = inventory_image, | ||||||
| 			stack_max = 1, | 			stack_max = 1, | ||||||
| 			liquids_pointable = true, | 			liquids_pointable = true, | ||||||
| 			on_use = function(itemstack, user, pointed_thing) | 			on_place = function(itemstack, user, pointed_thing) | ||||||
| 				-- Must be pointing to node | 				-- Must be pointing to node | ||||||
| 				if pointed_thing.type ~= "node" then | 				if pointed_thing.type ~= "node" then | ||||||
| 					return | 					return | ||||||
| 				end | 				end | ||||||
|  | 				 | ||||||
|  | 				local node = minetest.get_node_or_nil(pointed_thing.under) | ||||||
|  | 				local ndef | ||||||
|  | 				if node then | ||||||
|  | 					ndef = minetest.registered_nodes[node.name] | ||||||
|  | 				end | ||||||
|  | 				-- Call on_rightclick if the pointed node defines it | ||||||
|  | 				if ndef and ndef.on_rightclick and | ||||||
|  | 				   user and not user:get_player_control().sneak then | ||||||
|  | 					return ndef.on_rightclick( | ||||||
|  | 						pointed_thing.under, | ||||||
|  | 						node, user, | ||||||
|  | 						itemstack) or itemstack | ||||||
|  | 				end | ||||||
|  |  | ||||||
|  | 				local place_liquid = function(pos, node, source, flowing) | ||||||
|  | 					if check_protection(pos, | ||||||
|  | 							user and user:get_player_name() or "", | ||||||
|  | 							"place "..source) then | ||||||
|  | 						return | ||||||
|  | 					end | ||||||
|  | 					minetest.add_node(pos, {name=source}) | ||||||
|  | 				end | ||||||
|  |  | ||||||
| 				-- Check if pointing to a buildable node | 				-- Check if pointing to a buildable node | ||||||
| 				n = minetest.env:get_node(pointed_thing.under) | 				if ndef and ndef.buildable_to then | ||||||
| 				if minetest.registered_nodes[n.name].buildable_to then |  | ||||||
| 					-- buildable; replace the node | 					-- buildable; replace the node | ||||||
| 					minetest.env:add_node(pointed_thing.under, {name=source}) | 					place_liquid(pointed_thing.under, node, | ||||||
|  | 							source, flowing) | ||||||
| 				else | 				else | ||||||
| 					-- not buildable to; place the liquid above | 					-- not buildable to; place the liquid above | ||||||
| 					-- check if the node above can be replaced | 					-- check if the node above can be replaced | ||||||
| 					n = minetest.env:get_node(pointed_thing.above) | 					local node = minetest.get_node_or_nil(pointed_thing.above) | ||||||
| 					if minetest.registered_nodes[n.name].buildable_to then | 					if node and minetest.registered_nodes[node.name].buildable_to then | ||||||
| 						minetest.env:add_node(pointed_thing.above,{name=source}) | 						place_liquid(pointed_thing.above, | ||||||
|  | 								node, source, | ||||||
|  | 								flowing) | ||||||
| 					else | 					else | ||||||
| 						-- do not remove the bucket with the liquid | 						-- do not remove the bucket with the liquid | ||||||
| 						return | 						return | ||||||
| @@ -73,11 +113,19 @@ minetest.register_craftitem("bucket:bucket_empty", { | |||||||
| 			return | 			return | ||||||
| 		end | 		end | ||||||
| 		-- Check if pointing to a liquid source | 		-- Check if pointing to a liquid source | ||||||
| 		n = minetest.env:get_node(pointed_thing.under) | 		local node = minetest.get_node(pointed_thing.under) | ||||||
| 		liquiddef = bucket.liquids[n.name] | 		local liquiddef = bucket.liquids[node.name] | ||||||
| 		if liquiddef ~= nil and liquiddef.source == n.name and liquiddef.itemname ~= nil then | 		if liquiddef ~= nil and liquiddef.itemname ~= nil and | ||||||
| 			minetest.env:add_node(pointed_thing.under, {name="air"}) | 				node.name == liquiddef.source then | ||||||
| 			return {name=liquiddef.itemname} | 			if check_protection(pointed_thing.under, | ||||||
|  | 					user:get_player_name(), | ||||||
|  | 					"take ".. node.name) then | ||||||
|  | 				return | ||||||
|  | 			end | ||||||
|  |  | ||||||
|  | 			minetest.add_node(pointed_thing.under, {name="air"}) | ||||||
|  |  | ||||||
|  | 			return ItemStack(liquiddef.itemname) | ||||||
| 		end | 		end | ||||||
| 	end, | 	end, | ||||||
| }) | }) | ||||||
| @@ -86,18 +134,21 @@ bucket.register_liquid( | |||||||
| 	"default:water_source", | 	"default:water_source", | ||||||
| 	"default:water_flowing", | 	"default:water_flowing", | ||||||
| 	"bucket:bucket_water", | 	"bucket:bucket_water", | ||||||
| 	"bucket_water.png" | 	"bucket_water.png", | ||||||
|  | 	"Water Bucket" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| bucket.register_liquid( | bucket.register_liquid( | ||||||
| 	"default:lava_source", | 	"default:lava_source", | ||||||
| 	"default:lava_flowing", | 	"default:lava_flowing", | ||||||
| 	"bucket:bucket_lava", | 	"bucket:bucket_lava", | ||||||
| 	"bucket_lava.png" | 	"bucket_lava.png", | ||||||
|  | 	"Lava Bucket" | ||||||
| ) | ) | ||||||
|  |  | ||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	type = "fuel", | 	type = "fuel", | ||||||
| 	recipe = "bucket:bucket_lava", | 	recipe = "bucket:bucket_lava", | ||||||
| 	burntime = 60, | 	burntime = 60, | ||||||
|  | 	replacements = {{"bucket:bucket_lava", "bucket:bucket_empty"}}, | ||||||
| }) | }) | ||||||
|   | |||||||
| Before Width: | Height: | Size: 329 B After Width: | Height: | Size: 163 B | 
| Before Width: | Height: | Size: 363 B After Width: | Height: | Size: 167 B | 
| Before Width: | Height: | Size: 369 B After Width: | Height: | Size: 169 B | 
							
								
								
									
										1
									
								
								mods/creative/depends.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1 @@ | |||||||
|  | default | ||||||
| @@ -1,6 +1,6 @@ | |||||||
| -- minetest/creative/init.lua | -- minetest/creative/init.lua | ||||||
|  |  | ||||||
| local creative_inventory = {} | creative_inventory = {} | ||||||
| creative_inventory.creative_inventory_size = 0 | creative_inventory.creative_inventory_size = 0 | ||||||
|  |  | ||||||
| -- Create detached creative inventory after loading all mods | -- Create detached creative inventory after loading all mods | ||||||
| @@ -28,9 +28,10 @@ minetest.after(0, function() | |||||||
| 		on_put = function(inv, listname, index, stack, player) | 		on_put = function(inv, listname, index, stack, player) | ||||||
| 		end, | 		end, | ||||||
| 		on_take = function(inv, listname, index, stack, player) | 		on_take = function(inv, listname, index, stack, player) | ||||||
| 			print(player:get_player_name().." takes item from creative inventory; listname="..dump(listname)..", index="..dump(index)..", stack="..dump(stack)) | 			--print(player:get_player_name().." takes item from creative inventory; listname="..dump(listname)..", index="..dump(index)..", stack="..dump(stack)) | ||||||
| 			if stack then | 			if stack then | ||||||
| 				print("stack:get_name()="..dump(stack:get_name())..", stack:get_count()="..dump(stack:get_count())) | 				minetest.log("action", player:get_player_name().." takes "..dump(stack:get_name()).." from creative inventory") | ||||||
|  | 				--print("stack:get_name()="..dump(stack:get_name())..", stack:get_count()="..dump(stack:get_count())) | ||||||
| 			end | 			end | ||||||
| 		end, | 		end, | ||||||
| 	}) | 	}) | ||||||
| @@ -44,18 +45,10 @@ minetest.after(0, function() | |||||||
| 	table.sort(creative_list) | 	table.sort(creative_list) | ||||||
| 	inv:set_size("main", #creative_list) | 	inv:set_size("main", #creative_list) | ||||||
| 	for _,itemstring in ipairs(creative_list) do | 	for _,itemstring in ipairs(creative_list) do | ||||||
| 		local stack = ItemStack(itemstring) | 		inv:add_item("main", ItemStack(itemstring)) | ||||||
| 		-- Make a stack of the right number of items |  | ||||||
| 		local stack2 = nil |  | ||||||
| 		if stack:get_stack_max() == 1 then |  | ||||||
| 			stack2 = ItemStack(stack:get_name()) |  | ||||||
| 		else |  | ||||||
| 			stack2 = ItemStack(stack:get_name().." "..stack:get_stack_max()) |  | ||||||
| 		end |  | ||||||
| 		inv:add_item("main", stack2) |  | ||||||
| 	end | 	end | ||||||
| 	creative_inventory.creative_inventory_size = #creative_list | 	creative_inventory.creative_inventory_size = #creative_list | ||||||
| 	print("creative inventory size: "..dump(creative_inventory.creative_inventory_size)) | 	--print("creative inventory size: "..dump(creative_inventory.creative_inventory_size)) | ||||||
| end) | end) | ||||||
|  |  | ||||||
| -- Create the trash field | -- Create the trash field | ||||||
| @@ -79,17 +72,25 @@ trash:set_size("main", 1) | |||||||
| creative_inventory.set_creative_formspec = function(player, start_i, pagenum) | creative_inventory.set_creative_formspec = function(player, start_i, pagenum) | ||||||
| 	pagenum = math.floor(pagenum) | 	pagenum = math.floor(pagenum) | ||||||
| 	local pagemax = math.floor((creative_inventory.creative_inventory_size-1) / (6*4) + 1) | 	local pagemax = math.floor((creative_inventory.creative_inventory_size-1) / (6*4) + 1) | ||||||
| 	player:set_inventory_formspec("size[13,7.5]".. | 	player:set_inventory_formspec( | ||||||
|  | 			"size[13,7.5]".. | ||||||
| 			--"image[6,0.6;1,2;player.png]".. | 			--"image[6,0.6;1,2;player.png]".. | ||||||
| 			"list[current_player;main;5,3.5;8,4;]".. | 			default.gui_bg.. | ||||||
|  | 			default.gui_bg_img.. | ||||||
|  | 			default.gui_slots.. | ||||||
|  | 			"list[current_player;main;5,3.5;8,1;]".. | ||||||
|  | 			"list[current_player;main;5,4.75;8,3;8]".. | ||||||
| 			"list[current_player;craft;8,0;3,3;]".. | 			"list[current_player;craft;8,0;3,3;]".. | ||||||
| 			"list[current_player;craftpreview;12,1;1,1;]".. | 			"list[current_player;craftpreview;12,1;1,1;]".. | ||||||
|  | 			"image[11,1;1,1;gui_furnace_arrow_bg.png^[transformR270]".. | ||||||
| 			"list[detached:creative;main;0.3,0.5;4,6;"..tostring(start_i).."]".. | 			"list[detached:creative;main;0.3,0.5;4,6;"..tostring(start_i).."]".. | ||||||
| 			"label[2.0,6.55;"..tostring(pagenum).."/"..tostring(pagemax).."]".. | 			"label[2.0,6.55;"..tostring(pagenum).."/"..tostring(pagemax).."]".. | ||||||
| 			"button[0.3,6.5;1.6,1;creative_prev;<<]".. | 			"button[0.3,6.5;1.6,1;creative_prev;<<]".. | ||||||
| 			"button[2.7,6.5;1.6,1;creative_next;>>]".. | 			"button[2.7,6.5;1.6,1;creative_next;>>]".. | ||||||
| 			"label[5,1.5;Trash:]".. | 			"label[5,1.5;Trash:]".. | ||||||
| 			"list[detached:creative_trash;main;5,2;1,1;]") | 			"list[detached:creative_trash;main;5,2;1,1;]".. | ||||||
|  | 			default.get_hotbar_bg(5,3.5) | ||||||
|  | 	) | ||||||
| end | end | ||||||
| minetest.register_on_joinplayer(function(player) | minetest.register_on_joinplayer(function(player) | ||||||
| 	-- If in creative mode, modify player's inventory forms | 	-- If in creative mode, modify player's inventory forms | ||||||
| @@ -129,3 +130,44 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) | |||||||
| 	creative_inventory.set_creative_formspec(player, start_i, start_i / (6*4) + 1) | 	creative_inventory.set_creative_formspec(player, start_i, start_i / (6*4) + 1) | ||||||
| end) | end) | ||||||
|  |  | ||||||
|  | if minetest.setting_getbool("creative_mode") then | ||||||
|  | 	local digtime = 0.5 | ||||||
|  | 	minetest.register_item(":", { | ||||||
|  | 		type = "none", | ||||||
|  | 		wield_image = "wieldhand.png", | ||||||
|  | 		wield_scale = {x=1,y=1,z=2.5}, | ||||||
|  | 		range = 10, | ||||||
|  | 		tool_capabilities = { | ||||||
|  | 			full_punch_interval = 0.5, | ||||||
|  | 			max_drop_level = 3, | ||||||
|  | 			groupcaps = { | ||||||
|  | 				crumbly = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3}, | ||||||
|  | 				cracky = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3}, | ||||||
|  | 				snappy = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3}, | ||||||
|  | 				choppy = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3}, | ||||||
|  | 				oddly_breakable_by_hand = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3}, | ||||||
|  | 			}, | ||||||
|  | 			damage_groups = {fleshy = 10}, | ||||||
|  | 		} | ||||||
|  | 	}) | ||||||
|  | 	 | ||||||
|  | 	minetest.register_on_placenode(function(pos, newnode, placer, oldnode, itemstack) | ||||||
|  | 		return true | ||||||
|  | 	end) | ||||||
|  | 	 | ||||||
|  | 	function minetest.handle_node_drops(pos, drops, digger) | ||||||
|  | 		if not digger or not digger:is_player() then | ||||||
|  | 			return | ||||||
|  | 		end | ||||||
|  | 		local inv = digger:get_inventory() | ||||||
|  | 		if inv then | ||||||
|  | 			for _,item in ipairs(drops) do | ||||||
|  | 				item = ItemStack(item):get_name() | ||||||
|  | 				if not inv:contains_item("main", item) then | ||||||
|  | 					inv:add_item("main", item) | ||||||
|  | 				end | ||||||
|  | 			end | ||||||
|  | 		end | ||||||
|  | 	end | ||||||
|  | 	 | ||||||
|  | end | ||||||
|   | |||||||
| @@ -14,7 +14,7 @@ http://www.gnu.org/licenses/lgpl-2.1.html | |||||||
|  |  | ||||||
| License of media (textures and sounds) | License of media (textures and sounds) | ||||||
| -------------------------------------- | -------------------------------------- | ||||||
| Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0)                                  | Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) | ||||||
| http://creativecommons.org/licenses/by-sa/3.0/ | http://creativecommons.org/licenses/by-sa/3.0/ | ||||||
|  |  | ||||||
| Authors of media files | Authors of media files | ||||||
| @@ -22,41 +22,22 @@ Authors of media files | |||||||
| Everything not listed in here: | Everything not listed in here: | ||||||
| Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com> | Copyright (C) 2010-2012 celeron55, Perttu Ahola <celeron55@gmail.com> | ||||||
|  |  | ||||||
| Originating from work by kddekadenz/Dogers: |  | ||||||
|   default_grass_footstep.{1,2,3}.ogg |  | ||||||
|   default_dig_crumbly.{1,2}.ogg |  | ||||||
|  |  | ||||||
| Cisoun's WTFPL texture pack: | Cisoun's WTFPL texture pack: | ||||||
|   default_chest_front.png |  | ||||||
|   default_chest_lock.png |  | ||||||
|   default_chest_side.png |  | ||||||
|   default_chest_top.png |  | ||||||
|   default_cobble.png |  | ||||||
|   default_dirt.png |  | ||||||
|   default_grass.png |  | ||||||
|   default_grass_side.png |  | ||||||
|   default_jungletree.png |   default_jungletree.png | ||||||
|   default_jungletree_top.png |   default_jungletree_top.png | ||||||
|   default_lava.png |   default_lava.png | ||||||
|   default_leaves.png |   default_leaves.png | ||||||
|   default_mossycobble.png |  | ||||||
|   default_sand.png |  | ||||||
|   default_sapling.png |   default_sapling.png | ||||||
|   default_sign_wall.png |   default_sign_wall.png | ||||||
|   default_stone.png |   default_stone.png | ||||||
|   default_tool_mesepick.png |  | ||||||
|   default_tool_steelpick.png |  | ||||||
|   default_tool_steelshovel.png |  | ||||||
|   default_tool_stonepick.png |  | ||||||
|   default_tool_stoneshovel.png |  | ||||||
|   default_tool_woodpick.png |  | ||||||
|   default_tool_woodshovel.png |  | ||||||
|   default_tree.png |   default_tree.png | ||||||
|   default_tree_top.png |   default_tree_top.png | ||||||
|   default_water.png |   default_water.png | ||||||
|  |  | ||||||
|  | Cisoun's conifers mod (WTFPL): | ||||||
|  |   default_pine_needles.png | ||||||
|  |  | ||||||
| Originating from G4JC's Almost MC Texture Pack: | Originating from G4JC's Almost MC Texture Pack: | ||||||
|   default_wood.png |  | ||||||
|   default_torch.png |   default_torch.png | ||||||
|   default_torch_on_ceiling.png |   default_torch_on_ceiling.png | ||||||
|   default_torch_on_floor.png |   default_torch_on_floor.png | ||||||
| @@ -71,17 +52,23 @@ RealBadAngel's animated water (WTFPL): | |||||||
|   default_water_source_animated.png |   default_water_source_animated.png | ||||||
|   default_water_flowing_animated.png |   default_water_flowing_animated.png | ||||||
|  |  | ||||||
| VanessaE: | VanessaE (WTFPL): | ||||||
|   default_nc_back.png |   default_nc_back.png | ||||||
|   default_nc_front.png |   default_nc_front.png | ||||||
|   default_nc_rb.png |   default_nc_rb.png | ||||||
|   default_nc_side.png |   default_nc_side.png | ||||||
|  |   default_grass_*.png | ||||||
|  |   default_desert_sand.png | ||||||
|  |   default_desert_stone.png | ||||||
|  |   default_desert_stone_brick.png | ||||||
|  |   default_sand.png | ||||||
|  |   default_sandstone_brick.png | ||||||
|  |  | ||||||
| Calinou's improved default textures (CC BY-SA): | Calinou (CC BY-SA): | ||||||
|   default_brick.png |   default_brick.png | ||||||
|   default_clay_brick.png |  | ||||||
|   default_papyrus.png |   default_papyrus.png | ||||||
|   default_tool_steelsword.png |   default_mineral_copper.png | ||||||
|  |   default_glass_detail.png | ||||||
|  |  | ||||||
| MirceaKitsune (WTFPL): | MirceaKitsune (WTFPL): | ||||||
|   character.x |   character.x | ||||||
| @@ -89,7 +76,123 @@ MirceaKitsune (WTFPL): | |||||||
| Jordach (CC BY-SA 3.0): | Jordach (CC BY-SA 3.0): | ||||||
|   character.png |   character.png | ||||||
|  |  | ||||||
|  | PilzAdam (WTFPL): | ||||||
|  |   default_jungleleaves.png | ||||||
|  |   default_junglesapling.png | ||||||
|  |   default_junglewood.png | ||||||
|  |   default_obsidian_glass.png | ||||||
|  |   default_obsidian_shard.png | ||||||
|  |   default_mineral_gold.png | ||||||
|  |   default_snowball.png | ||||||
|  |  | ||||||
|  | jojoa1997 (WTFPL): | ||||||
|  |   default_obsidian.png | ||||||
|  |  | ||||||
|  | InfinityProject (WTFPL): | ||||||
|  |   default_mineral_diamond.png | ||||||
|  |  | ||||||
|  | Splizard (CC BY-SA 3.0): | ||||||
|  |   default_snow.png | ||||||
|  |   default_snow_side.png | ||||||
|  |   default_ice.png | ||||||
|  |   default_pine_sapling.png | ||||||
|  |  | ||||||
|  | Zeg9 (CC BY-SA 3.0): | ||||||
|  |   default_coal_block.png | ||||||
|  |   default_steel_block.png | ||||||
|  |   default_copper_block.png | ||||||
|  |   default_bronze_block.png | ||||||
|  |   default_gold_block.png | ||||||
|  |  | ||||||
|  | paramat (CC BY-SA 3.0): | ||||||
|  |   wieldhand.png, based on character.png by Jordach (CC BY-SA 3.0) | ||||||
|  |   default_pinetree.png | ||||||
|  |   default_pinetree_top.png | ||||||
|  |   default_pinewood.png | ||||||
|  |  | ||||||
|  | brunob.santos (CC BY-SA 4.0): | ||||||
|  |   default_desert_cobble.png | ||||||
|  |  | ||||||
|  | BlockMen (CC BY-SA 3.0): | ||||||
|  |   default_stone_brick.png | ||||||
|  |   default_wood.png | ||||||
|  |   default_clay_brick.png | ||||||
|  |   default_iron_ingot.png | ||||||
|  |   default_gold_ingot.png | ||||||
|  |   default_tool_steelsword.png | ||||||
|  |   default_diamond.png | ||||||
|  |   default_diamond_block.png | ||||||
|  |   default_book.png | ||||||
|  |   default_tool_*.png | ||||||
|  |   default_lava_source_animated.png | ||||||
|  |   default_lava_flowing_animated.png | ||||||
|  |   default_stick.png | ||||||
|  |   default_chest_front.png | ||||||
|  |   default_chest_lock.png | ||||||
|  |   default_chest_side.png | ||||||
|  |   default_chest_top.png | ||||||
|  |   bubble.png | ||||||
|  |   heart.png | ||||||
|  |   gui_*.png | ||||||
|  |  | ||||||
|  | Neuromancer (CC BY-SA 2.0): | ||||||
|  |   default_cobble.png, based on texture by Brane praefect | ||||||
|  |   default_mossycobble.png, based on texture by Brane praefect | ||||||
|  | Neuromancer (CC BY-SA 3.0): | ||||||
|  |   default_dirt.png | ||||||
|  |   default_furnace_*.png | ||||||
|  |  | ||||||
|  | Philipbenr (CC BY-SA 3.0): | ||||||
|  |   default_grass.png | ||||||
|  |   default_grass_side.png | ||||||
|  |  | ||||||
| Glass breaking sounds (CC BY 3.0): | Glass breaking sounds (CC BY 3.0): | ||||||
|   1: http://www.freesound.org/people/cmusounddesign/sounds/71947/ |   1: http://www.freesound.org/people/cmusounddesign/sounds/71947/ | ||||||
|   2: http://www.freesound.org/people/Tomlija/sounds/97669/ |   2: http://www.freesound.org/people/Tomlija/sounds/97669/ | ||||||
|   3: http://www.freesound.org/people/lsprice/sounds/88808/ |   3: http://www.freesound.org/people/lsprice/sounds/88808/ | ||||||
|  |  | ||||||
|  | Mito551 (sounds) (CC BY-SA): | ||||||
|  |   default_dig_choppy.ogg | ||||||
|  |   default_dig_cracky.ogg | ||||||
|  |   default_dig_crumbly.1.ogg | ||||||
|  |   default_dig_crumbly.2.ogg | ||||||
|  |   default_dig_dig_immediate.ogg | ||||||
|  |   default_dig_oddly_breakable_by_hand.ogg | ||||||
|  |   default_dug_node.1.ogg | ||||||
|  |   default_dug_node.2.ogg | ||||||
|  |   default_grass_footstep.1.ogg | ||||||
|  |   default_grass_footstep.2.ogg | ||||||
|  |   default_grass_footstep.3.ogg | ||||||
|  |   default_gravel_footstep.1.ogg | ||||||
|  |   default_gravel_footstep.2.ogg | ||||||
|  |   default_gravel_footstep.3.ogg | ||||||
|  |   default_gravel_footstep.4.ogg | ||||||
|  |   default_grass_footstep.1.ogg | ||||||
|  |   default_place_node.1.ogg | ||||||
|  |   default_place_node.2.ogg | ||||||
|  |   default_place_node.3.ogg | ||||||
|  |   default_place_node_hard.1.ogg | ||||||
|  |   default_place_node_hard.2.ogg | ||||||
|  |   default_snow_footstep.1.ogg | ||||||
|  |   default_snow_footstep.2.ogg | ||||||
|  |   default_hard_footstep.1.ogg | ||||||
|  |   default_hard_footstep.2.ogg | ||||||
|  |   default_hard_footstep.3.ogg | ||||||
|  |   default_sand_footstep.1.ogg | ||||||
|  |   default_sand_footstep.2.ogg | ||||||
|  |   default_wood_footstep.1.ogg | ||||||
|  |   default_wood_footstep.2.ogg | ||||||
|  |   default_dirt_footstep.1.ogg | ||||||
|  |   default_dirt_footstep.2.ogg | ||||||
|  |   default_glass_footstep.ogg | ||||||
|  |  | ||||||
|  | Gambit (WTFPL): | ||||||
|  |   default_bronze_ingot.png | ||||||
|  |   default_copper_ingot.png | ||||||
|  |   default_copper_lump.png | ||||||
|  |   default_iron_lump.png | ||||||
|  |   default_gold_lump.png | ||||||
|  |   default_clay_lump.png | ||||||
|  |   default_coal.png | ||||||
|  |   default_grass_*.png | ||||||
|  |   default_paper.png | ||||||
|   | |||||||
| @@ -1,10 +1,7 @@ | |||||||
| -- legacy (Minetest 0.4 mod) | -- mods/default/aliases.lua | ||||||
| -- Provides as much backwards-compatibility as feasible |  | ||||||
| 
 |  | ||||||
| -- |  | ||||||
| -- Aliases to support loading 0.3 and old 0.4 worlds and inventories |  | ||||||
| -- |  | ||||||
| 
 | 
 | ||||||
|  | -- Aliases to support loading worlds using nodes following the old naming convention | ||||||
|  | -- These can also be helpful when using chat commands, for example /giveme | ||||||
| minetest.register_alias("stone", "default:stone") | minetest.register_alias("stone", "default:stone") | ||||||
| minetest.register_alias("stone_with_coal", "default:stone_with_coal") | minetest.register_alias("stone_with_coal", "default:stone_with_coal") | ||||||
| minetest.register_alias("stone_with_iron", "default:stone_with_iron") | minetest.register_alias("stone_with_iron", "default:stone_with_iron") | ||||||
| @@ -69,65 +66,7 @@ minetest.register_alias("lump_of_iron", "default:iron_lump") | |||||||
| minetest.register_alias("lump_of_clay", "default:clay_lump") | minetest.register_alias("lump_of_clay", "default:clay_lump") | ||||||
| minetest.register_alias("steel_ingot", "default:steel_ingot") | minetest.register_alias("steel_ingot", "default:steel_ingot") | ||||||
| minetest.register_alias("clay_brick", "default:clay_brick") | minetest.register_alias("clay_brick", "default:clay_brick") | ||||||
| minetest.register_alias("scorched_stuff", "default:scorched_stuff") | minetest.register_alias("snow", "default:snow") | ||||||
| 
 | 
 | ||||||
| -- | -- Mese now comes in the form of blocks, ore, crystal and fragments | ||||||
| -- Old items | minetest.register_alias("default:mese", "default:mese_block") | ||||||
| -- |  | ||||||
| 
 |  | ||||||
| minetest.register_craftitem(":rat", { |  | ||||||
| 	description = "Rat", |  | ||||||
| 	inventory_image = "rat.png", |  | ||||||
| 	on_drop = function(item, dropper, pos) |  | ||||||
| 		minetest.env:add_rat(pos) |  | ||||||
| 		item:take_item() |  | ||||||
| 		return item |  | ||||||
| 	end, |  | ||||||
| 	on_place = function(item, dropped, pointed) |  | ||||||
| 		pos = minetest.get_pointed_thing_position(pointed, true) |  | ||||||
| 		if pos ~= nil then |  | ||||||
| 			minetest.env:add_rat(pos) |  | ||||||
| 			item:take_item() |  | ||||||
| 			return item |  | ||||||
| 		end |  | ||||||
| 	end |  | ||||||
| }) |  | ||||||
| 
 |  | ||||||
| minetest.register_craftitem(":cooked_rat", { |  | ||||||
| 	description = "Cooked rat", |  | ||||||
| 	inventory_image = "cooked_rat.png", |  | ||||||
| 	on_use = minetest.item_eat(6), |  | ||||||
| }) |  | ||||||
| 
 |  | ||||||
| minetest.register_craftitem(":firefly", { |  | ||||||
| 	description = "Firefly", |  | ||||||
| 	inventory_image = "firefly.png", |  | ||||||
| 	groups = {not_in_creative_inventory=1}, |  | ||||||
| 	on_drop = function(item, dropper, pos) |  | ||||||
| 		minetest.env:add_firefly(pos) |  | ||||||
| 		item:take_item() |  | ||||||
| 		return item |  | ||||||
| 	end, |  | ||||||
| 	on_place = function(item, dropped, pointed) |  | ||||||
| 		pos = minetest.get_pointed_thing_position(pointed, true) |  | ||||||
| 		if pos ~= nil then |  | ||||||
| 			minetest.env:add_firefly(pos) |  | ||||||
| 			item:take_item() |  | ||||||
| 			return item |  | ||||||
| 		end |  | ||||||
| 	end |  | ||||||
| }) |  | ||||||
| 
 |  | ||||||
| minetest.register_craft({ |  | ||||||
| 	type = "cooking", |  | ||||||
| 	output = "cooked_rat", |  | ||||||
| 	recipe = "rat", |  | ||||||
| }) |  | ||||||
| 
 |  | ||||||
| minetest.register_craft({ |  | ||||||
| 	type = "cooking", |  | ||||||
| 	output = "scorched_stuff", |  | ||||||
| 	recipe = "cooked_rat", |  | ||||||
| }) |  | ||||||
| 
 |  | ||||||
| -- END |  | ||||||
							
								
								
									
										830
									
								
								mods/default/crafting.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,830 @@ | |||||||
|  | -- mods/default/crafting.lua | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:wood 4', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:tree'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:junglewood 4', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:jungletree'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:pinewood 4', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:pinetree'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:stick 4', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'group:wood'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:fence_wood 2', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'group:stick', 'group:stick', 'group:stick'}, | ||||||
|  | 		{'group:stick', 'group:stick', 'group:stick'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:sign_wall', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'group:wood', 'group:wood', 'group:wood'}, | ||||||
|  | 		{'group:wood', 'group:wood', 'group:wood'}, | ||||||
|  | 		{'', 'group:stick', ''}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:torch 4', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:coal_lump'}, | ||||||
|  | 		{'group:stick'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:pick_wood', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'group:wood', 'group:wood', 'group:wood'}, | ||||||
|  | 		{'', 'group:stick', ''}, | ||||||
|  | 		{'', 'group:stick', ''}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:pick_stone', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'group:stone', 'group:stone', 'group:stone'}, | ||||||
|  | 		{'', 'group:stick', ''}, | ||||||
|  | 		{'', 'group:stick', ''}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:pick_steel', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, | ||||||
|  | 		{'', 'group:stick', ''}, | ||||||
|  | 		{'', 'group:stick', ''}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:pick_bronze', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'}, | ||||||
|  | 		{'', 'group:stick', ''}, | ||||||
|  | 		{'', 'group:stick', ''}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:pick_mese', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:mese_crystal', 'default:mese_crystal', 'default:mese_crystal'}, | ||||||
|  | 		{'', 'group:stick', ''}, | ||||||
|  | 		{'', 'group:stick', ''}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:pick_diamond', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:diamond', 'default:diamond', 'default:diamond'}, | ||||||
|  | 		{'', 'group:stick', ''}, | ||||||
|  | 		{'', 'group:stick', ''}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:shovel_wood', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'group:wood'}, | ||||||
|  | 		{'group:stick'}, | ||||||
|  | 		{'group:stick'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:shovel_stone', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'group:stone'}, | ||||||
|  | 		{'group:stick'}, | ||||||
|  | 		{'group:stick'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:shovel_steel', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:steel_ingot'}, | ||||||
|  | 		{'group:stick'}, | ||||||
|  | 		{'group:stick'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:shovel_bronze', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:bronze_ingot'}, | ||||||
|  | 		{'group:stick'}, | ||||||
|  | 		{'group:stick'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:shovel_mese', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:mese_crystal'}, | ||||||
|  | 		{'group:stick'}, | ||||||
|  | 		{'group:stick'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:shovel_diamond', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:diamond'}, | ||||||
|  | 		{'group:stick'}, | ||||||
|  | 		{'group:stick'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:axe_wood', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'group:wood', 'group:wood'}, | ||||||
|  | 		{'group:wood', 'group:stick'}, | ||||||
|  | 		{'', 'group:stick'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:axe_stone', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'group:stone', 'group:stone'}, | ||||||
|  | 		{'group:stone', 'group:stick'}, | ||||||
|  | 		{'', 'group:stick'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:axe_steel', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:steel_ingot', 'default:steel_ingot'}, | ||||||
|  | 		{'default:steel_ingot', 'group:stick'}, | ||||||
|  | 		{'', 'group:stick'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:axe_bronze', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:bronze_ingot', 'default:bronze_ingot'}, | ||||||
|  | 		{'default:bronze_ingot', 'group:stick'}, | ||||||
|  | 		{'', 'group:stick'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:axe_mese', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:mese_crystal', 'default:mese_crystal'}, | ||||||
|  | 		{'default:mese_crystal', 'group:stick'}, | ||||||
|  | 		{'', 'group:stick'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:axe_diamond', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:diamond', 'default:diamond'}, | ||||||
|  | 		{'default:diamond', 'group:stick'}, | ||||||
|  | 		{'', 'group:stick'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:axe_wood', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'group:wood', 'group:wood'}, | ||||||
|  | 		{'group:stick', 'group:wood'}, | ||||||
|  | 		{'group:stick',''}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:axe_stone', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'group:stone', 'group:stone'}, | ||||||
|  | 		{'group:stick', 'group:stone'}, | ||||||
|  | 		{'group:stick', ''}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:axe_steel', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:steel_ingot', 'default:steel_ingot'}, | ||||||
|  | 		{'group:stick', 'default:steel_ingot'}, | ||||||
|  | 		{'group:stick', ''}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:axe_bronze', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:bronze_ingot', 'default:bronze_ingot'}, | ||||||
|  | 		{'group:stick', 'default:bronze_ingot'}, | ||||||
|  | 		{'group:stick', ''}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:axe_mese', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:mese_crystal', 'default:mese_crystal'}, | ||||||
|  | 		{'group:stick', 'default:mese_crystal'}, | ||||||
|  | 		{'group:stick', ''}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:axe_diamond', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:diamond', 'default:diamond'}, | ||||||
|  | 		{'group:stick', 'default:diamond'}, | ||||||
|  | 		{'group:stick', ''}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:sword_wood', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'group:wood'}, | ||||||
|  | 		{'group:wood'}, | ||||||
|  | 		{'group:stick'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:sword_stone', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'group:stone'}, | ||||||
|  | 		{'group:stone'}, | ||||||
|  | 		{'group:stick'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:sword_steel', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:steel_ingot'}, | ||||||
|  | 		{'default:steel_ingot'}, | ||||||
|  | 		{'group:stick'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:sword_bronze', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:bronze_ingot'}, | ||||||
|  | 		{'default:bronze_ingot'}, | ||||||
|  | 		{'group:stick'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:sword_mese', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:mese_crystal'}, | ||||||
|  | 		{'default:mese_crystal'}, | ||||||
|  | 		{'group:stick'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:sword_diamond', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:diamond'}, | ||||||
|  | 		{'default:diamond'}, | ||||||
|  | 		{'group:stick'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:rail 15', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:steel_ingot', '', 'default:steel_ingot'}, | ||||||
|  | 		{'default:steel_ingot', 'group:stick', 'default:steel_ingot'}, | ||||||
|  | 		{'default:steel_ingot', '', 'default:steel_ingot'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:chest', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'group:wood', 'group:wood', 'group:wood'}, | ||||||
|  | 		{'group:wood', '', 'group:wood'}, | ||||||
|  | 		{'group:wood', 'group:wood', 'group:wood'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:chest_locked', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'group:wood', 'group:wood', 'group:wood'}, | ||||||
|  | 		{'group:wood', 'default:steel_ingot', 'group:wood'}, | ||||||
|  | 		{'group:wood', 'group:wood', 'group:wood'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:furnace', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'group:stone', 'group:stone', 'group:stone'}, | ||||||
|  | 		{'group:stone', '', 'group:stone'}, | ||||||
|  | 		{'group:stone', 'group:stone', 'group:stone'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "shapeless", | ||||||
|  | 	output = "default:bronze_ingot", | ||||||
|  | 	recipe = {"default:steel_ingot", "default:copper_ingot"}, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:coalblock', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:coal_lump', 'default:coal_lump', 'default:coal_lump'}, | ||||||
|  | 		{'default:coal_lump', 'default:coal_lump', 'default:coal_lump'}, | ||||||
|  | 		{'default:coal_lump', 'default:coal_lump', 'default:coal_lump'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:coal_lump 9', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:coalblock'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:steelblock', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, | ||||||
|  | 		{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, | ||||||
|  | 		{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:steel_ingot 9', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:steelblock'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:copperblock', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:copper_ingot', 'default:copper_ingot', 'default:copper_ingot'}, | ||||||
|  | 		{'default:copper_ingot', 'default:copper_ingot', 'default:copper_ingot'}, | ||||||
|  | 		{'default:copper_ingot', 'default:copper_ingot', 'default:copper_ingot'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:copper_ingot 9', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:copperblock'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:bronzeblock', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'}, | ||||||
|  | 		{'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'}, | ||||||
|  | 		{'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:bronze_ingot 9', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:bronzeblock'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:goldblock', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot'}, | ||||||
|  | 		{'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot'}, | ||||||
|  | 		{'default:gold_ingot', 'default:gold_ingot', 'default:gold_ingot'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:gold_ingot 9', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:goldblock'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:diamondblock', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:diamond', 'default:diamond', 'default:diamond'}, | ||||||
|  | 		{'default:diamond', 'default:diamond', 'default:diamond'}, | ||||||
|  | 		{'default:diamond', 'default:diamond', 'default:diamond'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:diamond 9', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:diamondblock'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:sandstone', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'group:sand', 'group:sand'}, | ||||||
|  | 		{'group:sand', 'group:sand'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:sand 4', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:sandstone'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:sandstonebrick 4', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:sandstone', 'default:sandstone'}, | ||||||
|  | 		{'default:sandstone', 'default:sandstone'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:clay', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:clay_lump', 'default:clay_lump'}, | ||||||
|  | 		{'default:clay_lump', 'default:clay_lump'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:brick', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:clay_brick', 'default:clay_brick'}, | ||||||
|  | 		{'default:clay_brick', 'default:clay_brick'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:clay_brick 4', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:brick'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:paper', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:papyrus', 'default:papyrus', 'default:papyrus'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:book', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:paper'}, | ||||||
|  | 		{'default:paper'}, | ||||||
|  | 		{'default:paper'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:bookshelf', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'group:wood', 'group:wood', 'group:wood'}, | ||||||
|  | 		{'default:book', 'default:book', 'default:book'}, | ||||||
|  | 		{'group:wood', 'group:wood', 'group:wood'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:ladder', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'group:stick', '', 'group:stick'}, | ||||||
|  | 		{'group:stick', 'group:stick', 'group:stick'}, | ||||||
|  | 		{'group:stick', '', 'group:stick'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:mese', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:mese_crystal', 'default:mese_crystal', 'default:mese_crystal'}, | ||||||
|  | 		{'default:mese_crystal', 'default:mese_crystal', 'default:mese_crystal'}, | ||||||
|  | 		{'default:mese_crystal', 'default:mese_crystal', 'default:mese_crystal'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:mese_crystal 9', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:mese'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:mese_crystal_fragment 9', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:mese_crystal'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:obsidian_shard 9', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:obsidian'} | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:obsidian', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:obsidian_shard', 'default:obsidian_shard', 'default:obsidian_shard'}, | ||||||
|  | 		{'default:obsidian_shard', 'default:obsidian_shard', 'default:obsidian_shard'}, | ||||||
|  | 		{'default:obsidian_shard', 'default:obsidian_shard', 'default:obsidian_shard'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:obsidianbrick 4', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:obsidian', 'default:obsidian'}, | ||||||
|  | 		{'default:obsidian', 'default:obsidian'} | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:stonebrick 4', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:stone', 'default:stone'}, | ||||||
|  | 		{'default:stone', 'default:stone'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:desert_stonebrick 4', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:desert_stone', 'default:desert_stone'}, | ||||||
|  | 		{'default:desert_stone', 'default:desert_stone'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:snowblock', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:snow', 'default:snow', 'default:snow'}, | ||||||
|  | 		{'default:snow', 'default:snow', 'default:snow'}, | ||||||
|  | 		{'default:snow', 'default:snow', 'default:snow'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:snow 9', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:snowblock'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | -- | ||||||
|  | -- Crafting (tool repair) | ||||||
|  | -- | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "toolrepair", | ||||||
|  | 	additional_wear = -0.02, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | -- | ||||||
|  | -- Cooking recipes | ||||||
|  | -- | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "cooking", | ||||||
|  | 	output = "default:glass", | ||||||
|  | 	recipe = "group:sand", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "cooking", | ||||||
|  | 	output = "default:obsidian_glass", | ||||||
|  | 	recipe = "default:obsidian_shard", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "cooking", | ||||||
|  | 	output = "default:stone", | ||||||
|  | 	recipe = "default:cobble", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "cooking", | ||||||
|  | 	output = "default:stone", | ||||||
|  | 	recipe = "default:mossycobble", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "cooking", | ||||||
|  | 	output = "default:desert_stone", | ||||||
|  | 	recipe = "default:desert_cobble", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "cooking", | ||||||
|  | 	output = "default:steel_ingot", | ||||||
|  | 	recipe = "default:iron_lump", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "cooking", | ||||||
|  | 	output = "default:copper_ingot", | ||||||
|  | 	recipe = "default:copper_lump", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "cooking", | ||||||
|  | 	output = "default:gold_ingot", | ||||||
|  | 	recipe = "default:gold_lump", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "cooking", | ||||||
|  | 	output = "default:clay_brick", | ||||||
|  | 	recipe = "default:clay_lump", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | -- | ||||||
|  | -- Fuels | ||||||
|  | -- | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "fuel", | ||||||
|  | 	recipe = "group:tree", | ||||||
|  | 	burntime = 30, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "fuel", | ||||||
|  | 	recipe = "default:junglegrass", | ||||||
|  | 	burntime = 2, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "fuel", | ||||||
|  | 	recipe = "group:leaves", | ||||||
|  | 	burntime = 1, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "fuel", | ||||||
|  | 	recipe = "default:cactus", | ||||||
|  | 	burntime = 15, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "fuel", | ||||||
|  | 	recipe = "default:papyrus", | ||||||
|  | 	burntime = 1, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "fuel", | ||||||
|  | 	recipe = "default:bookshelf", | ||||||
|  | 	burntime = 30, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "fuel", | ||||||
|  | 	recipe = "default:fence_wood", | ||||||
|  | 	burntime = 15, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "fuel", | ||||||
|  | 	recipe = "default:ladder", | ||||||
|  | 	burntime = 5, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "fuel", | ||||||
|  | 	recipe = "group:wood", | ||||||
|  | 	burntime = 7, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "fuel", | ||||||
|  | 	recipe = "default:lava_source", | ||||||
|  | 	burntime = 60, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "fuel", | ||||||
|  | 	recipe = "default:torch", | ||||||
|  | 	burntime = 4, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "fuel", | ||||||
|  | 	recipe = "default:sign_wall", | ||||||
|  | 	burntime = 10, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "fuel", | ||||||
|  | 	recipe = "default:chest", | ||||||
|  | 	burntime = 30, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "fuel", | ||||||
|  | 	recipe = "default:chest_locked", | ||||||
|  | 	burntime = 30, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "fuel", | ||||||
|  | 	recipe = "default:nyancat", | ||||||
|  | 	burntime = 1, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "fuel", | ||||||
|  | 	recipe = "default:nyancat_rainbow", | ||||||
|  | 	burntime = 1, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "fuel", | ||||||
|  | 	recipe = "default:sapling", | ||||||
|  | 	burntime = 10, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "fuel", | ||||||
|  | 	recipe = "default:apple", | ||||||
|  | 	burntime = 3, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "fuel", | ||||||
|  | 	recipe = "default:coal_lump", | ||||||
|  | 	burntime = 40, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "fuel", | ||||||
|  | 	recipe = "default:coalblock", | ||||||
|  | 	burntime = 370, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "fuel", | ||||||
|  | 	recipe = "default:junglesapling", | ||||||
|  | 	burntime = 10, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "fuel", | ||||||
|  | 	recipe = "default:grass_1", | ||||||
|  | 	burntime = 2, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "fuel", | ||||||
|  | 	recipe = "default:pine_sapling", | ||||||
|  | 	burntime = 10, | ||||||
|  | }) | ||||||
|  |  | ||||||
							
								
								
									
										89
									
								
								mods/default/craftitems.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,89 @@ | |||||||
|  | -- mods/default/craftitems.lua | ||||||
|  |  | ||||||
|  | minetest.register_craftitem("default:stick", { | ||||||
|  | 	description = "Stick", | ||||||
|  | 	inventory_image = "default_stick.png", | ||||||
|  | 	groups = {stick=1}, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craftitem("default:paper", { | ||||||
|  | 	description = "Paper", | ||||||
|  | 	inventory_image = "default_paper.png", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craftitem("default:book", { | ||||||
|  | 	description = "Book", | ||||||
|  | 	inventory_image = "default_book.png", | ||||||
|  | 	groups = {book=1}, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craftitem("default:coal_lump", { | ||||||
|  | 	description = "Coal Lump", | ||||||
|  | 	inventory_image = "default_coal_lump.png", | ||||||
|  | 	groups = {coal = 1} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craftitem("default:iron_lump", { | ||||||
|  | 	description = "Iron Lump", | ||||||
|  | 	inventory_image = "default_iron_lump.png", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craftitem("default:copper_lump", { | ||||||
|  | 	description = "Copper Lump", | ||||||
|  | 	inventory_image = "default_copper_lump.png", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craftitem("default:mese_crystal", { | ||||||
|  | 	description = "Mese Crystal", | ||||||
|  | 	inventory_image = "default_mese_crystal.png", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craftitem("default:gold_lump", { | ||||||
|  | 	description = "Gold Lump", | ||||||
|  | 	inventory_image = "default_gold_lump.png", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craftitem("default:diamond", { | ||||||
|  | 	description = "Diamond", | ||||||
|  | 	inventory_image = "default_diamond.png", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craftitem("default:clay_lump", { | ||||||
|  | 	description = "Clay Lump", | ||||||
|  | 	inventory_image = "default_clay_lump.png", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craftitem("default:steel_ingot", { | ||||||
|  | 	description = "Steel Ingot", | ||||||
|  | 	inventory_image = "default_steel_ingot.png", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craftitem("default:copper_ingot", { | ||||||
|  | 	description = "Copper Ingot", | ||||||
|  | 	inventory_image = "default_copper_ingot.png", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craftitem("default:bronze_ingot", { | ||||||
|  | 	description = "Bronze Ingot", | ||||||
|  | 	inventory_image = "default_bronze_ingot.png", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craftitem("default:gold_ingot", { | ||||||
|  | 	description = "Gold Ingot", | ||||||
|  | 	inventory_image = "default_gold_ingot.png" | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craftitem("default:mese_crystal_fragment", { | ||||||
|  | 	description = "Mese Crystal Fragment", | ||||||
|  | 	inventory_image = "default_mese_crystal_fragment.png", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craftitem("default:clay_brick", { | ||||||
|  | 	description = "Clay Brick", | ||||||
|  | 	inventory_image = "default_clay_brick.png", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craftitem("default:obsidian_shard", { | ||||||
|  | 	description = "Obsidian Shard", | ||||||
|  | 	inventory_image = "default_obsidian_shard.png", | ||||||
|  | }) | ||||||
							
								
								
									
										320
									
								
								mods/default/functions.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,320 @@ | |||||||
|  | -- mods/default/functions.lua | ||||||
|  |  | ||||||
|  | -- | ||||||
|  | -- Sounds | ||||||
|  | -- | ||||||
|  |  | ||||||
|  | function default.node_sound_defaults(table) | ||||||
|  | 	table = table or {} | ||||||
|  | 	table.footstep = table.footstep or | ||||||
|  | 			{name="", gain=1.0} | ||||||
|  | 	table.dug = table.dug or | ||||||
|  | 			{name="default_dug_node", gain=0.25} | ||||||
|  | 	table.place = table.place or | ||||||
|  | 			{name="default_place_node_hard", gain=1.0} | ||||||
|  | 	return table | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function default.node_sound_stone_defaults(table) | ||||||
|  | 	table = table or {} | ||||||
|  | 	table.footstep = table.footstep or | ||||||
|  | 			{name="default_hard_footstep", gain=0.5} | ||||||
|  | 	table.dug = table.dug or | ||||||
|  | 			{name="default_hard_footstep", gain=1.0} | ||||||
|  | 	default.node_sound_defaults(table) | ||||||
|  | 	return table | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function default.node_sound_dirt_defaults(table) | ||||||
|  | 	table = table or {} | ||||||
|  | 	table.footstep = table.footstep or | ||||||
|  | 			{name="default_dirt_footstep", gain=1.0} | ||||||
|  | 	table.dug = table.dug or | ||||||
|  | 			{name="default_dirt_footstep", gain=1.5} | ||||||
|  | 	table.place = table.place or | ||||||
|  | 			{name="default_place_node", gain=1.0} | ||||||
|  | 	default.node_sound_defaults(table) | ||||||
|  | 	return table | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function default.node_sound_sand_defaults(table) | ||||||
|  | 	table = table or {} | ||||||
|  | 	table.footstep = table.footstep or | ||||||
|  | 			{name="default_sand_footstep", gain=0.2} | ||||||
|  | 	table.dug = table.dug or | ||||||
|  | 			{name="default_sand_footstep", gain=0.4} | ||||||
|  | 	table.place = table.place or | ||||||
|  | 			{name="default_place_node", gain=1.0} | ||||||
|  | 	default.node_sound_defaults(table) | ||||||
|  | 	return table | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function default.node_sound_wood_defaults(table) | ||||||
|  | 	table = table or {} | ||||||
|  | 	table.footstep = table.footstep or | ||||||
|  | 			{name="default_wood_footstep", gain=0.5} | ||||||
|  | 	table.dug = table.dug or | ||||||
|  | 			{name="default_wood_footstep", gain=1.0} | ||||||
|  | 	default.node_sound_defaults(table) | ||||||
|  | 	return table | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function default.node_sound_leaves_defaults(table) | ||||||
|  | 	table = table or {} | ||||||
|  | 	table.footstep = table.footstep or | ||||||
|  | 			{name="default_grass_footstep", gain=0.35} | ||||||
|  | 	table.dug = table.dug or | ||||||
|  | 			{name="default_grass_footstep", gain=0.7} | ||||||
|  | 	table.dig = table.dig or | ||||||
|  | 			{name="default_dig_crumbly", gain=0.4} | ||||||
|  | 	table.place = table.place or | ||||||
|  | 			{name="default_place_node", gain=1.0} | ||||||
|  | 	default.node_sound_defaults(table) | ||||||
|  | 	return table | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function default.node_sound_glass_defaults(table) | ||||||
|  | 	table = table or {} | ||||||
|  | 	table.footstep = table.footstep or | ||||||
|  | 			{name="default_glass_footstep", gain=0.5} | ||||||
|  | 	table.dug = table.dug or | ||||||
|  | 			{name="default_break_glass", gain=1.0} | ||||||
|  | 	default.node_sound_defaults(table) | ||||||
|  | 	return table | ||||||
|  | end | ||||||
|  |  | ||||||
|  | -- | ||||||
|  | -- Lavacooling | ||||||
|  | -- | ||||||
|  |  | ||||||
|  | default.cool_lava_source = function(pos) | ||||||
|  | 	minetest.set_node(pos, {name="default:obsidian"}) | ||||||
|  | 	minetest.sound_play("default_cool_lava", {pos = pos,  gain = 0.25}) | ||||||
|  | end | ||||||
|  |  | ||||||
|  | default.cool_lava_flowing = function(pos) | ||||||
|  | 	minetest.set_node(pos, {name="default:stone"}) | ||||||
|  | 	minetest.sound_play("default_cool_lava", {pos = pos,  gain = 0.25}) | ||||||
|  | end | ||||||
|  |  | ||||||
|  | minetest.register_abm({ | ||||||
|  | 	nodenames = {"default:lava_flowing"}, | ||||||
|  | 	neighbors = {"group:water"}, | ||||||
|  | 	interval = 1, | ||||||
|  | 	chance = 1, | ||||||
|  | 	action = function(pos, node, active_object_count, active_object_count_wider) | ||||||
|  | 		default.cool_lava_flowing(pos, node, active_object_count, active_object_count_wider) | ||||||
|  | 	end, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_abm({ | ||||||
|  | 	nodenames = {"default:lava_source"}, | ||||||
|  | 	neighbors = {"group:water"}, | ||||||
|  | 	interval = 1, | ||||||
|  | 	chance = 1, | ||||||
|  | 	action = function(pos, node, active_object_count, active_object_count_wider) | ||||||
|  | 		default.cool_lava_source(pos, node, active_object_count, active_object_count_wider) | ||||||
|  | 	end, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | -- | ||||||
|  | -- Papyrus and cactus growing | ||||||
|  | -- | ||||||
|  |  | ||||||
|  | minetest.register_abm({ | ||||||
|  | 	nodenames = {"default:cactus"}, | ||||||
|  | 	neighbors = {"group:sand"}, | ||||||
|  | 	interval = 50, | ||||||
|  | 	chance = 20, | ||||||
|  | 	action = function(pos, node) | ||||||
|  | 		pos.y = pos.y-1 | ||||||
|  | 		local name = minetest.get_node(pos).name | ||||||
|  | 		if minetest.get_item_group(name, "sand") ~= 0 then | ||||||
|  | 			pos.y = pos.y+1 | ||||||
|  | 			local height = 0 | ||||||
|  | 			while minetest.get_node(pos).name == "default:cactus" and height < 4 do | ||||||
|  | 				height = height+1 | ||||||
|  | 				pos.y = pos.y+1 | ||||||
|  | 			end | ||||||
|  | 			if height < 4 then | ||||||
|  | 				if minetest.get_node(pos).name == "air" then | ||||||
|  | 					minetest.set_node(pos, {name="default:cactus"}) | ||||||
|  | 				end | ||||||
|  | 			end | ||||||
|  | 		end | ||||||
|  | 	end, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_abm({ | ||||||
|  | 	nodenames = {"default:papyrus"}, | ||||||
|  | 	neighbors = {"default:dirt", "default:dirt_with_grass"}, | ||||||
|  | 	interval = 50, | ||||||
|  | 	chance = 20, | ||||||
|  | 	action = function(pos, node) | ||||||
|  | 		pos.y = pos.y-1 | ||||||
|  | 		local name = minetest.get_node(pos).name | ||||||
|  | 		if name == "default:dirt" or name == "default:dirt_with_grass" then | ||||||
|  | 			if minetest.find_node_near(pos, 3, {"group:water"}) == nil then | ||||||
|  | 				return | ||||||
|  | 			end | ||||||
|  | 			pos.y = pos.y+1 | ||||||
|  | 			local height = 0 | ||||||
|  | 			while minetest.get_node(pos).name == "default:papyrus" and height < 4 do | ||||||
|  | 				height = height+1 | ||||||
|  | 				pos.y = pos.y+1 | ||||||
|  | 			end | ||||||
|  | 			if height < 4 then | ||||||
|  | 				if minetest.get_node(pos).name == "air" then | ||||||
|  | 					minetest.set_node(pos, {name="default:papyrus"}) | ||||||
|  | 				end | ||||||
|  | 			end | ||||||
|  | 		end | ||||||
|  | 	end, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | -- | ||||||
|  | -- dig upwards | ||||||
|  | -- | ||||||
|  |  | ||||||
|  | function default.dig_up(pos, node, digger) | ||||||
|  | 	if digger == nil then return end | ||||||
|  | 	local np = {x = pos.x, y = pos.y + 1, z = pos.z} | ||||||
|  | 	local nn = minetest.get_node(np) | ||||||
|  | 	if nn.name == node.name then | ||||||
|  | 		minetest.node_dig(np, nn, digger) | ||||||
|  | 	end | ||||||
|  | end | ||||||
|  |  | ||||||
|  | -- | ||||||
|  | -- Leafdecay | ||||||
|  | -- | ||||||
|  |  | ||||||
|  | default.leafdecay_trunk_cache = {} | ||||||
|  | default.leafdecay_enable_cache = true | ||||||
|  | -- Spread the load of finding trunks | ||||||
|  | default.leafdecay_trunk_find_allow_accumulator = 0 | ||||||
|  |  | ||||||
|  | minetest.register_globalstep(function(dtime) | ||||||
|  | 	local finds_per_second = 5000 | ||||||
|  | 	default.leafdecay_trunk_find_allow_accumulator = | ||||||
|  | 			math.floor(dtime * finds_per_second) | ||||||
|  | end) | ||||||
|  |  | ||||||
|  | default.after_place_leaves = function(pos, placer, itemstack, pointed_thing) | ||||||
|  | 	local node = minetest.get_node(pos) | ||||||
|  | 	node.param2 = 1 | ||||||
|  | 	minetest.set_node(pos, node) | ||||||
|  | end | ||||||
|  |  | ||||||
|  | minetest.register_abm({ | ||||||
|  | 	nodenames = {"group:leafdecay"}, | ||||||
|  | 	neighbors = {"air", "group:liquid"}, | ||||||
|  | 	-- A low interval and a high inverse chance spreads the load | ||||||
|  | 	interval = 2, | ||||||
|  | 	chance = 5, | ||||||
|  |  | ||||||
|  | 	action = function(p0, node, _, _) | ||||||
|  | 		--print("leafdecay ABM at "..p0.x..", "..p0.y..", "..p0.z..")") | ||||||
|  | 		local do_preserve = false | ||||||
|  | 		local d = minetest.registered_nodes[node.name].groups.leafdecay | ||||||
|  | 		if not d or d == 0 then | ||||||
|  | 			--print("not groups.leafdecay") | ||||||
|  | 			return | ||||||
|  | 		end | ||||||
|  | 		local n0 = minetest.get_node(p0) | ||||||
|  | 		if n0.param2 ~= 0 then | ||||||
|  | 			--print("param2 ~= 0") | ||||||
|  | 			return | ||||||
|  | 		end | ||||||
|  | 		local p0_hash = nil | ||||||
|  | 		if default.leafdecay_enable_cache then | ||||||
|  | 			p0_hash = minetest.hash_node_position(p0) | ||||||
|  | 			local trunkp = default.leafdecay_trunk_cache[p0_hash] | ||||||
|  | 			if trunkp then | ||||||
|  | 				local n = minetest.get_node(trunkp) | ||||||
|  | 				local reg = minetest.registered_nodes[n.name] | ||||||
|  | 				-- Assume ignore is a trunk, to make the thing work at the border of the active area | ||||||
|  | 				if n.name == "ignore" or (reg and reg.groups.tree and reg.groups.tree ~= 0) then | ||||||
|  | 					--print("cached trunk still exists") | ||||||
|  | 					return | ||||||
|  | 				end | ||||||
|  | 				--print("cached trunk is invalid") | ||||||
|  | 				-- Cache is invalid | ||||||
|  | 				table.remove(default.leafdecay_trunk_cache, p0_hash) | ||||||
|  | 			end | ||||||
|  | 		end | ||||||
|  | 		if default.leafdecay_trunk_find_allow_accumulator <= 0 then | ||||||
|  | 			return | ||||||
|  | 		end | ||||||
|  | 		default.leafdecay_trunk_find_allow_accumulator = | ||||||
|  | 				default.leafdecay_trunk_find_allow_accumulator - 1 | ||||||
|  | 		-- Assume ignore is a trunk, to make the thing work at the border of the active area | ||||||
|  | 		local p1 = minetest.find_node_near(p0, d, {"ignore", "group:tree"}) | ||||||
|  | 		if p1 then | ||||||
|  | 			do_preserve = true | ||||||
|  | 			if default.leafdecay_enable_cache then | ||||||
|  | 				--print("caching trunk") | ||||||
|  | 				-- Cache the trunk | ||||||
|  | 				default.leafdecay_trunk_cache[p0_hash] = p1 | ||||||
|  | 			end | ||||||
|  | 		end | ||||||
|  | 		if not do_preserve then | ||||||
|  | 			-- Drop stuff other than the node itself | ||||||
|  | 			local itemstacks = minetest.get_node_drops(n0.name) | ||||||
|  | 			for _, itemname in ipairs(itemstacks) do | ||||||
|  | 				if minetest.get_item_group(n0.name, "leafdecay_drop") ~= 0 or | ||||||
|  | 						itemname ~= n0.name then | ||||||
|  | 					local p_drop = { | ||||||
|  | 						x = p0.x - 0.5 + math.random(), | ||||||
|  | 						y = p0.y - 0.5 + math.random(), | ||||||
|  | 						z = p0.z - 0.5 + math.random(), | ||||||
|  | 					} | ||||||
|  | 					minetest.add_item(p_drop, itemname) | ||||||
|  | 				end | ||||||
|  | 			end | ||||||
|  | 			-- Remove node | ||||||
|  | 			minetest.remove_node(p0) | ||||||
|  | 			nodeupdate(p0) | ||||||
|  | 		end | ||||||
|  | 	end | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | -- | ||||||
|  | -- Grass growing | ||||||
|  | -- | ||||||
|  |  | ||||||
|  | minetest.register_abm({ | ||||||
|  | 	nodenames = {"default:dirt"}, | ||||||
|  | 	interval = 2, | ||||||
|  | 	chance = 200, | ||||||
|  | 	action = function(pos, node) | ||||||
|  | 		local above = {x=pos.x, y=pos.y+1, z=pos.z} | ||||||
|  | 		local name = minetest.get_node(above).name | ||||||
|  | 		local nodedef = minetest.registered_nodes[name] | ||||||
|  | 		if nodedef and (nodedef.sunlight_propagates or nodedef.paramtype == "light") | ||||||
|  | 				and nodedef.liquidtype == "none" | ||||||
|  | 				and (minetest.get_node_light(above) or 0) >= 13 then | ||||||
|  | 			if name == "default:snow" or name == "default:snowblock" then | ||||||
|  | 				minetest.set_node(pos, {name = "default:dirt_with_snow"}) | ||||||
|  | 			else | ||||||
|  | 				minetest.set_node(pos, {name = "default:dirt_with_grass"}) | ||||||
|  | 			end | ||||||
|  | 		end | ||||||
|  | 	end | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_abm({ | ||||||
|  | 	nodenames = {"default:dirt_with_grass"}, | ||||||
|  | 	interval = 2, | ||||||
|  | 	chance = 20, | ||||||
|  | 	action = function(pos, node) | ||||||
|  | 		local above = {x=pos.x, y=pos.y+1, z=pos.z} | ||||||
|  | 		local name = minetest.get_node(above).name | ||||||
|  | 		local nodedef = minetest.registered_nodes[name] | ||||||
|  | 		if name ~= "ignore" and nodedef | ||||||
|  | 				and not ((nodedef.sunlight_propagates or nodedef.paramtype == "light") | ||||||
|  | 				and nodedef.liquidtype == "none") then | ||||||
|  | 			minetest.set_node(pos, {name = "default:dirt"}) | ||||||
|  | 		end | ||||||
|  | 	end | ||||||
|  | }) | ||||||
							
								
								
									
										283
									
								
								mods/default/furnace.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,283 @@ | |||||||
|  |  | ||||||
|  | -- | ||||||
|  | -- Formspecs | ||||||
|  | -- | ||||||
|  |  | ||||||
|  | local function active_formspec(fuel_percent, item_percent) | ||||||
|  | 	local formspec =  | ||||||
|  | 		"size[8,8.5]".. | ||||||
|  | 		default.gui_bg.. | ||||||
|  | 		default.gui_bg_img.. | ||||||
|  | 		default.gui_slots.. | ||||||
|  | 		"list[current_name;src;2.75,0.5;1,1;]".. | ||||||
|  | 		"list[current_name;fuel;2.75,2.5;1,1;]".. | ||||||
|  | 		"image[2.75,1.5;1,1;default_furnace_fire_bg.png^[lowpart:".. | ||||||
|  | 		(100-fuel_percent)..":default_furnace_fire_fg.png]".. | ||||||
|  | 		"image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[lowpart:".. | ||||||
|  | 		(item_percent)..":gui_furnace_arrow_fg.png^[transformR270]".. | ||||||
|  | 		"list[current_name;dst;4.75,0.96;2,2;]".. | ||||||
|  | 		"list[current_player;main;0,4.25;8,1;]".. | ||||||
|  | 		"list[current_player;main;0,5.5;8,3;8]".. | ||||||
|  | 		default.get_hotbar_bg(0, 4.25) | ||||||
|  | 	return formspec | ||||||
|  | end | ||||||
|  |  | ||||||
|  | local inactive_formspec = | ||||||
|  | 	"size[8,8.5]".. | ||||||
|  | 	default.gui_bg.. | ||||||
|  | 	default.gui_bg_img.. | ||||||
|  | 	default.gui_slots.. | ||||||
|  | 	"list[current_name;src;2.75,0.5;1,1;]".. | ||||||
|  | 	"list[current_name;fuel;2.75,2.5;1,1;]".. | ||||||
|  | 	"image[2.75,1.5;1,1;default_furnace_fire_bg.png]".. | ||||||
|  | 	"image[3.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]".. | ||||||
|  | 	"list[current_name;dst;4.75,0.96;2,2;]".. | ||||||
|  | 	"list[current_player;main;0,4.25;8,1;]".. | ||||||
|  | 	"list[current_player;main;0,5.5;8,3;8]".. | ||||||
|  | 	default.get_hotbar_bg(0, 4.25) | ||||||
|  |  | ||||||
|  | -- | ||||||
|  | -- Node callback functions that are the same for active and inactive furnace | ||||||
|  | -- | ||||||
|  |  | ||||||
|  | local function can_dig(pos, player) | ||||||
|  | 	local meta = minetest.get_meta(pos); | ||||||
|  | 	local inv = meta:get_inventory() | ||||||
|  | 	return inv:is_empty("fuel") and inv:is_empty("dst") and inv:is_empty("src") | ||||||
|  | end | ||||||
|  |  | ||||||
|  | local function allow_metadata_inventory_put(pos, listname, index, stack, player) | ||||||
|  | 	if minetest.is_protected(pos, player:get_player_name()) then | ||||||
|  | 		return 0 | ||||||
|  | 	end | ||||||
|  | 	local meta = minetest.get_meta(pos) | ||||||
|  | 	local inv = meta:get_inventory() | ||||||
|  | 	if listname == "fuel" then | ||||||
|  | 		if minetest.get_craft_result({method="fuel", width=1, items={stack}}).time ~= 0 then | ||||||
|  | 			if inv:is_empty("src") then | ||||||
|  | 				meta:set_string("infotext", "Furnace is empty") | ||||||
|  | 			end | ||||||
|  | 			return stack:get_count() | ||||||
|  | 		else | ||||||
|  | 			return 0 | ||||||
|  | 		end | ||||||
|  | 	elseif listname == "src" then | ||||||
|  | 		return stack:get_count() | ||||||
|  | 	elseif listname == "dst" then | ||||||
|  | 		return 0 | ||||||
|  | 	end | ||||||
|  | end | ||||||
|  |  | ||||||
|  | local function allow_metadata_inventory_move(pos, from_list, from_index, to_list, to_index, count, player) | ||||||
|  | 	local meta = minetest.get_meta(pos) | ||||||
|  | 	local inv = meta:get_inventory() | ||||||
|  | 	local stack = inv:get_stack(from_list, from_index) | ||||||
|  | 	return allow_metadata_inventory_put(pos, to_list, to_index, stack, player) | ||||||
|  | end | ||||||
|  |  | ||||||
|  | local function allow_metadata_inventory_take(pos, listname, index, stack, player) | ||||||
|  | 	if minetest.is_protected(pos, player:get_player_name()) then | ||||||
|  | 		return 0 | ||||||
|  | 	end | ||||||
|  | 	return stack:get_count() | ||||||
|  | end | ||||||
|  |  | ||||||
|  | -- | ||||||
|  | -- Node definitions | ||||||
|  | -- | ||||||
|  |  | ||||||
|  | minetest.register_node("default:furnace", { | ||||||
|  | 	description = "Furnace", | ||||||
|  | 	tiles = { | ||||||
|  | 		"default_furnace_top.png", "default_furnace_bottom.png", | ||||||
|  | 		"default_furnace_side.png", "default_furnace_side.png", | ||||||
|  | 		"default_furnace_side.png", "default_furnace_front.png" | ||||||
|  | 	}, | ||||||
|  | 	paramtype2 = "facedir", | ||||||
|  | 	groups = {cracky=2}, | ||||||
|  | 	legacy_facedir_simple = true, | ||||||
|  | 	is_ground_content = false, | ||||||
|  | 	sounds = default.node_sound_stone_defaults(), | ||||||
|  | 	 | ||||||
|  | 	can_dig = can_dig, | ||||||
|  | 	 | ||||||
|  | 	allow_metadata_inventory_put = allow_metadata_inventory_put, | ||||||
|  | 	allow_metadata_inventory_move = allow_metadata_inventory_move, | ||||||
|  | 	allow_metadata_inventory_take = allow_metadata_inventory_take, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_node("default:furnace_active", { | ||||||
|  | 	description = "Furnace", | ||||||
|  | 	tiles = { | ||||||
|  | 		"default_furnace_top.png", "default_furnace_bottom.png", | ||||||
|  | 		"default_furnace_side.png", "default_furnace_side.png", | ||||||
|  | 		"default_furnace_side.png", | ||||||
|  | 		{ | ||||||
|  | 			image = "default_furnace_front_active.png", | ||||||
|  | 			backface_culling = false, | ||||||
|  | 			animation = { | ||||||
|  | 				type = "vertical_frames", | ||||||
|  | 				aspect_w = 16, | ||||||
|  | 				aspect_h = 16, | ||||||
|  | 				length = 1.5 | ||||||
|  | 			}, | ||||||
|  | 		} | ||||||
|  | 	}, | ||||||
|  | 	paramtype2 = "facedir", | ||||||
|  | 	light_source = 8, | ||||||
|  | 	drop = "default:furnace", | ||||||
|  | 	groups = {cracky=2, not_in_creative_inventory=1}, | ||||||
|  | 	legacy_facedir_simple = true, | ||||||
|  | 	is_ground_content = false, | ||||||
|  | 	sounds = default.node_sound_stone_defaults(), | ||||||
|  | 	 | ||||||
|  | 	can_dig = can_dig, | ||||||
|  | 	 | ||||||
|  | 	allow_metadata_inventory_put = allow_metadata_inventory_put, | ||||||
|  | 	allow_metadata_inventory_move = allow_metadata_inventory_move, | ||||||
|  | 	allow_metadata_inventory_take = allow_metadata_inventory_take, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | -- | ||||||
|  | -- ABM | ||||||
|  | -- | ||||||
|  |  | ||||||
|  | local function swap_node(pos, name) | ||||||
|  | 	local node = minetest.get_node(pos) | ||||||
|  | 	if node.name == name then | ||||||
|  | 		return | ||||||
|  | 	end | ||||||
|  | 	node.name = name | ||||||
|  | 	minetest.swap_node(pos, node) | ||||||
|  | end | ||||||
|  |  | ||||||
|  | minetest.register_abm({ | ||||||
|  | 	nodenames = {"default:furnace", "default:furnace_active"}, | ||||||
|  | 	interval = 1.0, | ||||||
|  | 	chance = 1, | ||||||
|  | 	action = function(pos, node, active_object_count, active_object_count_wider) | ||||||
|  | 		-- | ||||||
|  | 		-- Inizialize metadata | ||||||
|  | 		-- | ||||||
|  | 		local meta = minetest.get_meta(pos) | ||||||
|  | 		local fuel_time = meta:get_float("fuel_time") or 0 | ||||||
|  | 		local src_time = meta:get_float("src_time") or 0 | ||||||
|  | 		local fuel_totaltime = meta:get_float("fuel_totaltime") or 0 | ||||||
|  | 		 | ||||||
|  | 		-- | ||||||
|  | 		-- Inizialize inventory | ||||||
|  | 		-- | ||||||
|  | 		local inv = meta:get_inventory() | ||||||
|  | 		for listname, size in pairs({ | ||||||
|  | 				src = 1, | ||||||
|  | 				fuel = 1, | ||||||
|  | 				dst = 4, | ||||||
|  | 		}) do | ||||||
|  | 			if inv:get_size(listname) ~= size then | ||||||
|  | 				inv:set_size(listname, size) | ||||||
|  | 			end | ||||||
|  | 		end | ||||||
|  | 		local srclist = inv:get_list("src") | ||||||
|  | 		local fuellist = inv:get_list("fuel") | ||||||
|  | 		local dstlist = inv:get_list("dst") | ||||||
|  | 		 | ||||||
|  | 		-- | ||||||
|  | 		-- Cooking | ||||||
|  | 		-- | ||||||
|  | 		 | ||||||
|  | 		-- Check if we have cookable content | ||||||
|  | 		local cooked, aftercooked = minetest.get_craft_result({method = "cooking", width = 1, items = srclist}) | ||||||
|  | 		local cookable = true | ||||||
|  | 		 | ||||||
|  | 		if cooked.time == 0 then | ||||||
|  | 			cookable = false | ||||||
|  | 		end | ||||||
|  | 		 | ||||||
|  | 		-- Check if we have enough fuel to burn | ||||||
|  | 		if fuel_time < fuel_totaltime then | ||||||
|  | 			-- The furnace is currently active and has enough fuel | ||||||
|  | 			fuel_time = fuel_time + 1 | ||||||
|  | 			 | ||||||
|  | 			-- If there is a cookable item then check if it is ready yet | ||||||
|  | 			if cookable then | ||||||
|  | 				src_time = src_time + 1 | ||||||
|  | 				if src_time >= cooked.time then | ||||||
|  | 					-- Place result in dst list if possible | ||||||
|  | 					if inv:room_for_item("dst", cooked.item) then | ||||||
|  | 						inv:add_item("dst", cooked.item) | ||||||
|  | 						inv:set_stack("src", 1, aftercooked.items[1]) | ||||||
|  | 						src_time = 0 | ||||||
|  | 					end | ||||||
|  | 				end | ||||||
|  | 			end | ||||||
|  | 		else | ||||||
|  | 			-- Furnace ran out of fuel | ||||||
|  | 			if cookable then | ||||||
|  | 				-- We need to get new fuel | ||||||
|  | 				local fuel, afterfuel = minetest.get_craft_result({method = "fuel", width = 1, items = fuellist}) | ||||||
|  | 				 | ||||||
|  | 				if fuel.time == 0 then | ||||||
|  | 					-- No valid fuel in fuel list | ||||||
|  | 					fuel_totaltime = 0 | ||||||
|  | 					fuel_time = 0 | ||||||
|  | 					src_time = 0 | ||||||
|  | 				else | ||||||
|  | 					-- Take fuel from fuel list | ||||||
|  | 					inv:set_stack("fuel", 1, afterfuel.items[1]) | ||||||
|  | 					 | ||||||
|  | 					fuel_totaltime = fuel.time | ||||||
|  | 					fuel_time = 0 | ||||||
|  | 					 | ||||||
|  | 				end | ||||||
|  | 			else | ||||||
|  | 				-- We don't need to get new fuel since there is no cookable item | ||||||
|  | 				fuel_totaltime = 0 | ||||||
|  | 				fuel_time = 0 | ||||||
|  | 				src_time = 0 | ||||||
|  | 			end | ||||||
|  | 		end | ||||||
|  | 		 | ||||||
|  | 		-- | ||||||
|  | 		-- Update formspec, infotext and node | ||||||
|  | 		-- | ||||||
|  | 		local formspec = inactive_formspec | ||||||
|  | 		local item_state = "" | ||||||
|  | 		local item_percent = 0 | ||||||
|  | 		if cookable then | ||||||
|  | 			item_percent =  math.floor(src_time / cooked.time * 100) | ||||||
|  | 			item_state = item_percent .. "%" | ||||||
|  | 		else | ||||||
|  | 			if srclist[1]:is_empty() then | ||||||
|  | 				item_state = "Empty" | ||||||
|  | 			else | ||||||
|  | 				item_state = "Not cookable" | ||||||
|  | 			end | ||||||
|  | 		end | ||||||
|  | 		 | ||||||
|  | 		local fuel_state = "Empty" | ||||||
|  | 		local active = "inactive " | ||||||
|  | 		if fuel_time <= fuel_totaltime and fuel_totaltime ~= 0 then | ||||||
|  | 			active = "active " | ||||||
|  | 			local fuel_percent = math.floor(fuel_time / fuel_totaltime * 100) | ||||||
|  | 			fuel_state = fuel_percent .. "%" | ||||||
|  | 			formspec = active_formspec(fuel_percent, item_percent) | ||||||
|  | 			swap_node(pos, "default:furnace_active") | ||||||
|  | 		else | ||||||
|  | 			if not fuellist[1]:is_empty() then | ||||||
|  | 				fuel_state = "0%" | ||||||
|  | 			end | ||||||
|  | 			swap_node(pos, "default:furnace") | ||||||
|  | 		end | ||||||
|  | 		 | ||||||
|  | 		local infotext =  "Furnace " .. active .. "(Item: " .. item_state .. "; Fuel: " .. fuel_state .. ")" | ||||||
|  | 		 | ||||||
|  | 		-- | ||||||
|  | 		-- Set meta values | ||||||
|  | 		-- | ||||||
|  | 		meta:set_float("fuel_totaltime", fuel_totaltime) | ||||||
|  | 		meta:set_float("fuel_time", fuel_time) | ||||||
|  | 		meta:set_float("src_time", src_time) | ||||||
|  | 		meta:set_string("formspec", formspec) | ||||||
|  | 		meta:set_string("infotext", infotext) | ||||||
|  | 	end, | ||||||
|  | }) | ||||||
| @@ -1,92 +0,0 @@ | |||||||
| -- minetest/default/leafdecay.lua |  | ||||||
|  |  | ||||||
| -- To enable leaf decay for a node, add it to the "leafdecay" group. |  | ||||||
| -- |  | ||||||
| -- The rating of the group determines how far from a node in the group "tree" |  | ||||||
| -- the node can be without decaying. |  | ||||||
| -- |  | ||||||
| -- If param2 of the node is ~= 0, the node will always be preserved. Thus, if |  | ||||||
| -- the player places a node of that kind, you will want to set param2=1 or so. |  | ||||||
|  |  | ||||||
| default.leafdecay_trunk_cache = {} |  | ||||||
| default.leafdecay_enable_cache = true |  | ||||||
| -- Spread the load of finding trunks |  | ||||||
| default.leafdecay_trunk_find_allow_accumulator = 0 |  | ||||||
|  |  | ||||||
| minetest.register_globalstep(function(dtime) |  | ||||||
| 	local finds_per_second = 5000 |  | ||||||
| 	default.leafdecay_trunk_find_allow_accumulator = |  | ||||||
| 			math.floor(dtime * finds_per_second) |  | ||||||
| end) |  | ||||||
|  |  | ||||||
| minetest.register_abm({ |  | ||||||
| 	nodenames = {"group:leafdecay"}, |  | ||||||
| 	neighbors = {"air", "group:liquid"}, |  | ||||||
| 	-- A low interval and a high inverse chance spreads the load |  | ||||||
| 	interval = 2, |  | ||||||
| 	chance = 5, |  | ||||||
|  |  | ||||||
| 	action = function(p0, node, _, _) |  | ||||||
| 		--print("leafdecay ABM at "..p0.x..", "..p0.y..", "..p0.z..")") |  | ||||||
| 		local do_preserve = false |  | ||||||
| 		local d = minetest.registered_nodes[node.name].groups.leafdecay |  | ||||||
| 		if not d or d == 0 then |  | ||||||
| 			--print("not groups.leafdecay") |  | ||||||
| 			return |  | ||||||
| 		end |  | ||||||
| 		local n0 = minetest.env:get_node(p0) |  | ||||||
| 		if n0.param2 ~= 0 then |  | ||||||
| 			--print("param2 ~= 0") |  | ||||||
| 			return |  | ||||||
| 		end |  | ||||||
| 		local p0_hash = nil |  | ||||||
| 		if default.leafdecay_enable_cache then |  | ||||||
| 			p0_hash = minetest.hash_node_position(p0) |  | ||||||
| 			local trunkp = default.leafdecay_trunk_cache[p0_hash] |  | ||||||
| 			if trunkp then |  | ||||||
| 				local n = minetest.env:get_node(trunkp) |  | ||||||
| 				local reg = minetest.registered_nodes[n.name] |  | ||||||
| 				-- Assume ignore is a trunk, to make the thing work at the border of the active area |  | ||||||
| 				if n.name == "ignore" or (reg and reg.groups.tree and reg.groups.tree ~= 0) then |  | ||||||
| 					--print("cached trunk still exists") |  | ||||||
| 					return |  | ||||||
| 				end |  | ||||||
| 				--print("cached trunk is invalid") |  | ||||||
| 				-- Cache is invalid |  | ||||||
| 				table.remove(default.leafdecay_trunk_cache, p0_hash) |  | ||||||
| 			end |  | ||||||
| 		end |  | ||||||
| 		if default.leafdecay_trunk_find_allow_accumulator <= 0 then |  | ||||||
| 			return |  | ||||||
| 		end |  | ||||||
| 		default.leafdecay_trunk_find_allow_accumulator = |  | ||||||
| 				default.leafdecay_trunk_find_allow_accumulator - 1 |  | ||||||
| 		-- Assume ignore is a trunk, to make the thing work at the border of the active area |  | ||||||
| 		local p1 = minetest.env:find_node_near(p0, d, {"ignore", "group:tree"}) |  | ||||||
| 		if p1 then |  | ||||||
| 			do_preserve = true |  | ||||||
| 			if default.leafdecay_enable_cache then |  | ||||||
| 				--print("caching trunk") |  | ||||||
| 				-- Cache the trunk |  | ||||||
| 				default.leafdecay_trunk_cache[p0_hash] = p1 |  | ||||||
| 			end |  | ||||||
| 		end |  | ||||||
| 		if not do_preserve then |  | ||||||
| 			-- Drop stuff other than the node itself |  | ||||||
| 			itemstacks = minetest.get_node_drops(n0.name) |  | ||||||
| 			for _, itemname in ipairs(itemstacks) do |  | ||||||
| 				if itemname ~= n0.name then |  | ||||||
| 					local p_drop = { |  | ||||||
| 						x = p0.x - 0.5 + math.random(), |  | ||||||
| 						y = p0.y - 0.5 + math.random(), |  | ||||||
| 						z = p0.z - 0.5 + math.random(), |  | ||||||
| 					} |  | ||||||
| 					minetest.env:add_item(p_drop, itemname) |  | ||||||
| 				end |  | ||||||
| 			end |  | ||||||
| 			-- Remove node |  | ||||||
| 			minetest.env:remove_node(p0) |  | ||||||
| 		end |  | ||||||
| 	end |  | ||||||
| }) |  | ||||||
|  |  | ||||||
							
								
								
									
										25
									
								
								mods/default/legacy.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,25 @@ | |||||||
|  | -- mods/default/legacy.lua | ||||||
|  |  | ||||||
|  | -- Horrible crap to support old code registering falling nodes | ||||||
|  | -- Don't use this and never do what this does, it's completely wrong! | ||||||
|  | -- (More specifically, the client and the C++ code doesn't get the group) | ||||||
|  | function default.register_falling_node(nodename, texture) | ||||||
|  | 	minetest.log("error", debug.traceback()) | ||||||
|  | 	minetest.log('error', "WARNING: default.register_falling_node is deprecated") | ||||||
|  | 	if minetest.registered_nodes[nodename] then | ||||||
|  | 		minetest.registered_nodes[nodename].groups.falling_node = 1 | ||||||
|  | 	end | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function default.spawn_falling_node(p, nodename) | ||||||
|  | 	spawn_falling_node(p, nodename) | ||||||
|  | end | ||||||
|  |  | ||||||
|  | -- Liquids | ||||||
|  | WATER_ALPHA = minetest.registered_nodes["default:water_source"].alpha | ||||||
|  | WATER_VISC = minetest.registered_nodes["default:water_source"].liquid_viscosity | ||||||
|  | LAVA_VISC = minetest.registered_nodes["default:lava_source"].liquid_viscosity | ||||||
|  | LIGHT_MAX = default.LIGHT_MAX | ||||||
|  |  | ||||||
|  | -- Formspecs | ||||||
|  | default.gui_suvival_form = default.gui_survival_form | ||||||
| @@ -1,13 +1,14 @@ | |||||||
| -- minetest/default/mapgen.lua | -- mods/default/mapgen.lua | ||||||
|  |  | ||||||
| -- | -- | ||||||
| -- Aliases for map generator outputs | -- Aliases for map generator outputs | ||||||
| -- | -- | ||||||
|  |  | ||||||
| minetest.register_alias("mapgen_air", "air") |  | ||||||
| minetest.register_alias("mapgen_stone", "default:stone") | minetest.register_alias("mapgen_stone", "default:stone") | ||||||
| minetest.register_alias("mapgen_tree", "default:tree") | minetest.register_alias("mapgen_tree", "default:tree") | ||||||
| minetest.register_alias("mapgen_leaves", "default:leaves") | minetest.register_alias("mapgen_leaves", "default:leaves") | ||||||
|  | minetest.register_alias("mapgen_jungletree", "default:jungletree") | ||||||
|  | minetest.register_alias("mapgen_jungleleaves", "default:jungleleaves") | ||||||
| minetest.register_alias("mapgen_apple", "default:apple") | minetest.register_alias("mapgen_apple", "default:apple") | ||||||
| minetest.register_alias("mapgen_water_source", "default:water_source") | minetest.register_alias("mapgen_water_source", "default:water_source") | ||||||
| minetest.register_alias("mapgen_dirt", "default:dirt") | minetest.register_alias("mapgen_dirt", "default:dirt") | ||||||
| @@ -24,17 +25,210 @@ minetest.register_alias("mapgen_stone_with_iron", "default:stone_with_iron") | |||||||
| minetest.register_alias("mapgen_mese", "default:mese") | minetest.register_alias("mapgen_mese", "default:mese") | ||||||
| minetest.register_alias("mapgen_desert_sand", "default:desert_sand") | minetest.register_alias("mapgen_desert_sand", "default:desert_sand") | ||||||
| minetest.register_alias("mapgen_desert_stone", "default:desert_stone") | minetest.register_alias("mapgen_desert_stone", "default:desert_stone") | ||||||
|  | minetest.register_alias("mapgen_stair_cobble", "stairs:stair_cobble") | ||||||
|  |  | ||||||
| -- | -- | ||||||
| -- Ore generation | -- Ore generation | ||||||
| -- | -- | ||||||
|  |  | ||||||
| local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, height_min, height_max) | minetest.register_ore({ | ||||||
|  | 	ore_type       = "scatter", | ||||||
|  | 	ore            = "default:stone_with_coal", | ||||||
|  | 	wherein        = "default:stone", | ||||||
|  | 	clust_scarcity = 8*8*8, | ||||||
|  | 	clust_num_ores = 8, | ||||||
|  | 	clust_size     = 3, | ||||||
|  | 	height_min     = -31000, | ||||||
|  | 	height_max     = 64, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_ore({ | ||||||
|  | 	ore_type       = "scatter", | ||||||
|  | 	ore            = "default:stone_with_coal", | ||||||
|  | 	wherein        = "default:stone", | ||||||
|  | 	clust_scarcity = 24*24*24, | ||||||
|  | 	clust_num_ores = 27, | ||||||
|  | 	clust_size     = 6, | ||||||
|  | 	height_min     = -31000, | ||||||
|  | 	height_max     = 0, | ||||||
|  | 	flags          = "absheight", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_ore({ | ||||||
|  | 	ore_type       = "scatter", | ||||||
|  | 	ore            = "default:stone_with_iron", | ||||||
|  | 	wherein        = "default:stone", | ||||||
|  | 	clust_scarcity = 12*12*12, | ||||||
|  | 	clust_num_ores = 3, | ||||||
|  | 	clust_size     = 2, | ||||||
|  | 	height_min     = -15, | ||||||
|  | 	height_max     = 2, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_ore({ | ||||||
|  | 	ore_type       = "scatter", | ||||||
|  | 	ore            = "default:stone_with_iron", | ||||||
|  | 	wherein        = "default:stone", | ||||||
|  | 	clust_scarcity = 9*9*9, | ||||||
|  | 	clust_num_ores = 5, | ||||||
|  | 	clust_size     = 3, | ||||||
|  | 	height_min     = -63, | ||||||
|  | 	height_max     = -16, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_ore({ | ||||||
|  | 	ore_type       = "scatter", | ||||||
|  | 	ore            = "default:stone_with_iron", | ||||||
|  | 	wherein        = "default:stone", | ||||||
|  | 	clust_scarcity = 7*7*7, | ||||||
|  | 	clust_num_ores = 5, | ||||||
|  | 	clust_size     = 3, | ||||||
|  | 	height_min     = -31000, | ||||||
|  | 	height_max     = -64, | ||||||
|  | 	flags          = "absheight", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_ore({ | ||||||
|  | 	ore_type       = "scatter", | ||||||
|  | 	ore            = "default:stone_with_iron", | ||||||
|  | 	wherein        = "default:stone", | ||||||
|  | 	clust_scarcity = 24*24*24, | ||||||
|  | 	clust_num_ores = 27, | ||||||
|  | 	clust_size     = 6, | ||||||
|  | 	height_min     = -31000, | ||||||
|  | 	height_max     = -64, | ||||||
|  | 	flags          = "absheight", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_ore({ | ||||||
|  | 	ore_type       = "scatter", | ||||||
|  | 	ore            = "default:stone_with_mese", | ||||||
|  | 	wherein        = "default:stone", | ||||||
|  | 	clust_scarcity = 18*18*18, | ||||||
|  | 	clust_num_ores = 3, | ||||||
|  | 	clust_size     = 2, | ||||||
|  | 	height_min     = -255, | ||||||
|  | 	height_max     = -64, | ||||||
|  | 	flags          = "absheight", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_ore({ | ||||||
|  | 	ore_type       = "scatter", | ||||||
|  | 	ore            = "default:stone_with_mese", | ||||||
|  | 	wherein        = "default:stone", | ||||||
|  | 	clust_scarcity = 14*14*14, | ||||||
|  | 	clust_num_ores = 5, | ||||||
|  | 	clust_size     = 3, | ||||||
|  | 	height_min     = -31000, | ||||||
|  | 	height_max     = -256, | ||||||
|  | 	flags          = "absheight", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_ore({ | ||||||
|  | 	ore_type       = "scatter", | ||||||
|  | 	ore            = "default:mese", | ||||||
|  | 	wherein        = "default:stone", | ||||||
|  | 	clust_scarcity = 36*36*36, | ||||||
|  | 	clust_num_ores = 3, | ||||||
|  | 	clust_size     = 2, | ||||||
|  | 	height_min     = -31000, | ||||||
|  | 	height_max     = -1024, | ||||||
|  | 	flags          = "absheight", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_ore({ | ||||||
|  | 	ore_type       = "scatter", | ||||||
|  | 	ore            = "default:stone_with_gold", | ||||||
|  | 	wherein        = "default:stone", | ||||||
|  | 	clust_scarcity = 15*15*15, | ||||||
|  | 	clust_num_ores = 3, | ||||||
|  | 	clust_size     = 2, | ||||||
|  | 	height_min     = -255, | ||||||
|  | 	height_max     = -64, | ||||||
|  | 	flags          = "absheight", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_ore({ | ||||||
|  | 	ore_type       = "scatter", | ||||||
|  | 	ore            = "default:stone_with_gold", | ||||||
|  | 	wherein        = "default:stone", | ||||||
|  | 	clust_scarcity = 13*13*13, | ||||||
|  | 	clust_num_ores = 5, | ||||||
|  | 	clust_size     = 3, | ||||||
|  | 	height_min     = -31000, | ||||||
|  | 	height_max     = -256, | ||||||
|  | 	flags          = "absheight", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_ore({ | ||||||
|  | 	ore_type       = "scatter", | ||||||
|  | 	ore            = "default:stone_with_diamond", | ||||||
|  | 	wherein        = "default:stone", | ||||||
|  | 	clust_scarcity = 17*17*17, | ||||||
|  | 	clust_num_ores = 4, | ||||||
|  | 	clust_size     = 3, | ||||||
|  | 	height_min     = -255, | ||||||
|  | 	height_max     = -128, | ||||||
|  | 	flags          = "absheight", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_ore({ | ||||||
|  | 	ore_type       = "scatter", | ||||||
|  | 	ore            = "default:stone_with_diamond", | ||||||
|  | 	wherein        = "default:stone", | ||||||
|  | 	clust_scarcity = 15*15*15, | ||||||
|  | 	clust_num_ores = 4, | ||||||
|  | 	clust_size     = 3, | ||||||
|  | 	height_min     = -31000, | ||||||
|  | 	height_max     = -256, | ||||||
|  | 	flags          = "absheight", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_ore({ | ||||||
|  | 	ore_type       = "scatter", | ||||||
|  | 	ore            = "default:stone_with_copper", | ||||||
|  | 	wherein        = "default:stone", | ||||||
|  | 	clust_scarcity = 12*12*12, | ||||||
|  | 	clust_num_ores = 4, | ||||||
|  | 	clust_size     = 3, | ||||||
|  | 	height_min     = -63, | ||||||
|  | 	height_max     = -16, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_ore({ | ||||||
|  | 	ore_type       = "scatter", | ||||||
|  | 	ore            = "default:stone_with_copper", | ||||||
|  | 	wherein        = "default:stone", | ||||||
|  | 	clust_scarcity = 9*9*9, | ||||||
|  | 	clust_num_ores = 5, | ||||||
|  | 	clust_size     = 3, | ||||||
|  | 	height_min     = -31000, | ||||||
|  | 	height_max     = -64, | ||||||
|  | 	flags          = "absheight", | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_ore({ | ||||||
|  | 	ore_type       = "scatter", | ||||||
|  | 	ore            = "default:clay", | ||||||
|  | 	wherein        = "default:sand", | ||||||
|  | 	clust_scarcity = 15*15*15, | ||||||
|  | 	clust_num_ores = 64, | ||||||
|  | 	clust_size     = 5, | ||||||
|  | 	height_max     = 0, | ||||||
|  | 	height_min     = -10, | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | function default.generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, height_min, height_max) | ||||||
|  | 	minetest.log('action', "WARNING: default.generate_ore is deprecated") | ||||||
|  |  | ||||||
| 	if maxp.y < height_min or minp.y > height_max then | 	if maxp.y < height_min or minp.y > height_max then | ||||||
| 		return | 		return | ||||||
| 	end | 	end | ||||||
| 	local y_min = math.max(minp.y, height_min) | 	local y_min = math.max(minp.y, height_min) | ||||||
| 	local y_max = math.min(maxp.y, height_max) | 	local y_max = math.min(maxp.y, height_max) | ||||||
|  | 	if chunk_size >= y_max - y_min + 1 then | ||||||
|  | 		return | ||||||
|  | 	end | ||||||
| 	local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1) | 	local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1) | ||||||
| 	local pr = PseudoRandom(seed) | 	local pr = PseudoRandom(seed) | ||||||
| 	local num_chunks = math.floor(chunks_per_volume * volume) | 	local num_chunks = math.floor(chunks_per_volume * volume) | ||||||
| @@ -54,8 +248,8 @@ local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, | |||||||
| 					local y2 = y0+y1 | 					local y2 = y0+y1 | ||||||
| 					local z2 = z0+z1 | 					local z2 = z0+z1 | ||||||
| 					local p2 = {x=x2, y=y2, z=z2} | 					local p2 = {x=x2, y=y2, z=z2} | ||||||
| 					if minetest.env:get_node(p2).name == wherein then | 					if minetest.get_node(p2).name == wherein then | ||||||
| 						minetest.env:set_node(p2, {name=name}) | 						minetest.set_node(p2, {name=name}) | ||||||
| 					end | 					end | ||||||
| 				end | 				end | ||||||
| 			end | 			end | ||||||
| @@ -66,31 +260,152 @@ local function generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, | |||||||
| 	--print("generate_ore done") | 	--print("generate_ore done") | ||||||
| end | end | ||||||
|  |  | ||||||
| function default.make_papyrus(pos, size) | -- | ||||||
| 	for y=0,size-1 do | -- Mgv6 papyrus, cactus, long grasses | ||||||
| 		local p = {x=pos.x, y=pos.y+y, z=pos.z} | -- | ||||||
| 		local nn = minetest.env:get_node(p).name |  | ||||||
| 		if minetest.registered_nodes[nn] and | function default.mgv6_ongen(minp, maxp, seed) | ||||||
| 			minetest.registered_nodes[nn].buildable_to then |  | ||||||
| 			minetest.env:set_node(p, {name="default:papyrus"}) | 	function default.make_papyrus(pos, size) | ||||||
| 		else | 		for y=0,size-1 do | ||||||
| 			return | 			local p = {x=pos.x, y=pos.y+y, z=pos.z} | ||||||
|  | 			local nn = minetest.get_node(p).name | ||||||
|  | 			if minetest.registered_nodes[nn] and | ||||||
|  | 				minetest.registered_nodes[nn].buildable_to then | ||||||
|  | 				minetest.set_node(p, {name="default:papyrus"}) | ||||||
|  | 			else | ||||||
|  | 				return | ||||||
|  | 			end | ||||||
| 		end | 		end | ||||||
| 	end | 	end | ||||||
|  |  | ||||||
|  | 	function default.make_cactus(pos, size) | ||||||
|  | 		for y=0,size-1 do | ||||||
|  | 			local p = {x=pos.x, y=pos.y+y, z=pos.z} | ||||||
|  | 			local nn = minetest.get_node(p).name | ||||||
|  | 			if minetest.registered_nodes[nn] and | ||||||
|  | 				minetest.registered_nodes[nn].buildable_to then | ||||||
|  | 				minetest.set_node(p, {name="default:cactus"}) | ||||||
|  | 			else | ||||||
|  | 				return | ||||||
|  | 			end | ||||||
|  | 		end | ||||||
|  | 	end | ||||||
|  |  | ||||||
|  | 	if maxp.y >= 2 and minp.y <= 0 then | ||||||
|  | 		-- Generate papyrus | ||||||
|  | 		local perlin1 = minetest.get_perlin(354, 3, 0.7, 100) | ||||||
|  | 		-- Assume X and Z lengths are equal | ||||||
|  | 		local divlen = 8 | ||||||
|  | 		local divs = (maxp.x-minp.x)/divlen+1; | ||||||
|  | 		for divx=0,divs-1 do | ||||||
|  | 		for divz=0,divs-1 do | ||||||
|  | 			local x0 = minp.x + math.floor((divx+0)*divlen) | ||||||
|  | 			local z0 = minp.z + math.floor((divz+0)*divlen) | ||||||
|  | 			local x1 = minp.x + math.floor((divx+1)*divlen) | ||||||
|  | 			local z1 = minp.z + math.floor((divz+1)*divlen) | ||||||
|  | 			-- Determine papyrus amount from perlin noise | ||||||
|  | 			local papyrus_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 45 - 20) | ||||||
|  | 			-- Find random positions for papyrus based on this random | ||||||
|  | 			local pr = PseudoRandom(seed+1) | ||||||
|  | 			for i=0,papyrus_amount do | ||||||
|  | 				local x = pr:next(x0, x1) | ||||||
|  | 				local z = pr:next(z0, z1) | ||||||
|  | 				if minetest.get_node({x=x,y=1,z=z}).name == "default:dirt_with_grass" and | ||||||
|  | 						minetest.find_node_near({x=x,y=1,z=z}, 1, "default:water_source") then | ||||||
|  | 					default.make_papyrus({x=x,y=2,z=z}, pr:next(2, 4)) | ||||||
|  | 				end | ||||||
|  | 			end | ||||||
|  | 		end | ||||||
|  | 		end | ||||||
|  | 		-- Generate cactuses | ||||||
|  | 		local perlin1 = minetest.get_perlin(230, 3, 0.6, 100) | ||||||
|  | 		-- Assume X and Z lengths are equal | ||||||
|  | 		local divlen = 16 | ||||||
|  | 		local divs = (maxp.x-minp.x)/divlen+1; | ||||||
|  | 		for divx=0,divs-1 do | ||||||
|  | 		for divz=0,divs-1 do | ||||||
|  | 			local x0 = minp.x + math.floor((divx+0)*divlen) | ||||||
|  | 			local z0 = minp.z + math.floor((divz+0)*divlen) | ||||||
|  | 			local x1 = minp.x + math.floor((divx+1)*divlen) | ||||||
|  | 			local z1 = minp.z + math.floor((divz+1)*divlen) | ||||||
|  | 			-- Determine cactus amount from perlin noise | ||||||
|  | 			local cactus_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 6 - 3) | ||||||
|  | 			-- Find random positions for cactus based on this random | ||||||
|  | 			local pr = PseudoRandom(seed+1) | ||||||
|  | 			for i=0,cactus_amount do | ||||||
|  | 				local x = pr:next(x0, x1) | ||||||
|  | 				local z = pr:next(z0, z1) | ||||||
|  | 				-- Find ground level (0...15) | ||||||
|  | 				local ground_y = nil | ||||||
|  | 				for y=30,0,-1 do | ||||||
|  | 					if minetest.get_node({x=x,y=y,z=z}).name ~= "air" then | ||||||
|  | 						ground_y = y | ||||||
|  | 						break | ||||||
|  | 					end | ||||||
|  | 				end | ||||||
|  | 				-- If desert sand, make cactus | ||||||
|  | 				if ground_y and minetest.get_node({x=x,y=ground_y,z=z}).name == "default:desert_sand" then | ||||||
|  | 					default.make_cactus({x=x,y=ground_y+1,z=z}, pr:next(3, 4)) | ||||||
|  | 				end | ||||||
|  | 			end | ||||||
|  | 		end | ||||||
|  | 		end | ||||||
|  | 		-- Generate grass | ||||||
|  | 		local perlin1 = minetest.get_perlin(329, 3, 0.6, 100) | ||||||
|  | 		-- Assume X and Z lengths are equal | ||||||
|  | 		local divlen = 16 | ||||||
|  | 		local divs = (maxp.x-minp.x)/divlen+1; | ||||||
|  | 		for divx=0,divs-1 do | ||||||
|  | 		for divz=0,divs-1 do | ||||||
|  | 			local x0 = minp.x + math.floor((divx+0)*divlen) | ||||||
|  | 			local z0 = minp.z + math.floor((divz+0)*divlen) | ||||||
|  | 			local x1 = minp.x + math.floor((divx+1)*divlen) | ||||||
|  | 			local z1 = minp.z + math.floor((divz+1)*divlen) | ||||||
|  | 			-- Determine grass amount from perlin noise | ||||||
|  | 			local grass_amount = math.floor(perlin1:get2d({x=x0, y=z0}) ^ 3 * 9) | ||||||
|  | 			-- Find random positions for grass based on this random | ||||||
|  | 			local pr = PseudoRandom(seed+1) | ||||||
|  | 			for i=0,grass_amount do | ||||||
|  | 				local x = pr:next(x0, x1) | ||||||
|  | 				local z = pr:next(z0, z1) | ||||||
|  | 				-- Find ground level (0...15) | ||||||
|  | 				local ground_y = nil | ||||||
|  | 				for y=30,0,-1 do | ||||||
|  | 					if minetest.get_node({x=x,y=y,z=z}).name ~= "air" then | ||||||
|  | 						ground_y = y | ||||||
|  | 						break | ||||||
|  | 					end | ||||||
|  | 				end | ||||||
|  |  | ||||||
|  | 				if ground_y then | ||||||
|  | 					local p = {x=x,y=ground_y+1,z=z} | ||||||
|  | 					local nn = minetest.get_node(p).name | ||||||
|  | 					-- Check if the node can be replaced | ||||||
|  | 					if minetest.registered_nodes[nn] and | ||||||
|  | 						minetest.registered_nodes[nn].buildable_to then | ||||||
|  | 						nn = minetest.get_node({x=x,y=ground_y,z=z}).name | ||||||
|  | 						-- If desert sand, add dry shrub | ||||||
|  | 						if nn == "default:desert_sand" then | ||||||
|  | 							minetest.set_node(p,{name="default:dry_shrub"}) | ||||||
|  |  | ||||||
|  | 						-- If dirt with grass, add grass | ||||||
|  | 						elseif nn == "default:dirt_with_grass" then | ||||||
|  | 							minetest.set_node(p,{name="default:grass_"..pr:next(1, 5)}) | ||||||
|  | 						end | ||||||
|  | 					end | ||||||
|  | 				end | ||||||
|  |  | ||||||
|  | 			end | ||||||
|  | 		end | ||||||
|  | 		end | ||||||
|  | 	end | ||||||
|  |  | ||||||
| end | end | ||||||
|  |  | ||||||
| function default.make_cactus(pos, size) | -- | ||||||
| 	for y=0,size-1 do | -- Generate nyan cats in all mapgens | ||||||
| 		local p = {x=pos.x, y=pos.y+y, z=pos.z} | -- | ||||||
| 		local nn = minetest.env:get_node(p).name |  | ||||||
| 		if minetest.registered_nodes[nn] and |  | ||||||
| 			minetest.registered_nodes[nn].buildable_to then |  | ||||||
| 			minetest.env:set_node(p, {name="default:cactus"}) |  | ||||||
| 		else |  | ||||||
| 			return |  | ||||||
| 		end |  | ||||||
| 	end |  | ||||||
| end |  | ||||||
|  |  | ||||||
| -- facedir: 0/1/2/3 (head node facedir value) | -- facedir: 0/1/2/3 (head node facedir value) | ||||||
| -- length: length of rainbow tail | -- length: length of rainbow tail | ||||||
| @@ -105,20 +420,20 @@ function default.make_nyancat(pos, facedir, length) | |||||||
| 	elseif facedir == 3 then | 	elseif facedir == 3 then | ||||||
| 		tailvec.x = -1 | 		tailvec.x = -1 | ||||||
| 	else | 	else | ||||||
| 		print("default.make_nyancat(): Invalid facedir: "+dump(facedir)) | 		--print("default.make_nyancat(): Invalid facedir: "+dump(facedir)) | ||||||
| 		facedir = 0 | 		facedir = 0 | ||||||
| 		tailvec.z = 1 | 		tailvec.z = 1 | ||||||
| 	end | 	end | ||||||
| 	local p = {x=pos.x, y=pos.y, z=pos.z} | 	local p = {x=pos.x, y=pos.y, z=pos.z} | ||||||
| 	minetest.env:set_node(p, {name="default:nyancat", param2=facedir}) | 	minetest.set_node(p, {name="default:nyancat", param2=facedir}) | ||||||
| 	for i=1,length do | 	for i=1,length do | ||||||
| 		p.x = p.x + tailvec.x | 		p.x = p.x + tailvec.x | ||||||
| 		p.z = p.z + tailvec.z | 		p.z = p.z + tailvec.z | ||||||
| 		minetest.env:set_node(p, {name="default:nyancat_rainbow"}) | 		minetest.set_node(p, {name="default:nyancat_rainbow", param2=facedir}) | ||||||
| 	end | 	end | ||||||
| end | end | ||||||
|  |  | ||||||
| function generate_nyancats(seed, minp, maxp) | function default.generate_nyancats(minp, maxp, seed) | ||||||
| 	local height_min = -31000 | 	local height_min = -31000 | ||||||
| 	local height_max = -32 | 	local height_max = -32 | ||||||
| 	if maxp.y < height_min or minp.y > height_max then | 	if maxp.y < height_min or minp.y > height_max then | ||||||
| @@ -140,153 +455,257 @@ function generate_nyancats(seed, minp, maxp) | |||||||
| 	end | 	end | ||||||
| end | end | ||||||
|  |  | ||||||
| minetest.register_on_generated(function(minp, maxp, seed) | minetest.register_on_generated(default.generate_nyancats) | ||||||
| 	-- Generate regular ores |  | ||||||
| 	generate_ore("default:stone_with_coal", "default:stone", minp, maxp, seed+0, 1/8/8/8,    3, 8, -31000,  64) | -- | ||||||
| 	generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+1, 1/12/12/12, 2, 3,    -15,   2) | -- Register biomes | ||||||
| 	generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+2, 1/9/9/9,    3, 5,    -63, -16) | -- | ||||||
| 	generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+3, 1/7/7/7,    3, 5, -31000, -64) |  | ||||||
| 	generate_ore("default:mese",            "default:stone", minp, maxp, seed+4, 1/16/16/16, 2, 3,   -127, -64) | function default.register_biomes() | ||||||
| 	generate_ore("default:mese",            "default:stone", minp, maxp, seed+5, 1/9/9/9,    3, 5, -31000,-128) |  | ||||||
|  | 	minetest.clear_registered_biomes() | ||||||
|  |  | ||||||
|  | 	-- Temperate biomes | ||||||
|  |  | ||||||
|  | 	minetest.register_biome({ | ||||||
|  | 		name = "grassland", | ||||||
|  | 		node_top = "default:dirt_with_grass", | ||||||
|  | 		node_shore_top = "default:sand", | ||||||
|  | 		depth_top = 1, | ||||||
|  | 		node_filler = "default:dirt", | ||||||
|  | 		node_shore_filler = "default:sand", | ||||||
|  | 		depth_filler = 2, | ||||||
|  | 		height_shore = 3, | ||||||
|  | 		node_underwater = "default:sand", | ||||||
|  | 		--node_stone = "", | ||||||
|  | 		--node_water_top = "", | ||||||
|  | 		--depth_water_top = , | ||||||
|  | 		--node_water = "", | ||||||
|  | 		--node_dust = "", | ||||||
|  | 		y_min = -32000, | ||||||
|  | 		y_max = 32000, | ||||||
|  | 		heat_point = 50, | ||||||
|  | 		humidity_point = 50, | ||||||
|  | 	}) | ||||||
| 	 | 	 | ||||||
| 	generate_ore("default:stone_with_coal", "default:stone", minp, maxp, seed+7, 1/24/24/24, 6,27, -31000,  0) | 	-- | ||||||
| 	generate_ore("default:stone_with_iron", "default:stone", minp, maxp, seed+6, 1/24/24/24, 6,27, -31000, -64) | 	-- Register decorations | ||||||
|  | 	-- | ||||||
|  | 	 | ||||||
|  | 	-- Grassland | ||||||
|  | 	 | ||||||
|  | 	-- Flowers | ||||||
|  |  | ||||||
| 	if maxp.y >= 2 and minp.y <= 0 then | 	minetest.register_decoration({ | ||||||
| 		-- Generate clay | 		deco_type = "simple", | ||||||
| 		-- Assume X and Z lengths are equal | 		place_on = {"default:dirt_with_grass"}, | ||||||
| 		local divlen = 4 | 		sidelen = 16, | ||||||
| 		local divs = (maxp.x-minp.x)/divlen+1; | 		noise_params = { | ||||||
| 		for divx=0+1,divs-1-1 do | 			offset = -0.015, | ||||||
| 		for divz=0+1,divs-1-1 do | 			scale = 0.03, | ||||||
| 			local cx = minp.x + math.floor((divx+0.5)*divlen) | 			spread = {x=100, y=100, z=100}, | ||||||
| 			local cz = minp.z + math.floor((divz+0.5)*divlen) | 			seed = 436, | ||||||
| 			if minetest.env:get_node({x=cx,y=1,z=cz}).name == "default:water_source" and | 			octaves = 3, | ||||||
| 					minetest.env:get_node({x=cx,y=0,z=cz}).name == "default:sand" then | 			persist = 0.6 | ||||||
| 				local is_shallow = true | 		}, | ||||||
| 				local num_water_around = 0 | 		biomes = {"grassland"}, | ||||||
| 				if minetest.env:get_node({x=cx-divlen*2,y=1,z=cz+0}).name == "default:water_source" then | 		y_min = -32000, | ||||||
| 					num_water_around = num_water_around + 1 end | 		y_max = 32000, | ||||||
| 				if minetest.env:get_node({x=cx+divlen*2,y=1,z=cz+0}).name == "default:water_source" then | 		decoration = "flowers:rose", | ||||||
| 					num_water_around = num_water_around + 1 end | 	}) | ||||||
| 				if minetest.env:get_node({x=cx+0,y=1,z=cz-divlen*2}).name == "default:water_source" then | 	 | ||||||
| 					num_water_around = num_water_around + 1 end | 	minetest.register_decoration({ | ||||||
| 				if minetest.env:get_node({x=cx+0,y=1,z=cz+divlen*2}).name == "default:water_source" then | 		deco_type = "simple", | ||||||
| 					num_water_around = num_water_around + 1 end | 		place_on = {"default:dirt_with_grass"}, | ||||||
| 				if num_water_around >= 2 then | 		sidelen = 16, | ||||||
| 					is_shallow = false | 		noise_params = { | ||||||
| 				end	 | 			offset = -0.015, | ||||||
| 				if is_shallow then | 			scale = 0.03, | ||||||
| 					for x1=-divlen,divlen do | 			spread = {x=100, y=100, z=100}, | ||||||
| 					for z1=-divlen,divlen do | 			seed = 19822, | ||||||
| 						if minetest.env:get_node({x=cx+x1,y=0,z=cz+z1}).name == "default:sand" then | 			octaves = 3, | ||||||
| 							minetest.env:set_node({x=cx+x1,y=0,z=cz+z1}, {name="default:clay"}) | 			persist = 0.6 | ||||||
| 						end | 		}, | ||||||
| 					end | 		biomes = {"grassland"}, | ||||||
| 					end | 		y_min = -32000, | ||||||
| 				end | 		y_max = 32000, | ||||||
| 			end | 		decoration = "flowers:tulip", | ||||||
| 		end | 	}) | ||||||
| 		end | 	 | ||||||
| 		-- Generate papyrus | 	minetest.register_decoration({ | ||||||
| 		local perlin1 = minetest.env:get_perlin(354, 3, 0.7, 100) | 		deco_type = "simple", | ||||||
| 		-- Assume X and Z lengths are equal | 		place_on = {"default:dirt_with_grass"}, | ||||||
| 		local divlen = 8 | 		sidelen = 16, | ||||||
| 		local divs = (maxp.x-minp.x)/divlen+1; | 		noise_params = { | ||||||
| 		for divx=0,divs-1 do | 			offset = -0.015, | ||||||
| 		for divz=0,divs-1 do | 			scale = 0.03, | ||||||
| 			local x0 = minp.x + math.floor((divx+0)*divlen) | 			spread = {x=100, y=100, z=100}, | ||||||
| 			local z0 = minp.z + math.floor((divz+0)*divlen) | 			seed = 1220999, | ||||||
| 			local x1 = minp.x + math.floor((divx+1)*divlen) | 			octaves = 3, | ||||||
| 			local z1 = minp.z + math.floor((divz+1)*divlen) | 			persist = 0.6 | ||||||
| 			-- Determine papyrus amount from perlin noise | 		}, | ||||||
| 			local papyrus_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 45 - 20) | 		biomes = {"grassland"}, | ||||||
| 			-- Find random positions for papyrus based on this random | 		y_min = -32000, | ||||||
| 			local pr = PseudoRandom(seed+1) | 		y_max = 32000, | ||||||
| 			for i=0,papyrus_amount do | 		decoration = "flowers:dandelion_yellow", | ||||||
| 				local x = pr:next(x0, x1) | 	}) | ||||||
| 				local z = pr:next(z0, z1) | 	 | ||||||
| 				if minetest.env:get_node({x=x,y=1,z=z}).name == "default:dirt_with_grass" and | 	minetest.register_decoration({ | ||||||
| 						minetest.env:find_node_near({x=x,y=1,z=z}, 1, "default:water_source") then | 		deco_type = "simple", | ||||||
| 					default.make_papyrus({x=x,y=2,z=z}, pr:next(2, 4)) | 		place_on = {"default:dirt_with_grass"}, | ||||||
| 				end | 		sidelen = 16, | ||||||
| 			end | 		noise_params = { | ||||||
| 		end | 			offset = -0.015, | ||||||
| 		end | 			scale = 0.03, | ||||||
| 		-- Generate cactuses | 			spread = {x=100, y=100, z=100}, | ||||||
| 		local perlin1 = minetest.env:get_perlin(230, 3, 0.6, 100) | 			seed = 36662, | ||||||
| 		-- Assume X and Z lengths are equal | 			octaves = 3, | ||||||
| 		local divlen = 16 | 			persist = 0.6 | ||||||
| 		local divs = (maxp.x-minp.x)/divlen+1; | 		}, | ||||||
| 		for divx=0,divs-1 do | 		biomes = {"grassland"}, | ||||||
| 		for divz=0,divs-1 do | 		y_min = -32000, | ||||||
| 			local x0 = minp.x + math.floor((divx+0)*divlen) | 		y_max = 32000, | ||||||
| 			local z0 = minp.z + math.floor((divz+0)*divlen) | 		decoration = "flowers:geranium", | ||||||
| 			local x1 = minp.x + math.floor((divx+1)*divlen) | 	}) | ||||||
| 			local z1 = minp.z + math.floor((divz+1)*divlen) | 	 | ||||||
| 			-- Determine cactus amount from perlin noise | 	minetest.register_decoration({ | ||||||
| 			local cactus_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 6 - 3) | 		deco_type = "simple", | ||||||
| 			-- Find random positions for cactus based on this random | 		place_on = {"default:dirt_with_grass"}, | ||||||
| 			local pr = PseudoRandom(seed+1) | 		sidelen = 16, | ||||||
| 			for i=0,cactus_amount do | 		noise_params = { | ||||||
| 				local x = pr:next(x0, x1) | 			offset = -0.015, | ||||||
| 				local z = pr:next(z0, z1) | 			scale = 0.03, | ||||||
| 				-- Find ground level (0...15) | 			spread = {x=100, y=100, z=100}, | ||||||
| 				local ground_y = nil | 			seed = 1133, | ||||||
| 				for y=30,0,-1 do | 			octaves = 3, | ||||||
| 					if minetest.env:get_node({x=x,y=y,z=z}).name ~= "air" then | 			persist = 0.6 | ||||||
| 						ground_y = y | 		}, | ||||||
| 						break | 		biomes = {"grassland"}, | ||||||
| 					end | 		y_min = -32000, | ||||||
| 				end | 		y_max = 32000, | ||||||
| 				-- If desert sand, make cactus | 		decoration = "flowers:viola", | ||||||
| 				if ground_y and minetest.env:get_node({x=x,y=ground_y,z=z}).name == "default:desert_sand" then | 	}) | ||||||
| 					default.make_cactus({x=x,y=ground_y+1,z=z}, pr:next(3, 4)) | 	 | ||||||
| 				end | 	minetest.register_decoration({ | ||||||
| 			end | 		deco_type = "simple", | ||||||
| 		end | 		place_on = {"default:dirt_with_grass"}, | ||||||
| 		end | 		sidelen = 16, | ||||||
| 		-- Generate dry shrubs | 		noise_params = { | ||||||
| 		local perlin1 = minetest.env:get_perlin(329, 3, 0.6, 100) | 			offset = -0.015, | ||||||
| 		-- Assume X and Z lengths are equal | 			scale = 0.03, | ||||||
| 		local divlen = 16 | 			spread = {x=100, y=100, z=100}, | ||||||
| 		local divs = (maxp.x-minp.x)/divlen+1; | 			seed = 73133, | ||||||
| 		for divx=0,divs-1 do | 			octaves = 3, | ||||||
| 		for divz=0,divs-1 do | 			persist = 0.6 | ||||||
| 			local x0 = minp.x + math.floor((divx+0)*divlen) | 		}, | ||||||
| 			local z0 = minp.z + math.floor((divz+0)*divlen) | 		biomes = {"grassland"}, | ||||||
| 			local x1 = minp.x + math.floor((divx+1)*divlen) | 		y_min = -32000, | ||||||
| 			local z1 = minp.z + math.floor((divz+1)*divlen) | 		y_max = 32000, | ||||||
| 			-- Determine dry shrubs amount from perlin noise | 		decoration = "flowers:dandelion_white", | ||||||
| 			local shrub_amount = math.floor(perlin1:get2d({x=x0, y=z0}) * 5 + 0) | 	}) | ||||||
| 			-- Find random positions for dry shrubs based on this random | 	 | ||||||
| 			local pr = PseudoRandom(seed+1) | 	-- Grasses | ||||||
| 			for i=0,shrub_amount do |  | ||||||
| 				local x = pr:next(x0, x1) |  | ||||||
| 				local z = pr:next(z0, z1) |  | ||||||
| 				-- Find ground level (0...15) |  | ||||||
| 				local ground_y = nil |  | ||||||
| 				for y=30,0,-1 do |  | ||||||
| 					if minetest.env:get_node({x=x,y=y,z=z}).name ~= "air" then |  | ||||||
| 						ground_y = y |  | ||||||
| 						break |  | ||||||
| 					end |  | ||||||
| 				end |  | ||||||
| 				-- If desert sand, make dry shrub |  | ||||||
| 				if ground_y and minetest.env:get_node({x=x,y=ground_y,z=z}).name == "default:desert_sand" then |  | ||||||
| 					local p = {x=x,y=ground_y+1,z=z} |  | ||||||
| 					local nn = minetest.env:get_node(p).name |  | ||||||
| 					if minetest.registered_nodes[nn] and |  | ||||||
| 						minetest.registered_nodes[nn].buildable_to then |  | ||||||
| 						minetest.env:set_node(p, {name="default:dry_shrub"}) |  | ||||||
| 					end |  | ||||||
| 				end |  | ||||||
| 			end |  | ||||||
| 		end |  | ||||||
| 		end |  | ||||||
| 	end |  | ||||||
|  |  | ||||||
| 	-- Generate nyan cats | 	minetest.register_decoration({ | ||||||
| 	generate_nyancats(seed, minp, maxp) | 		deco_type = "simple", | ||||||
| end) | 		place_on = {"default:dirt_with_grass"}, | ||||||
|  | 		sidelen = 16, | ||||||
|  | 		noise_params = { | ||||||
|  | 			offset = 0.04, | ||||||
|  | 			scale = 0.08, | ||||||
|  | 			spread = {x=100, y=100, z=100}, | ||||||
|  | 			seed = 66440, | ||||||
|  | 			octaves = 3, | ||||||
|  | 			persist = 0.6 | ||||||
|  | 		}, | ||||||
|  | 		biomes = {"grassland"}, | ||||||
|  | 		y_min = -32000, | ||||||
|  | 		y_max = 32000, | ||||||
|  | 		decoration = "default:grass_1", | ||||||
|  | 	}) | ||||||
|  | 	 | ||||||
|  | 	minetest.register_decoration({ | ||||||
|  | 		deco_type = "simple", | ||||||
|  | 		place_on = {"default:dirt_with_grass"}, | ||||||
|  | 		sidelen = 16, | ||||||
|  | 		noise_params = { | ||||||
|  | 			offset = 0.02, | ||||||
|  | 			scale = 0.08, | ||||||
|  | 			spread = {x=100, y=100, z=100}, | ||||||
|  | 			seed = 66440, | ||||||
|  | 			octaves = 3, | ||||||
|  | 			persist = 0.6 | ||||||
|  | 		}, | ||||||
|  | 		biomes = {"grassland"}, | ||||||
|  | 		y_min = -32000, | ||||||
|  | 		y_max = 32000, | ||||||
|  | 		decoration = "default:grass_2", | ||||||
|  | 	}) | ||||||
|  | 	 | ||||||
|  | 	minetest.register_decoration({ | ||||||
|  | 		deco_type = "simple", | ||||||
|  | 		place_on = {"default:dirt_with_grass"}, | ||||||
|  | 		sidelen = 16, | ||||||
|  | 		noise_params = { | ||||||
|  | 			offset = 0, | ||||||
|  | 			scale = 0.08, | ||||||
|  | 			spread = {x=100, y=100, z=100}, | ||||||
|  | 			seed = 66440, | ||||||
|  | 			octaves = 3, | ||||||
|  | 			persist = 0.6 | ||||||
|  | 		}, | ||||||
|  | 		biomes = {"grassland"}, | ||||||
|  | 		y_min = -32000, | ||||||
|  | 		y_max = 32000, | ||||||
|  | 		decoration = "default:grass_3", | ||||||
|  | 	}) | ||||||
|  | 	 | ||||||
|  | 	minetest.register_decoration({ | ||||||
|  | 		deco_type = "simple", | ||||||
|  | 		place_on = {"default:dirt_with_grass"}, | ||||||
|  | 		sidelen = 16, | ||||||
|  | 		noise_params = { | ||||||
|  | 			offset = -0.02, | ||||||
|  | 			scale = 0.08, | ||||||
|  | 			spread = {x=100, y=100, z=100}, | ||||||
|  | 			seed = 66440, | ||||||
|  | 			octaves = 3, | ||||||
|  | 			persist = 0.6 | ||||||
|  | 		}, | ||||||
|  | 		biomes = {"grassland"}, | ||||||
|  | 		y_min = -32000, | ||||||
|  | 		y_max = 32000, | ||||||
|  | 		decoration = "default:grass_4", | ||||||
|  | 	}) | ||||||
|  | 	 | ||||||
|  | 	minetest.register_decoration({ | ||||||
|  | 		deco_type = "simple", | ||||||
|  | 		place_on = {"default:dirt_with_grass"}, | ||||||
|  | 		sidelen = 16, | ||||||
|  | 		noise_params = { | ||||||
|  | 			offset = -0.04, | ||||||
|  | 			scale = 0.08, | ||||||
|  | 			spread = {x=100, y=100, z=100}, | ||||||
|  | 			seed = 66440, | ||||||
|  | 			octaves = 3, | ||||||
|  | 			persist = 0.6 | ||||||
|  | 		}, | ||||||
|  | 		biomes = {"grassland"}, | ||||||
|  | 		y_min = -32000, | ||||||
|  | 		y_max = 32000, | ||||||
|  | 		decoration = "default:grass_5", | ||||||
|  | 	}) | ||||||
|  | 	 | ||||||
|  | end | ||||||
|  |  | ||||||
|  | -- | ||||||
|  | -- Detect mapgen and select suitable biome code | ||||||
|  | -- | ||||||
|  |  | ||||||
|  | local mg_params = minetest.get_mapgen_params() | ||||||
|  | if mg_params.mgname == "v6" then | ||||||
|  | 	minetest.register_on_generated(default.mgv6_ongen) | ||||||
|  | else | ||||||
|  | 	default.register_biomes() | ||||||
|  | end | ||||||
|  |  | ||||||
|   | |||||||
| Before Width: | Height: | Size: 2.0 KiB After Width: | Height: | Size: 2.7 KiB | 
							
								
								
									
										1481
									
								
								mods/default/nodes.lua
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -1,132 +1,159 @@ | |||||||
| -- Minetest 0.4 mod: player | -- Minetest 0.4 mod: player | ||||||
| -- See README.txt for licensing and other information. | -- See README.txt for licensing and other information. | ||||||
|  |  | ||||||
| -- |  | ||||||
| -- Start of configuration area: |  | ||||||
| -- |  | ||||||
|  |  | ||||||
| -- Player animation speed |  | ||||||
| animation_speed = 30 |  | ||||||
|  |  | ||||||
| -- Player animation blending | -- Player animation blending | ||||||
| -- Note: This is currently broken due to a bug in Irrlicht, leave at 0 | -- Note: This is currently broken due to a bug in Irrlicht, leave at 0 | ||||||
| animation_blend = 0 | local animation_blend = 0 | ||||||
|  |  | ||||||
| -- Default player appearance | default.registered_player_models = { } | ||||||
| default_model = "character.x" |  | ||||||
| default_textures = {"character.png", } |  | ||||||
|  |  | ||||||
| -- Frame ranges for each player model | -- Local for speed. | ||||||
| function player_get_animations(model) | local models = default.registered_player_models | ||||||
| 	if model == "character.x" then |  | ||||||
| 		return { | function default.player_register_model(name, def) | ||||||
| 		stand_START = 0, | 	models[name] = def | ||||||
| 		stand_END = 79, |  | ||||||
| 		sit_START = 81, |  | ||||||
| 		sit_END = 160, |  | ||||||
| 		lay_START = 162, |  | ||||||
| 		lay_END = 166, |  | ||||||
| 		walk_START = 168, |  | ||||||
| 		walk_END = 187, |  | ||||||
| 		mine_START = 189, |  | ||||||
| 		mine_END = 198, |  | ||||||
| 		walk_mine_START = 200, |  | ||||||
| 		walk_mine_END = 219 |  | ||||||
| 		} |  | ||||||
| 	end |  | ||||||
| end | end | ||||||
|  |  | ||||||
| -- | -- Default player appearance | ||||||
| -- End of configuration area. | default.player_register_model("character.x", { | ||||||
| -- | 	animation_speed = 30, | ||||||
|  | 	textures = {"character.png", }, | ||||||
|  | 	animations = { | ||||||
|  | 		-- Standard animations. | ||||||
|  | 		stand     = { x=  0, y= 79, }, | ||||||
|  | 		lay       = { x=162, y=166, }, | ||||||
|  | 		walk      = { x=168, y=187, }, | ||||||
|  | 		mine      = { x=189, y=198, }, | ||||||
|  | 		walk_mine = { x=200, y=219, }, | ||||||
|  | 		-- Extra animations (not currently used by the game). | ||||||
|  | 		sit       = { x= 81, y=160, }, | ||||||
|  | 	}, | ||||||
|  | }) | ||||||
|  |  | ||||||
| -- Player stats and animations | -- Player stats and animations | ||||||
| local player_model = {} | local player_model = {} | ||||||
|  | local player_textures = {} | ||||||
| local player_anim = {} | local player_anim = {} | ||||||
| local player_sneak = {} | local player_sneak = {} | ||||||
| local ANIM_STAND = 1 | default.player_attached = {} | ||||||
| local ANIM_SIT = 2 |  | ||||||
| local ANIM_LAY = 3 | function default.player_get_animation(player) | ||||||
| local ANIM_WALK  = 4 | 	local name = player:get_player_name() | ||||||
| local ANIM_WALK_MINE = 5 | 	return { | ||||||
| local ANIM_MINE = 6 | 		model = player_model[name], | ||||||
|  | 		textures = player_textures[name], | ||||||
|  | 		animation = player_anim[name], | ||||||
|  | 	} | ||||||
|  | end | ||||||
|  |  | ||||||
| -- Called when a player's appearance needs to be updated | -- Called when a player's appearance needs to be updated | ||||||
| function player_update_visuals(pl) | function default.player_set_model(player, model_name) | ||||||
| 	local name = pl:get_player_name() | 	local name = player:get_player_name() | ||||||
|  | 	local model = models[model_name] | ||||||
|  | 	if model then | ||||||
|  | 		if player_model[name] == model_name then | ||||||
|  | 			return | ||||||
|  | 		end | ||||||
|  | 		player:set_properties({ | ||||||
|  | 			mesh = model_name, | ||||||
|  | 			textures = player_textures[name] or model.textures, | ||||||
|  | 			visual = "mesh", | ||||||
|  | 			visual_size = model.visual_size or {x=1, y=1}, | ||||||
|  | 		}) | ||||||
|  | 		default.player_set_animation(player, "stand") | ||||||
|  | 	else | ||||||
|  | 		player:set_properties({ | ||||||
|  | 			textures = { "player.png", "player_back.png", }, | ||||||
|  | 			visual = "upright_sprite", | ||||||
|  | 		}) | ||||||
|  | 	end | ||||||
|  | 	player_model[name] = model_name | ||||||
|  | end | ||||||
|  |  | ||||||
| 	player_model[name] = default_model | function default.player_set_textures(player, textures) | ||||||
| 	player_anim[name] = 0 -- Animation will be set further below immediately | 	local name = player:get_player_name() | ||||||
| 	player_sneak[name] = false | 	player_textures[name] = textures | ||||||
| 	prop = { | 	player:set_properties({textures = textures,}) | ||||||
| 		mesh = default_model, | end | ||||||
| 		textures = default_textures, |  | ||||||
| 		visual = "mesh", | function default.player_set_animation(player, anim_name, speed) | ||||||
| 		visual_size = {x=1, y=1}, | 	local name = player:get_player_name() | ||||||
| 	} | 	if player_anim[name] == anim_name then | ||||||
| 	pl:set_properties(prop) | 		return | ||||||
|  | 	end | ||||||
|  | 	local model = player_model[name] and models[player_model[name]] | ||||||
|  | 	if not (model and model.animations[anim_name]) then | ||||||
|  | 		return | ||||||
|  | 	end | ||||||
|  | 	local anim = model.animations[anim_name] | ||||||
|  | 	player_anim[name] = anim_name | ||||||
|  | 	player:set_animation(anim, speed or model.animation_speed, animation_blend) | ||||||
| end | end | ||||||
|  |  | ||||||
| -- Update appearance when the player joins | -- Update appearance when the player joins | ||||||
| minetest.register_on_joinplayer(player_update_visuals) | minetest.register_on_joinplayer(function(player) | ||||||
|  | 	default.player_attached[player:get_player_name()] = false | ||||||
|  | 	default.player_set_model(player, "character.x") | ||||||
|  | 	player:set_local_animation({x=0, y=79}, {x=168, y=187}, {x=189, y=198}, {x=200, y=219}, 30) | ||||||
|  | 	 | ||||||
|  | 	-- set GUI | ||||||
|  | 	if not minetest.setting_getbool("creative_mode") then | ||||||
|  | 		player:set_inventory_formspec(default.gui_survival_form) | ||||||
|  | 	end | ||||||
|  | 	player:hud_set_hotbar_image("gui_hotbar.png") | ||||||
|  | 	player:hud_set_hotbar_selected_image("gui_hotbar_selected.png") | ||||||
|  | end) | ||||||
|  |  | ||||||
|  | minetest.register_on_leaveplayer(function(player) | ||||||
|  | 	local name = player:get_player_name() | ||||||
|  | 	player_model[name] = nil | ||||||
|  | 	player_anim[name] = nil | ||||||
|  | 	player_textures[name] = nil | ||||||
|  | end) | ||||||
|  |  | ||||||
|  | -- Localize for better performance. | ||||||
|  | local player_set_animation = default.player_set_animation | ||||||
|  | local player_attached = default.player_attached | ||||||
|  |  | ||||||
| -- Check each player and apply animations | -- Check each player and apply animations | ||||||
| function player_step(dtime) | minetest.register_globalstep(function(dtime) | ||||||
| 	for _, pl in pairs(minetest.get_connected_players()) do | 	for _, player in pairs(minetest.get_connected_players()) do | ||||||
| 		local name = pl:get_player_name() | 		local name = player:get_player_name() | ||||||
| 		local anim = player_get_animations(player_model[name]) | 		local model_name = player_model[name] | ||||||
| 		local controls = pl:get_player_control() | 		local model = model_name and models[model_name] | ||||||
| 		local walking = false | 		if model and not player_attached[name] then | ||||||
| 		local animation_speed_mod = animation_speed | 			local controls = player:get_player_control() | ||||||
|  | 			local walking = false | ||||||
|  | 			local animation_speed_mod = model.animation_speed or 30 | ||||||
|  |  | ||||||
| 		-- Determine if the player is walking | 			-- Determine if the player is walking | ||||||
| 		if controls.up or controls.down or controls.left or controls.right then | 			if controls.up or controls.down or controls.left or controls.right then | ||||||
| 			walking = true | 				walking = true | ||||||
| 		end | 			end | ||||||
|  |  | ||||||
| 		-- Determine if the player is sneaking, and reduce animation speed if so | 			-- Determine if the player is sneaking, and reduce animation speed if so | ||||||
| 		if controls.sneak and pl:get_hp() ~= 0 and (walking or controls.LMB) then | 			if controls.sneak then | ||||||
| 			animation_speed_mod = animation_speed_mod / 2 | 				animation_speed_mod = animation_speed_mod / 2 | ||||||
| 			-- Refresh player animation below if sneak state changed |  | ||||||
| 			if not player_sneak[name] then |  | ||||||
| 				player_anim[name] = 0 |  | ||||||
| 				player_sneak[name] = true |  | ||||||
| 			end | 			end | ||||||
| 		else |  | ||||||
| 			-- Refresh player animation below if sneak state changed |  | ||||||
| 			if player_sneak[name] then |  | ||||||
| 				player_anim[name] = 0 |  | ||||||
| 				player_sneak[name] = false |  | ||||||
| 			end |  | ||||||
| 		end |  | ||||||
|  |  | ||||||
| 		-- Apply animations based on what the player is doing | 			-- Apply animations based on what the player is doing | ||||||
| 		if pl:get_hp() == 0 then | 			if player:get_hp() == 0 then | ||||||
| 			if player_anim[name] ~= ANIM_LAY then | 				player_set_animation(player, "lay") | ||||||
| 				pl:set_animation({x=anim.lay_START, y=anim.lay_END}, animation_speed_mod, animation_blend) | 			elseif walking then | ||||||
| 				player_anim[name] = ANIM_LAY | 				if player_sneak[name] ~= controls.sneak then | ||||||
|  | 					player_anim[name] = nil | ||||||
|  | 					player_sneak[name] = controls.sneak | ||||||
|  | 				end | ||||||
|  | 				if controls.LMB then | ||||||
|  | 					player_set_animation(player, "walk_mine", animation_speed_mod) | ||||||
|  | 				else | ||||||
|  | 					player_set_animation(player, "walk", animation_speed_mod) | ||||||
|  | 				end | ||||||
|  | 			elseif controls.LMB then | ||||||
|  | 				player_set_animation(player, "mine") | ||||||
|  | 			else | ||||||
|  | 				player_set_animation(player, "stand", animation_speed_mod) | ||||||
| 			end | 			end | ||||||
| 		elseif walking and controls.LMB then |  | ||||||
| 			if player_anim[name] ~= ANIM_WALK_MINE then |  | ||||||
| 				pl:set_animation({x=anim.walk_mine_START, y=anim.walk_mine_END}, animation_speed_mod, animation_blend) |  | ||||||
| 				player_anim[name] = ANIM_WALK_MINE |  | ||||||
| 			end |  | ||||||
| 		elseif walking then |  | ||||||
| 			if player_anim[name] ~= ANIM_WALK then |  | ||||||
| 				pl:set_animation({x=anim.walk_START, y=anim.walk_END}, animation_speed_mod, animation_blend) |  | ||||||
| 				player_anim[name] = ANIM_WALK |  | ||||||
| 			end |  | ||||||
| 		elseif controls.LMB then |  | ||||||
| 			if player_anim[name] ~= ANIM_MINE then |  | ||||||
| 				pl:set_animation({x=anim.mine_START, y=anim.mine_END}, animation_speed_mod, animation_blend) |  | ||||||
| 				player_anim[name] = ANIM_MINE |  | ||||||
| 			end |  | ||||||
| 		elseif player_anim[name] ~= ANIM_STAND then |  | ||||||
| 			pl:set_animation({x=anim.stand_START, y=anim.stand_END}, animation_speed_mod, animation_blend) |  | ||||||
| 			player_anim[name] = ANIM_STAND |  | ||||||
| 		end | 		end | ||||||
| 	end | 	end | ||||||
| end | end) | ||||||
| minetest.register_globalstep(player_step) |  | ||||||
|  |  | ||||||
| -- END |  | ||||||
|   | |||||||
							
								
								
									
										
											BIN
										
									
								
								mods/default/sounds/default_cool_lava.1.ogg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								mods/default/sounds/default_cool_lava.2.ogg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								mods/default/sounds/default_cool_lava.3.ogg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								mods/default/sounds/default_dig_crumbly.ogg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								mods/default/sounds/default_dirt_footstep.1.ogg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								mods/default/sounds/default_dirt_footstep.2.ogg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								mods/default/sounds/default_dug_node.2.ogg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								mods/default/sounds/default_glass_footstep.ogg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								mods/default/sounds/default_hard_footstep.3.ogg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								mods/default/sounds/default_place_node_hard.1.ogg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								mods/default/sounds/default_place_node_hard.2.ogg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								mods/default/sounds/default_sand_footstep.1.ogg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								mods/default/sounds/default_sand_footstep.2.ogg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								mods/default/sounds/default_snow_footstep.1.ogg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								mods/default/sounds/default_snow_footstep.2.ogg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								mods/default/sounds/default_snow_footstep.3.ogg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								mods/default/sounds/default_wood_footstep.1.ogg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								mods/default/sounds/default_wood_footstep.2.ogg
									
									
									
									
									
										Normal file
									
								
							
							
						
						
							
								
								
									
										
											BIN
										
									
								
								mods/default/textures/bubble.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 544 B | 
| Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 583 B | 
| Before Width: | Height: | Size: 283 B After Width: | Height: | Size: 320 B | 
| Before Width: | Height: | Size: 292 B After Width: | Height: | Size: 222 B | 
| Before Width: | Height: | Size: 597 B After Width: | Height: | Size: 639 B | 
| Before Width: | Height: | Size: 626 B After Width: | Height: | Size: 596 B | 
							
								
								
									
										
											BIN
										
									
								
								mods/default/textures/default_bronze_block.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 568 B | 
							
								
								
									
										
											BIN
										
									
								
								mods/default/textures/default_bronze_ingot.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 232 B | 
| Before Width: | Height: | Size: 763 B After Width: | Height: | Size: 589 B | 
| Before Width: | Height: | Size: 682 B After Width: | Height: | Size: 546 B | 
							
								
								
									
										
											BIN
										
									
								
								mods/default/textures/default_chest_front.png
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						| Before Width: | Height: | Size: 769 B After Width: | Height: | Size: 630 B | 
| Before Width: | Height: | Size: 871 B After Width: | Height: | Size: 670 B | 
							
								
								
									
										
											BIN
										
									
								
								mods/default/textures/default_chest_side.png
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						| Before Width: | Height: | Size: 714 B After Width: | Height: | Size: 576 B | 
							
								
								
									
										
											BIN
										
									
								
								mods/default/textures/default_chest_top.png
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						| Before Width: | Height: | Size: 628 B After Width: | Height: | Size: 607 B | 
| Before Width: | Height: | Size: 613 B After Width: | Height: | Size: 318 B | 
| Before Width: | Height: | Size: 271 B After Width: | Height: | Size: 178 B | 
| Before Width: | Height: | Size: 210 B After Width: | Height: | Size: 167 B | 
| Before Width: | Height: | Size: 118 B After Width: | Height: | Size: 83 B | 
							
								
								
									
										
											BIN
										
									
								
								mods/default/textures/default_coal_block.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 290 B | 
| Before Width: | Height: | Size: 933 B After Width: | Height: | Size: 160 B | 
							
								
								
									
										
											BIN
										
									
								
								mods/default/textures/default_cobble.png
									
									
									
									
									
										
										
										Executable file → Normal file
									
								
							
							
						
						| Before Width: | Height: | Size: 744 B After Width: | Height: | Size: 739 B |