Compare commits
	
		
			173 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
|  | 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 | 
| @@ -1,7 +1,7 @@ | |||||||
| 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. | ||||||
|  |  | ||||||
| @@ -14,7 +14,7 @@ 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 | ||||||
|   http://minetest.net/download.php |   http://minetest.net/download.php | ||||||
| @@ -50,4 +50,3 @@ http://creativecommons.org/licenses/by-sa/3.0/ | |||||||
|  |  | ||||||
| License of menu/header.png | License of menu/header.png | ||||||
| Copyright (C) 2013 BlockMen CC BY-3.0 | Copyright (C) 2013 BlockMen CC BY-3.0 | ||||||
|  |  | ||||||
|   | |||||||
							
								
								
									
										277
									
								
								game_api.txt
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,277 @@ | |||||||
|  | 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. | ||||||
|  |  | ||||||
|  | 	doors.register_door(name, def) | ||||||
|  | 	^ name: "Door name" | ||||||
|  | 	^ def: See [#Door definition] | ||||||
|  | 	 | ||||||
|  | #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) | ||||||
|  | } | ||||||
|  |  | ||||||
|  | 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 = 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() | ||||||
|  |  | ||||||
|  | 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 | ||||||
							
								
								
									
										
											BIN
										
									
								
								menu/icon.png
									
									
									
									
									
								
							
							
						
						| Before Width: | Height: | Size: 2.5 KiB After Width: | Height: | Size: 5.6 KiB | 
							
								
								
									
										6
									
								
								minetest.conf
									
									
									
									
									
										Normal file
									
								
							
							
						
						| @@ -0,0 +1,6 @@ | |||||||
|  | mg_flags = dungeons | ||||||
|  | mgv6_spflags = biomeblend, jungles | ||||||
|  |  | ||||||
|  | movement_liquid_sink = 25 | ||||||
|  | movement_liquid_fluidity = 0.8 | ||||||
|  | movement_liquid_fluidity_smooth = 2 | ||||||
							
								
								
									
										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) | ||||||
							
								
								
									
										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 | 
| @@ -22,7 +22,8 @@ minetest.register_node("bones:bones", { | |||||||
| 	paramtype2 = "facedir", | 	paramtype2 = "facedir", | ||||||
| 	groups = {dig_immediate=2}, | 	groups = {dig_immediate=2}, | ||||||
| 	sounds = default.node_sound_dirt_defaults({ | 	sounds = default.node_sound_dirt_defaults({ | ||||||
| 		footstep = {name="default_gravel_footstep", gain=0.45}, | 		footstep = {name="default_gravel_footstep", gain=0.5}, | ||||||
|  | 		dug = {name="default_gravel_footstep", gain=1.0}, | ||||||
| 	}), | 	}), | ||||||
| 	 | 	 | ||||||
| 	can_dig = function(pos, player) | 	can_dig = function(pos, player) | ||||||
| @@ -50,10 +51,34 @@ minetest.register_node("bones:bones", { | |||||||
| 	 | 	 | ||||||
| 	on_metadata_inventory_take = function(pos, listname, index, stack, player) | 	on_metadata_inventory_take = function(pos, listname, index, stack, player) | ||||||
| 		local meta = minetest.get_meta(pos) | 		local meta = minetest.get_meta(pos) | ||||||
| 		if meta:get_string("owner") ~= "" and meta:get_inventory():is_empty("main") then | 		if meta:get_inventory():is_empty("main") then | ||||||
| 			meta:set_string("infotext", meta:get_string("owner").."'s old bones") | 			minetest.remove_node(pos) | ||||||
| 			meta:set_string("formspec", "") | 		end | ||||||
| 			meta:set_string("owner", "") | 	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 | ||||||
| 	end, | 	end, | ||||||
| 	 | 	 | ||||||
| @@ -81,23 +106,34 @@ minetest.register_on_dieplayer(function(player) | |||||||
| 		return | 		return | ||||||
| 	end | 	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() | 	local pos = player:getpos() | ||||||
| 	pos.x = math.floor(pos.x+0.5) | 	pos.x = math.floor(pos.x+0.5) | ||||||
| 	pos.y = math.floor(pos.y+0.5) | 	pos.y = math.floor(pos.y+0.5) | ||||||
| 	pos.z = math.floor(pos.z+0.5) | 	pos.z = math.floor(pos.z+0.5) | ||||||
| 	local param2 = minetest.dir_to_facedir(player:get_look_dir()) | 	local param2 = minetest.dir_to_facedir(player:get_look_dir()) | ||||||
|  | 	local player_name = player:get_player_name() | ||||||
|  | 	local player_inv = player:get_inventory() | ||||||
| 	 | 	 | ||||||
| 	local nn = minetest.get_node(pos).name | 	local nn = minetest.get_node(pos).name | ||||||
| 	if minetest.registered_nodes[nn].can_dig and | 	if minetest.registered_nodes[nn].can_dig and | ||||||
| 		not minetest.registered_nodes[nn].can_dig(pos, player) then | 		not minetest.registered_nodes[nn].can_dig(pos, player) then | ||||||
| 		local player_inv = player:get_inventory() |  | ||||||
|  |  | ||||||
|  | 		-- drop items instead of delete | ||||||
| 		for i=1,player_inv:get_size("main") do | 		for i=1,player_inv:get_size("main") do | ||||||
| 			player_inv:set_stack("main", i, nil) | 			minetest.add_item(pos, player_inv:get_stack("main", i)) | ||||||
| 		end | 		end | ||||||
| 		for i=1,player_inv:get_size("craft") do | 		for i=1,player_inv:get_size("craft") do | ||||||
| 			player_inv:set_stack("craft", i, nil) | 			minetest.add_item(pos, player_inv:get_stack("craft", i)) | ||||||
| 		end | 		end | ||||||
|  | 		-- empty lists main and craft | ||||||
|  | 		player_inv:set_list("main", {}) | ||||||
|  | 		player_inv:set_list("craft", {}) | ||||||
| 		return | 		return | ||||||
| 	end | 	end | ||||||
| 	 | 	 | ||||||
| @@ -106,23 +142,27 @@ minetest.register_on_dieplayer(function(player) | |||||||
| 	 | 	 | ||||||
| 	local meta = minetest.get_meta(pos) | 	local meta = minetest.get_meta(pos) | ||||||
| 	local inv = meta:get_inventory() | 	local inv = meta:get_inventory() | ||||||
| 	local player_inv = player:get_inventory() |  | ||||||
| 	inv:set_size("main", 8*4) | 	inv:set_size("main", 8*4) | ||||||
| 	 |  | ||||||
| 	local empty_list = inv:get_list("main") |  | ||||||
| 	inv:set_list("main", player_inv:get_list("main")) | 	inv:set_list("main", player_inv:get_list("main")) | ||||||
| 	player_inv:set_list("main", empty_list) |  | ||||||
| 	 | 	 | ||||||
| 	for i=1,player_inv:get_size("craft") do | 	for i=1,player_inv:get_size("craft") do | ||||||
| 		inv:add_item("main", player_inv:get_stack("craft", i)) | 		local stack = player_inv:get_stack("craft", i) | ||||||
| 		player_inv:set_stack("craft", i, nil) | 		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 | 	end | ||||||
| 	 | 	 | ||||||
|  | 	player_inv:set_list("main", {}) | ||||||
|  | 	player_inv:set_list("craft", {}) | ||||||
|  | 	 | ||||||
| 	meta:set_string("formspec", "size[8,9;]".. | 	meta:set_string("formspec", "size[8,9;]".. | ||||||
| 			"list[current_name;main;0,0;8,4;]".. | 			"list[current_name;main;0,0;8,4;]".. | ||||||
| 			"list[current_player;main;0,5;8,4;]") | 			"list[current_player;main;0,5;8,4;]") | ||||||
| 	meta:set_string("infotext", player:get_player_name().."'s fresh bones") | 	meta:set_string("infotext", player_name.."'s fresh bones") | ||||||
| 	meta:set_string("owner", player:get_player_name()) | 	meta:set_string("owner", player_name) | ||||||
| 	meta:set_int("time", 0) | 	meta:set_int("time", 0) | ||||||
| 	 | 	 | ||||||
| 	local timer  = minetest.get_node_timer(pos) | 	local timer  = minetest.get_node_timer(pos) | ||||||
|   | |||||||
| Before Width: | Height: | Size: 284 B After Width: | Height: | Size: 181 B | 
| Before Width: | Height: | Size: 300 B After Width: | Height: | Size: 183 B | 
| Before Width: | Height: | Size: 306 B After Width: | Height: | Size: 187 B | 
| Before Width: | Height: | Size: 289 B After Width: | Height: | Size: 188 B | 
| Before Width: | Height: | Size: 279 B After Width: | Height: | Size: 182 B | 
| @@ -1,8 +1,6 @@ | |||||||
| -- Minetest 0.4 mod: bucket | -- Minetest 0.4 mod: bucket | ||||||
| -- See README.txt for licensing and other information. | -- See README.txt for licensing and other information. | ||||||
|  |  | ||||||
| local LIQUID_MAX = 8  --The number of water levels when liquid_finite is enabled |  | ||||||
|  |  | ||||||
| minetest.register_alias("bucket", "bucket:bucket_empty") | minetest.register_alias("bucket", "bucket:bucket_empty") | ||||||
| minetest.register_alias("bucket_water", "bucket:bucket_water") | minetest.register_alias("bucket_water", "bucket:bucket_water") | ||||||
| minetest.register_alias("bucket_lava", "bucket:bucket_lava") | minetest.register_alias("bucket_lava", "bucket:bucket_lava") | ||||||
| @@ -18,6 +16,19 @@ 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 | ||||||
| @@ -38,44 +49,48 @@ function bucket.register_liquid(source, flowing, itemname, inventory_image, name | |||||||
| 			inventory_image = inventory_image, | 			inventory_image = inventory_image, | ||||||
| 			stack_max = 1, | 			stack_max = 1, | ||||||
| 			liquids_pointable = true, | 			liquids_pointable = true, | ||||||
| 			groups = {not_in_creative_inventory=1}, |  | ||||||
| 			on_place = 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 place_liquid = function(pos, node, source, flowing, fullness) | 				local node = minetest.get_node_or_nil(pointed_thing.under) | ||||||
| 					if math.floor(fullness/128) == 1 or (not minetest.setting_getbool("liquid_finite")) then | 				local ndef | ||||||
| 						minetest.add_node(pos, {name=source, param2=fullness}) | 				if node then | ||||||
| 						return | 					ndef = minetest.registered_nodes[node.name] | ||||||
| 					elseif node.name == flowing then | 				end | ||||||
| 						fullness = fullness + node.param2 | 				-- Call on_rightclick if the pointed node defines it | ||||||
| 					elseif node.name == source then | 				if ndef and ndef.on_rightclick and | ||||||
| 						fullness = LIQUID_MAX | 				   user and not user:get_player_control().sneak then | ||||||
| 					end | 					return ndef.on_rightclick( | ||||||
|  | 						pointed_thing.under, | ||||||
|  | 						node, user, | ||||||
|  | 						itemstack) or itemstack | ||||||
|  | 				end | ||||||
|  |  | ||||||
| 					if fullness >= LIQUID_MAX then | 				local place_liquid = function(pos, node, source, flowing) | ||||||
| 						minetest.add_node(pos, {name=source, param2=LIQUID_MAX}) | 					if check_protection(pos, | ||||||
| 					else | 							user and user:get_player_name() or "", | ||||||
| 						minetest.add_node(pos, {name=flowing, param2=fullness}) | 							"place "..source) then | ||||||
|  | 						return | ||||||
| 					end | 					end | ||||||
|  | 					minetest.add_node(pos, {name=source}) | ||||||
| 				end | 				end | ||||||
|  |  | ||||||
| 				-- Check if pointing to a buildable node | 				-- Check if pointing to a buildable node | ||||||
| 				local node = minetest.get_node(pointed_thing.under) | 				if ndef and ndef.buildable_to then | ||||||
| 				local fullness = tonumber(itemstack:get_metadata()) |  | ||||||
| 				if not fullness then fullness = LIQUID_MAX end |  | ||||||
|  |  | ||||||
| 				if minetest.registered_nodes[node.name].buildable_to then |  | ||||||
| 					-- buildable; replace the node | 					-- buildable; replace the node | ||||||
| 					place_liquid(pointed_thing.under, node, source, flowing, fullness) | 					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 | ||||||
| 					local node = minetest.get_node(pointed_thing.above) | 					local node = minetest.get_node_or_nil(pointed_thing.above) | ||||||
| 					if minetest.registered_nodes[node.name].buildable_to then | 					if node and minetest.registered_nodes[node.name].buildable_to then | ||||||
| 						place_liquid(pointed_thing.above, node, source, flowing, fullness) | 						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 | ||||||
| @@ -98,15 +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 | ||||||
| 		node = minetest.get_node(pointed_thing.under) | 		local node = minetest.get_node(pointed_thing.under) | ||||||
| 		liquiddef = bucket.liquids[node.name] | 		local liquiddef = bucket.liquids[node.name] | ||||||
| 		if liquiddef ~= nil and liquiddef.itemname ~= nil and (node.name == liquiddef.source or | 		if liquiddef ~= nil and liquiddef.itemname ~= nil and | ||||||
| 			(node.name == liquiddef.flowing and minetest.setting_getbool("liquid_finite"))) then | 				node.name == liquiddef.source then | ||||||
|  | 			if check_protection(pointed_thing.under, | ||||||
|  | 					user:get_player_name(), | ||||||
|  | 					"take ".. node.name) then | ||||||
|  | 				return | ||||||
|  | 			end | ||||||
|  |  | ||||||
| 			minetest.add_node(pointed_thing.under, {name="air"}) | 			minetest.add_node(pointed_thing.under, {name="air"}) | ||||||
|  |  | ||||||
| 			if node.name == liquiddef.source then node.param2 = LIQUID_MAX end | 			return ItemStack(liquiddef.itemname) | ||||||
| 			return ItemStack({name = liquiddef.itemname, metadata = tostring(node.param2)}) |  | ||||||
| 		end | 		end | ||||||
| 	end, | 	end, | ||||||
| }) | }) | ||||||
|   | |||||||
| Before Width: | Height: | Size: 278 B After Width: | Height: | Size: 163 B | 
| Before Width: | Height: | Size: 287 B After Width: | Height: | Size: 167 B | 
| Before Width: | Height: | Size: 288 B After Width: | Height: | Size: 169 B | 
| @@ -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, | ||||||
| 	}) | 	}) | ||||||
| @@ -47,7 +48,7 @@ minetest.after(0, function() | |||||||
| 		inv:add_item("main", ItemStack(itemstring)) | 		inv:add_item("main", ItemStack(itemstring)) | ||||||
| 	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 | ||||||
| @@ -71,9 +72,14 @@ 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;]".. | ||||||
| 			"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).."]".. | ||||||
| @@ -81,7 +87,9 @@ creative_inventory.set_creative_formspec = function(player, start_i, pagenum) | |||||||
| 			"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 | ||||||
| @@ -122,20 +130,21 @@ minetest.register_on_player_receive_fields(function(player, formname, fields) | |||||||
| end) | end) | ||||||
|  |  | ||||||
| if minetest.setting_getbool("creative_mode") then | if minetest.setting_getbool("creative_mode") then | ||||||
| 	 | 	local digtime = 0.5 | ||||||
| 	minetest.register_item(":", { | 	minetest.register_item(":", { | ||||||
| 		type = "none", | 		type = "none", | ||||||
| 		wield_image = "wieldhand.png", | 		wield_image = "wieldhand.png", | ||||||
| 		wield_scale = {x=1,y=1,z=2.5}, | 		wield_scale = {x=1,y=1,z=2.5}, | ||||||
|  | 		range = 10, | ||||||
| 		tool_capabilities = { | 		tool_capabilities = { | ||||||
| 			full_punch_interval = 0.5, | 			full_punch_interval = 0.5, | ||||||
| 			max_drop_level = 3, | 			max_drop_level = 3, | ||||||
| 			groupcaps = { | 			groupcaps = { | ||||||
| 				crumbly = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3}, | 				crumbly = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3}, | ||||||
| 				cracky = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3}, | 				cracky = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3}, | ||||||
| 				snappy = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3}, | 				snappy = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3}, | ||||||
| 				choppy = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3}, | 				choppy = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3}, | ||||||
| 				oddly_breakable_by_hand = {times={[1]=0.5, [2]=0.5, [3]=0.5}, uses=0, maxlevel=3}, | 				oddly_breakable_by_hand = {times={[1]=digtime, [2]=digtime, [3]=digtime}, uses=0, maxlevel=3}, | ||||||
| 			}, | 			}, | ||||||
| 			damage_groups = {fleshy = 10}, | 			damage_groups = {fleshy = 10}, | ||||||
| 		} | 		} | ||||||
|   | |||||||
| @@ -22,19 +22,7 @@ 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_stone_brick.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 | ||||||
| @@ -42,23 +30,17 @@ Cisoun's WTFPL texture pack: | |||||||
|   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 | ||||||
|   default_cobble.png |  | ||||||
|  |  | ||||||
| VanessaE's animated torches (WTFPL): | VanessaE's animated torches (WTFPL): | ||||||
|   default_torch_animated.png |   default_torch_animated.png | ||||||
| @@ -84,13 +66,10 @@ VanessaE (WTFPL): | |||||||
|  |  | ||||||
| Calinou (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_bronze_ingot.png |  | ||||||
|   default_copper_ingot.png |  | ||||||
|   default_copper_lump.png |   default_copper_lump.png | ||||||
|   default_mineral_copper.png |   default_mineral_copper.png | ||||||
|  |   default_glass_detail.png | ||||||
|  |  | ||||||
| MirceaKitsune (WTFPL): | MirceaKitsune (WTFPL): | ||||||
|   character.x |   character.x | ||||||
| @@ -104,22 +83,8 @@ PilzAdam (WTFPL): | |||||||
|   default_junglewood.png |   default_junglewood.png | ||||||
|   default_obsidian_glass.png |   default_obsidian_glass.png | ||||||
|   default_obsidian_shard.png |   default_obsidian_shard.png | ||||||
|   default_mossycobble.png |  | ||||||
|   default_gold_ingot.png |  | ||||||
|   default_gold_lump.png |   default_gold_lump.png | ||||||
|   default_mineral_gold.png |   default_mineral_gold.png | ||||||
|   default_diamond.png |  | ||||||
|   default_tool_diamondpick.png |  | ||||||
|   default_tool_diamondsword.png |  | ||||||
|   default_tool_diamondshovel.png |  | ||||||
|   default_tool_diamondaxe.png |  | ||||||
|   default_tool_meseaxe.png |  | ||||||
|   default_tool_meseshovel.png |  | ||||||
|   default_tool_mesesword.png |  | ||||||
|   default_tool_bronzeaxe.png |  | ||||||
|   default_tool_bronzepick.png |  | ||||||
|   default_tool_bronzeshovel.png |  | ||||||
|   default_tool_bronzesword.png |  | ||||||
|   default_snowball.png |   default_snowball.png | ||||||
|  |  | ||||||
| jojoa1997 (WTFPL): | jojoa1997 (WTFPL): | ||||||
| @@ -132,6 +97,7 @@ Splizard (CC BY-SA 3.0): | |||||||
|   default_snow.png |   default_snow.png | ||||||
|   default_snow_side.png |   default_snow_side.png | ||||||
|   default_ice.png |   default_ice.png | ||||||
|  |   default_pine_sapling.png | ||||||
|  |  | ||||||
| Zeg9 (CC BY-SA 3.0): | Zeg9 (CC BY-SA 3.0): | ||||||
|   default_coal_block.png |   default_coal_block.png | ||||||
| @@ -139,9 +105,87 @@ Zeg9 (CC BY-SA 3.0): | |||||||
|   default_copper_block.png |   default_copper_block.png | ||||||
|   default_bronze_block.png |   default_bronze_block.png | ||||||
|   default_gold_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_tool_steelsword.png | ||||||
|  |   default_bronze_ingot.png | ||||||
|  |   default_copper_ingot.png | ||||||
|  |   default_gold_ingot.png | ||||||
|  |   default_diamond.png | ||||||
|   default_diamond_block.png |   default_diamond_block.png | ||||||
|  |   default_tool_*.png | ||||||
|  |   default_lava_source_animated.png | ||||||
|  |   default_lava_flowing_animated.png | ||||||
|  |   default_book.png | ||||||
|  |   default_paper.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 | ||||||
|   | |||||||
| @@ -1,9 +1,5 @@ | |||||||
| -- legacy (Minetest 0.4 mod) | -- aliases (Minetest 0.4 mod) | ||||||
| -- Provides as much backwards-compatibility as feasible | -- Provides alias for most default items | ||||||
| 
 |  | ||||||
| -- |  | ||||||
| -- Aliases to support loading 0.3 and old 0.4 worlds and inventories |  | ||||||
| -- |  | ||||||
| 
 | 
 | ||||||
| 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") | ||||||
| @@ -69,39 +65,3 @@ 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") |  | ||||||
| 
 |  | ||||||
| -- |  | ||||||
| -- Old items |  | ||||||
| -- |  | ||||||
| 
 |  | ||||||
| minetest.register_craftitem(":rat", { |  | ||||||
| 	description = "Rat", |  | ||||||
| 	inventory_image = "rat.png", |  | ||||||
| }) |  | ||||||
| 
 |  | ||||||
| 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}, |  | ||||||
| }) |  | ||||||
| 
 |  | ||||||
| minetest.register_craft({ |  | ||||||
| 	type = "cooking", |  | ||||||
| 	output = "cooked_rat", |  | ||||||
| 	recipe = "rat", |  | ||||||
| }) |  | ||||||
| 
 |  | ||||||
| minetest.register_craft({ |  | ||||||
| 	type = "cooking", |  | ||||||
| 	output = "scorched_stuff", |  | ||||||
| 	recipe = "cooked_rat", |  | ||||||
| }) |  | ||||||
| 
 |  | ||||||
| -- END |  | ||||||
| @@ -14,6 +14,13 @@ minetest.register_craft({ | |||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:pinewood 4', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:pinetree'}, | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'default:stick 4', | 	output = 'default:stick 4', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| @@ -24,8 +31,8 @@ minetest.register_craft({ | |||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'default:fence_wood 2', | 	output = 'default:fence_wood 2', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:stick', 'default:stick', 'default:stick'}, | 		{'group:stick', 'group:stick', 'group:stick'}, | ||||||
| 		{'default:stick', 'default:stick', 'default:stick'}, | 		{'group:stick', 'group:stick', 'group:stick'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -34,7 +41,7 @@ minetest.register_craft({ | |||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'group:wood', 'group:wood', 'group:wood'}, | 		{'group:wood', 'group:wood', 'group:wood'}, | ||||||
| 		{'group:wood', 'group:wood', 'group:wood'}, | 		{'group:wood', 'group:wood', 'group:wood'}, | ||||||
| 		{'', 'default:stick', ''}, | 		{'', 'group:stick', ''}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -42,7 +49,7 @@ minetest.register_craft({ | |||||||
| 	output = 'default:torch 4', | 	output = 'default:torch 4', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:coal_lump'}, | 		{'default:coal_lump'}, | ||||||
| 		{'default:stick'}, | 		{'group:stick'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -50,8 +57,8 @@ minetest.register_craft({ | |||||||
| 	output = 'default:pick_wood', | 	output = 'default:pick_wood', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'group:wood', 'group:wood', 'group:wood'}, | 		{'group:wood', 'group:wood', 'group:wood'}, | ||||||
| 		{'', 'default:stick', ''}, | 		{'', 'group:stick', ''}, | ||||||
| 		{'', 'default:stick', ''}, | 		{'', 'group:stick', ''}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -59,8 +66,8 @@ minetest.register_craft({ | |||||||
| 	output = 'default:pick_stone', | 	output = 'default:pick_stone', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'group:stone', 'group:stone', 'group:stone'}, | 		{'group:stone', 'group:stone', 'group:stone'}, | ||||||
| 		{'', 'default:stick', ''}, | 		{'', 'group:stick', ''}, | ||||||
| 		{'', 'default:stick', ''}, | 		{'', 'group:stick', ''}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -68,8 +75,8 @@ minetest.register_craft({ | |||||||
| 	output = 'default:pick_steel', | 	output = 'default:pick_steel', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, | 		{'default:steel_ingot', 'default:steel_ingot', 'default:steel_ingot'}, | ||||||
| 		{'', 'default:stick', ''}, | 		{'', 'group:stick', ''}, | ||||||
| 		{'', 'default:stick', ''}, | 		{'', 'group:stick', ''}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -77,8 +84,8 @@ minetest.register_craft({ | |||||||
| 	output = 'default:pick_bronze', | 	output = 'default:pick_bronze', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'}, | 		{'default:bronze_ingot', 'default:bronze_ingot', 'default:bronze_ingot'}, | ||||||
| 		{'', 'default:stick', ''}, | 		{'', 'group:stick', ''}, | ||||||
| 		{'', 'default:stick', ''}, | 		{'', 'group:stick', ''}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -86,8 +93,8 @@ minetest.register_craft({ | |||||||
| 	output = 'default:pick_mese', | 	output = 'default:pick_mese', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:mese_crystal', 'default:mese_crystal', 'default:mese_crystal'}, | 		{'default:mese_crystal', 'default:mese_crystal', 'default:mese_crystal'}, | ||||||
| 		{'', 'default:stick', ''}, | 		{'', 'group:stick', ''}, | ||||||
| 		{'', 'default:stick', ''}, | 		{'', 'group:stick', ''}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -95,8 +102,8 @@ minetest.register_craft({ | |||||||
| 	output = 'default:pick_diamond', | 	output = 'default:pick_diamond', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:diamond', 'default:diamond', 'default:diamond'}, | 		{'default:diamond', 'default:diamond', 'default:diamond'}, | ||||||
| 		{'', 'default:stick', ''}, | 		{'', 'group:stick', ''}, | ||||||
| 		{'', 'default:stick', ''}, | 		{'', 'group:stick', ''}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -104,8 +111,8 @@ minetest.register_craft({ | |||||||
| 	output = 'default:shovel_wood', | 	output = 'default:shovel_wood', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'group:wood'}, | 		{'group:wood'}, | ||||||
| 		{'default:stick'}, | 		{'group:stick'}, | ||||||
| 		{'default:stick'}, | 		{'group:stick'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -113,8 +120,8 @@ minetest.register_craft({ | |||||||
| 	output = 'default:shovel_stone', | 	output = 'default:shovel_stone', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'group:stone'}, | 		{'group:stone'}, | ||||||
| 		{'default:stick'}, | 		{'group:stick'}, | ||||||
| 		{'default:stick'}, | 		{'group:stick'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -122,8 +129,8 @@ minetest.register_craft({ | |||||||
| 	output = 'default:shovel_steel', | 	output = 'default:shovel_steel', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:steel_ingot'}, | 		{'default:steel_ingot'}, | ||||||
| 		{'default:stick'}, | 		{'group:stick'}, | ||||||
| 		{'default:stick'}, | 		{'group:stick'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -131,8 +138,8 @@ minetest.register_craft({ | |||||||
| 	output = 'default:shovel_bronze', | 	output = 'default:shovel_bronze', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:bronze_ingot'}, | 		{'default:bronze_ingot'}, | ||||||
| 		{'default:stick'}, | 		{'group:stick'}, | ||||||
| 		{'default:stick'}, | 		{'group:stick'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -140,8 +147,8 @@ minetest.register_craft({ | |||||||
| 	output = 'default:shovel_mese', | 	output = 'default:shovel_mese', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:mese_crystal'}, | 		{'default:mese_crystal'}, | ||||||
| 		{'default:stick'}, | 		{'group:stick'}, | ||||||
| 		{'default:stick'}, | 		{'group:stick'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -149,8 +156,8 @@ minetest.register_craft({ | |||||||
| 	output = 'default:shovel_diamond', | 	output = 'default:shovel_diamond', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:diamond'}, | 		{'default:diamond'}, | ||||||
| 		{'default:stick'}, | 		{'group:stick'}, | ||||||
| 		{'default:stick'}, | 		{'group:stick'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -158,8 +165,8 @@ minetest.register_craft({ | |||||||
| 	output = 'default:axe_wood', | 	output = 'default:axe_wood', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'group:wood', 'group:wood'}, | 		{'group:wood', 'group:wood'}, | ||||||
| 		{'group:wood', 'default:stick'}, | 		{'group:wood', 'group:stick'}, | ||||||
| 		{'', 'default:stick'}, | 		{'', 'group:stick'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -167,8 +174,8 @@ minetest.register_craft({ | |||||||
| 	output = 'default:axe_stone', | 	output = 'default:axe_stone', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'group:stone', 'group:stone'}, | 		{'group:stone', 'group:stone'}, | ||||||
| 		{'group:stone', 'default:stick'}, | 		{'group:stone', 'group:stick'}, | ||||||
| 		{'', 'default:stick'}, | 		{'', 'group:stick'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -176,8 +183,8 @@ minetest.register_craft({ | |||||||
| 	output = 'default:axe_steel', | 	output = 'default:axe_steel', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:steel_ingot', 'default:steel_ingot'}, | 		{'default:steel_ingot', 'default:steel_ingot'}, | ||||||
| 		{'default:steel_ingot', 'default:stick'}, | 		{'default:steel_ingot', 'group:stick'}, | ||||||
| 		{'', 'default:stick'}, | 		{'', 'group:stick'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -185,8 +192,8 @@ minetest.register_craft({ | |||||||
| 	output = 'default:axe_bronze', | 	output = 'default:axe_bronze', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:bronze_ingot', 'default:bronze_ingot'}, | 		{'default:bronze_ingot', 'default:bronze_ingot'}, | ||||||
| 		{'default:bronze_ingot', 'default:stick'}, | 		{'default:bronze_ingot', 'group:stick'}, | ||||||
| 		{'', 'default:stick'}, | 		{'', 'group:stick'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -194,8 +201,8 @@ minetest.register_craft({ | |||||||
| 	output = 'default:axe_mese', | 	output = 'default:axe_mese', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:mese_crystal', 'default:mese_crystal'}, | 		{'default:mese_crystal', 'default:mese_crystal'}, | ||||||
| 		{'default:mese_crystal', 'default:stick'}, | 		{'default:mese_crystal', 'group:stick'}, | ||||||
| 		{'', 'default:stick'}, | 		{'', 'group:stick'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -203,8 +210,62 @@ minetest.register_craft({ | |||||||
| 	output = 'default:axe_diamond', | 	output = 'default:axe_diamond', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:diamond', 'default:diamond'}, | 		{'default:diamond', 'default:diamond'}, | ||||||
| 		{'default:diamond', 'default:stick'}, | 		{'default:diamond', 'group:stick'}, | ||||||
| 		{'', 'default: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', ''}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -213,7 +274,7 @@ minetest.register_craft({ | |||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'group:wood'}, | 		{'group:wood'}, | ||||||
| 		{'group:wood'}, | 		{'group:wood'}, | ||||||
| 		{'default:stick'}, | 		{'group:stick'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -222,7 +283,7 @@ minetest.register_craft({ | |||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'group:stone'}, | 		{'group:stone'}, | ||||||
| 		{'group:stone'}, | 		{'group:stone'}, | ||||||
| 		{'default:stick'}, | 		{'group:stick'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -231,7 +292,7 @@ minetest.register_craft({ | |||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:steel_ingot'}, | 		{'default:steel_ingot'}, | ||||||
| 		{'default:steel_ingot'}, | 		{'default:steel_ingot'}, | ||||||
| 		{'default:stick'}, | 		{'group:stick'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -240,7 +301,7 @@ minetest.register_craft({ | |||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:bronze_ingot'}, | 		{'default:bronze_ingot'}, | ||||||
| 		{'default:bronze_ingot'}, | 		{'default:bronze_ingot'}, | ||||||
| 		{'default:stick'}, | 		{'group:stick'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -249,7 +310,7 @@ minetest.register_craft({ | |||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:mese_crystal'}, | 		{'default:mese_crystal'}, | ||||||
| 		{'default:mese_crystal'}, | 		{'default:mese_crystal'}, | ||||||
| 		{'default:stick'}, | 		{'group:stick'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -258,7 +319,7 @@ minetest.register_craft({ | |||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:diamond'}, | 		{'default:diamond'}, | ||||||
| 		{'default:diamond'}, | 		{'default:diamond'}, | ||||||
| 		{'default:stick'}, | 		{'group:stick'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -266,7 +327,7 @@ minetest.register_craft({ | |||||||
| 	output = 'default:rail 15', | 	output = 'default:rail 15', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:steel_ingot', '', 'default:steel_ingot'}, | 		{'default:steel_ingot', '', 'default:steel_ingot'}, | ||||||
| 		{'default:steel_ingot', 'default:stick', 'default:steel_ingot'}, | 		{'default:steel_ingot', 'group:stick', 'default:steel_ingot'}, | ||||||
| 		{'default:steel_ingot', '', 'default:steel_ingot'}, | 		{'default:steel_ingot', '', 'default:steel_ingot'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
| @@ -416,7 +477,7 @@ minetest.register_craft({ | |||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'default:sandstonebrick', | 	output = 'default:sandstonebrick 4', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:sandstone', 'default:sandstone'}, | 		{'default:sandstone', 'default:sandstone'}, | ||||||
| 		{'default:sandstone', 'default:sandstone'}, | 		{'default:sandstone', 'default:sandstone'}, | ||||||
| @@ -474,9 +535,9 @@ minetest.register_craft({ | |||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'default:ladder', | 	output = 'default:ladder', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:stick', '', 'default:stick'}, | 		{'group:stick', '', 'group:stick'}, | ||||||
| 		{'default:stick', 'default:stick', 'default:stick'}, | 		{'group:stick', 'group:stick', 'group:stick'}, | ||||||
| 		{'default:stick', '', 'default:stick'}, | 		{'group:stick', '', 'group:stick'}, | ||||||
| 	} | 	} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| @@ -520,7 +581,15 @@ minetest.register_craft({ | |||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'default:stonebrick', | 	output = 'default:obsidianbrick 4', | ||||||
|  | 	recipe = { | ||||||
|  | 		{'default:obsidian', 'default:obsidian'}, | ||||||
|  | 		{'default:obsidian', 'default:obsidian'} | ||||||
|  | 	} | ||||||
|  | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	output = 'default:stonebrick 4', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:stone', 'default:stone'}, | 		{'default:stone', 'default:stone'}, | ||||||
| 		{'default:stone', 'default:stone'}, | 		{'default:stone', 'default:stone'}, | ||||||
| @@ -528,7 +597,7 @@ minetest.register_craft({ | |||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	output = 'default:desert_stonebrick', | 	output = 'default:desert_stonebrick 4', | ||||||
| 	recipe = { | 	recipe = { | ||||||
| 		{'default:desert_stone', 'default:desert_stone'}, | 		{'default:desert_stone', 'default:desert_stone'}, | ||||||
| 		{'default:desert_stone', 'default:desert_stone'}, | 		{'default:desert_stone', 'default:desert_stone'}, | ||||||
| @@ -581,6 +650,12 @@ minetest.register_craft({ | |||||||
| 	recipe = "default:cobble", | 	recipe = "default:cobble", | ||||||
| }) | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "cooking", | ||||||
|  | 	output = "default:desert_stone", | ||||||
|  | 	recipe = "default:desert_cobble", | ||||||
|  | }) | ||||||
|  |  | ||||||
| minetest.register_craft({ | minetest.register_craft({ | ||||||
| 	type = "cooking", | 	type = "cooking", | ||||||
| 	output = "default:steel_ingot", | 	output = "default:steel_ingot", | ||||||
| @@ -740,3 +815,10 @@ minetest.register_craft({ | |||||||
| 	recipe = "default:grass_1", | 	recipe = "default:grass_1", | ||||||
| 	burntime = 2, | 	burntime = 2, | ||||||
| }) | }) | ||||||
|  |  | ||||||
|  | minetest.register_craft({ | ||||||
|  | 	type = "fuel", | ||||||
|  | 	recipe = "default:pine_sapling", | ||||||
|  | 	burntime = 10, | ||||||
|  | }) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -3,6 +3,7 @@ | |||||||
| minetest.register_craftitem("default:stick", { | minetest.register_craftitem("default:stick", { | ||||||
| 	description = "Stick", | 	description = "Stick", | ||||||
| 	inventory_image = "default_stick.png", | 	inventory_image = "default_stick.png", | ||||||
|  | 	groups = {stick=1}, | ||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_craftitem("default:paper", { | minetest.register_craftitem("default:paper", { | ||||||
| @@ -13,11 +14,13 @@ minetest.register_craftitem("default:paper", { | |||||||
| minetest.register_craftitem("default:book", { | minetest.register_craftitem("default:book", { | ||||||
| 	description = "Book", | 	description = "Book", | ||||||
| 	inventory_image = "default_book.png", | 	inventory_image = "default_book.png", | ||||||
|  | 	groups = {book=1}, | ||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_craftitem("default:coal_lump", { | minetest.register_craftitem("default:coal_lump", { | ||||||
| 	description = "Coal Lump", | 	description = "Coal Lump", | ||||||
| 	inventory_image = "default_coal_lump.png", | 	inventory_image = "default_coal_lump.png", | ||||||
|  | 	groups = {coal = 1} | ||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_craftitem("default:iron_lump", { | minetest.register_craftitem("default:iron_lump", { | ||||||
| @@ -80,11 +83,6 @@ minetest.register_craftitem("default:clay_brick", { | |||||||
| 	inventory_image = "default_clay_brick.png", | 	inventory_image = "default_clay_brick.png", | ||||||
| }) | }) | ||||||
|  |  | ||||||
| minetest.register_craftitem("default:scorched_stuff", { |  | ||||||
| 	description = "Scorched Stuff", |  | ||||||
| 	inventory_image = "default_scorched_stuff.png", |  | ||||||
| }) |  | ||||||
|  |  | ||||||
| minetest.register_craftitem("default:obsidian_shard", { | minetest.register_craftitem("default:obsidian_shard", { | ||||||
| 	description = "Obsidian Shard", | 	description = "Obsidian Shard", | ||||||
| 	inventory_image = "default_obsidian_shard.png", | 	inventory_image = "default_obsidian_shard.png", | ||||||
|   | |||||||
| @@ -9,16 +9,18 @@ function default.node_sound_defaults(table) | |||||||
| 	table.footstep = table.footstep or | 	table.footstep = table.footstep or | ||||||
| 			{name="", gain=1.0} | 			{name="", gain=1.0} | ||||||
| 	table.dug = table.dug or | 	table.dug = table.dug or | ||||||
| 			{name="default_dug_node", gain=1.0} | 			{name="default_dug_node", gain=0.25} | ||||||
| 	table.place = table.place or | 	table.place = table.place or | ||||||
| 			{name="default_place_node", gain=0.5} | 			{name="default_place_node_hard", gain=1.0} | ||||||
| 	return table | 	return table | ||||||
| end | end | ||||||
|  |  | ||||||
| function default.node_sound_stone_defaults(table) | function default.node_sound_stone_defaults(table) | ||||||
| 	table = table or {} | 	table = table or {} | ||||||
| 	table.footstep = table.footstep or | 	table.footstep = table.footstep or | ||||||
| 			{name="default_hard_footstep", gain=0.2} | 			{name="default_hard_footstep", gain=0.5} | ||||||
|  | 	table.dug = table.dug or | ||||||
|  | 			{name="default_hard_footstep", gain=1.0} | ||||||
| 	default.node_sound_defaults(table) | 	default.node_sound_defaults(table) | ||||||
| 	return table | 	return table | ||||||
| end | end | ||||||
| @@ -26,9 +28,11 @@ end | |||||||
| function default.node_sound_dirt_defaults(table) | function default.node_sound_dirt_defaults(table) | ||||||
| 	table = table or {} | 	table = table or {} | ||||||
| 	table.footstep = table.footstep or | 	table.footstep = table.footstep or | ||||||
| 			{name="", gain=0.5} | 			{name="default_dirt_footstep", gain=1.0} | ||||||
| 	--table.dug = table.dug or | 	table.dug = table.dug or | ||||||
| 	--		{name="default_dirt_break", gain=0.5} | 			{name="default_dirt_footstep", gain=1.5} | ||||||
|  | 	table.place = table.place or | ||||||
|  | 			{name="default_place_node", gain=1.0} | ||||||
| 	default.node_sound_defaults(table) | 	default.node_sound_defaults(table) | ||||||
| 	return table | 	return table | ||||||
| end | end | ||||||
| @@ -36,11 +40,11 @@ end | |||||||
| function default.node_sound_sand_defaults(table) | function default.node_sound_sand_defaults(table) | ||||||
| 	table = table or {} | 	table = table or {} | ||||||
| 	table.footstep = table.footstep or | 	table.footstep = table.footstep or | ||||||
| 			{name="default_grass_footstep", gain=0.25} | 			{name="default_sand_footstep", gain=0.2} | ||||||
| 	--table.dug = table.dug or |  | ||||||
| 	--		{name="default_dirt_break", gain=0.25} |  | ||||||
| 	table.dug = table.dug or | 	table.dug = table.dug or | ||||||
| 			{name="", gain=0.25} | 			{name="default_sand_footstep", gain=0.4} | ||||||
|  | 	table.place = table.place or | ||||||
|  | 			{name="default_place_node", gain=1.0} | ||||||
| 	default.node_sound_defaults(table) | 	default.node_sound_defaults(table) | ||||||
| 	return table | 	return table | ||||||
| end | end | ||||||
| @@ -48,7 +52,9 @@ end | |||||||
| function default.node_sound_wood_defaults(table) | function default.node_sound_wood_defaults(table) | ||||||
| 	table = table or {} | 	table = table or {} | ||||||
| 	table.footstep = table.footstep or | 	table.footstep = table.footstep or | ||||||
| 			{name="default_hard_footstep", gain=0.3} | 			{name="default_wood_footstep", gain=0.5} | ||||||
|  | 	table.dug = table.dug or | ||||||
|  | 			{name="default_wood_footstep", gain=1.0} | ||||||
| 	default.node_sound_defaults(table) | 	default.node_sound_defaults(table) | ||||||
| 	return table | 	return table | ||||||
| end | end | ||||||
| @@ -56,11 +62,13 @@ end | |||||||
| function default.node_sound_leaves_defaults(table) | function default.node_sound_leaves_defaults(table) | ||||||
| 	table = table or {} | 	table = table or {} | ||||||
| 	table.footstep = table.footstep or | 	table.footstep = table.footstep or | ||||||
| 			{name="default_grass_footstep", gain=0.25} | 			{name="default_grass_footstep", gain=0.35} | ||||||
|  | 	table.dug = table.dug or | ||||||
|  | 			{name="default_grass_footstep", gain=0.7} | ||||||
| 	table.dig = table.dig or | 	table.dig = table.dig or | ||||||
| 			{name="default_dig_crumbly", gain=0.4} | 			{name="default_dig_crumbly", gain=0.4} | ||||||
| 	table.dug = table.dug or | 	table.place = table.place or | ||||||
| 			{name="", gain=1.0} | 			{name="default_place_node", gain=1.0} | ||||||
| 	default.node_sound_defaults(table) | 	default.node_sound_defaults(table) | ||||||
| 	return table | 	return table | ||||||
| end | end | ||||||
| @@ -68,7 +76,7 @@ end | |||||||
| function default.node_sound_glass_defaults(table) | function default.node_sound_glass_defaults(table) | ||||||
| 	table = table or {} | 	table = table or {} | ||||||
| 	table.footstep = table.footstep or | 	table.footstep = table.footstep or | ||||||
| 			{name="default_hard_footstep", gain=0.25} | 			{name="default_glass_footstep", gain=0.5} | ||||||
| 	table.dug = table.dug or | 	table.dug = table.dug or | ||||||
| 			{name="default_break_glass", gain=1.0} | 			{name="default_break_glass", gain=1.0} | ||||||
| 	default.node_sound_defaults(table) | 	default.node_sound_defaults(table) | ||||||
| @@ -118,16 +126,19 @@ function on_punchnode(p, node) | |||||||
| end | end | ||||||
| minetest.register_on_punchnode(on_punchnode) | minetest.register_on_punchnode(on_punchnode) | ||||||
|  |  | ||||||
|  |  | ||||||
| -- | -- | ||||||
| -- Lavacooling | -- Lavacooling | ||||||
| -- | -- | ||||||
|  |  | ||||||
| default.cool_lava_source = function(pos) | default.cool_lava_source = function(pos) | ||||||
| 	minetest.set_node(pos, {name="default:obsidian"}) | 	minetest.set_node(pos, {name="default:obsidian"}) | ||||||
|  | 	minetest.sound_play("default_cool_lava", {pos = pos,  gain = 0.25}) | ||||||
| end | end | ||||||
|  |  | ||||||
| default.cool_lava_flowing = function(pos) | default.cool_lava_flowing = function(pos) | ||||||
| 	minetest.set_node(pos, {name="default:stone"}) | 	minetest.set_node(pos, {name="default:stone"}) | ||||||
|  | 	minetest.sound_play("default_cool_lava", {pos = pos,  gain = 0.25}) | ||||||
| end | end | ||||||
|  |  | ||||||
| minetest.register_abm({ | minetest.register_abm({ | ||||||
| @@ -206,19 +217,21 @@ minetest.register_abm({ | |||||||
| }) | }) | ||||||
|  |  | ||||||
| -- | -- | ||||||
| -- Leafdecay | -- dig upwards | ||||||
| -- | -- | ||||||
|  |  | ||||||
| -- To enable leaf decay for a node, add it to the "leafdecay" group. | 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 | ||||||
|  |  | ||||||
| -- | -- | ||||||
| -- The rating of the group determines how far from a node in the group "tree" | -- Leafdecay | ||||||
| -- 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. |  | ||||||
| -- |  | ||||||
| -- If the node is in the leafdecay_drop group then the it will always be dropped |  | ||||||
| -- as an item |  | ||||||
|  |  | ||||||
| default.leafdecay_trunk_cache = {} | default.leafdecay_trunk_cache = {} | ||||||
| default.leafdecay_enable_cache = true | default.leafdecay_enable_cache = true | ||||||
| @@ -231,6 +244,12 @@ minetest.register_globalstep(function(dtime) | |||||||
| 			math.floor(dtime * finds_per_second) | 			math.floor(dtime * finds_per_second) | ||||||
| end) | 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({ | minetest.register_abm({ | ||||||
| 	nodenames = {"group:leafdecay"}, | 	nodenames = {"group:leafdecay"}, | ||||||
| 	neighbors = {"air", "group:liquid"}, | 	neighbors = {"air", "group:liquid"}, | ||||||
| @@ -285,7 +304,7 @@ minetest.register_abm({ | |||||||
| 		end | 		end | ||||||
| 		if not do_preserve then | 		if not do_preserve then | ||||||
| 			-- Drop stuff other than the node itself | 			-- Drop stuff other than the node itself | ||||||
| 			itemstacks = minetest.get_node_drops(n0.name) | 			local itemstacks = minetest.get_node_drops(n0.name) | ||||||
| 			for _, itemname in ipairs(itemstacks) do | 			for _, itemname in ipairs(itemstacks) do | ||||||
| 				if minetest.get_item_group(n0.name, "leafdecay_drop") ~= 0 or | 				if minetest.get_item_group(n0.name, "leafdecay_drop") ~= 0 or | ||||||
| 						itemname ~= n0.name then | 						itemname ~= n0.name then | ||||||
| @@ -303,3 +322,4 @@ minetest.register_abm({ | |||||||
| 		end | 		end | ||||||
| 	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, | ||||||
|  | }) | ||||||
| @@ -11,11 +11,38 @@ LIGHT_MAX = 14 | |||||||
| -- Definitions made by this mod that other mods can use too | -- Definitions made by this mod that other mods can use too | ||||||
| default = {} | default = {} | ||||||
|  |  | ||||||
|  | -- GUI related stuff | ||||||
|  | default.gui_bg = "bgcolor[#080808BB;true]" | ||||||
|  | default.gui_bg_img = "background[5,5;1,1;gui_formbg.png;true]" | ||||||
|  | default.gui_slots = "listcolors[#00000069;#5A5A5A;#141318;#30434C;#FFF]" | ||||||
|  |  | ||||||
|  | function default.get_hotbar_bg(x,y) | ||||||
|  | 	local out = "" | ||||||
|  | 	for i=0,7,1 do | ||||||
|  | 		out = out .."image["..x+i..","..y..";1,1;gui_hb_bg.png]" | ||||||
|  | 	end | ||||||
|  | 	return out | ||||||
|  | end | ||||||
|  |  | ||||||
|  | default.gui_suvival_form = "size[8,8.5]".. | ||||||
|  | 			default.gui_bg.. | ||||||
|  | 			default.gui_bg_img.. | ||||||
|  | 			default.gui_slots.. | ||||||
|  | 			"list[current_player;main;0,4.25;8,1;]".. | ||||||
|  | 			"list[current_player;main;0,5.5;8,3;8]".. | ||||||
|  | 			"list[current_player;craft;1.75,0.5;3,3;]".. | ||||||
|  | 			"list[current_player;craftpreview;5.75,1.5;1,1;]".. | ||||||
|  | 			"image[4.75,1.5;1,1;gui_furnace_arrow_bg.png^[transformR270]".. | ||||||
|  | 			default.get_hotbar_bg(0,4.25) | ||||||
|  |  | ||||||
| -- Load files | -- Load files | ||||||
| dofile(minetest.get_modpath("default").."/functions.lua") | dofile(minetest.get_modpath("default").."/functions.lua") | ||||||
| dofile(minetest.get_modpath("default").."/nodes.lua") | dofile(minetest.get_modpath("default").."/nodes.lua") | ||||||
|  | dofile(minetest.get_modpath("default").."/furnace.lua") | ||||||
| dofile(minetest.get_modpath("default").."/tools.lua") | dofile(minetest.get_modpath("default").."/tools.lua") | ||||||
| dofile(minetest.get_modpath("default").."/craftitems.lua") | dofile(minetest.get_modpath("default").."/craftitems.lua") | ||||||
| dofile(minetest.get_modpath("default").."/crafting.lua") | dofile(minetest.get_modpath("default").."/crafting.lua") | ||||||
| dofile(minetest.get_modpath("default").."/mapgen.lua") | dofile(minetest.get_modpath("default").."/mapgen.lua") | ||||||
| dofile(minetest.get_modpath("default").."/player.lua") | dofile(minetest.get_modpath("default").."/player.lua") | ||||||
|  | dofile(minetest.get_modpath("default").."/trees.lua") | ||||||
|  | dofile(minetest.get_modpath("default").."/aliases.lua") | ||||||
|   | |||||||
| @@ -4,7 +4,6 @@ | |||||||
| -- 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") | ||||||
| @@ -26,6 +25,7 @@ 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 | ||||||
| @@ -207,68 +207,16 @@ minetest.register_ore({ | |||||||
| 	flags          = "absheight", | 	flags          = "absheight", | ||||||
| }) | }) | ||||||
|  |  | ||||||
| if minetest.setting_get("mg_name") == "indev" then | minetest.register_ore({ | ||||||
| 	-- Floatlands and high mountains springs | 	ore_type       = "scatter", | ||||||
| 	minetest.register_ore({ | 	ore            = "default:clay", | ||||||
| 		ore_type       = "scatter", | 	wherein        = "default:sand", | ||||||
| 		ore            = "default:water_source", | 	clust_scarcity = 15*15*15, | ||||||
| 		ore_param2     = 128, | 	clust_num_ores = 64, | ||||||
| 		wherein        = "default:stone", | 	clust_size     = 5, | ||||||
| 		clust_scarcity = 40*40*40, | 	height_max     = 0, | ||||||
| 		clust_num_ores = 8, | 	height_min     = -10, | ||||||
| 		clust_size     = 3, | }) | ||||||
| 		height_min     = 100, |  | ||||||
| 		height_max     = 31000, |  | ||||||
| 	}) |  | ||||||
|  |  | ||||||
| 	minetest.register_ore({ |  | ||||||
| 		ore_type       = "scatter", |  | ||||||
| 		ore            = "default:lava_source", |  | ||||||
| 		ore_param2     = 128, |  | ||||||
| 		wherein        = "default:stone", |  | ||||||
| 		clust_scarcity = 50*50*50, |  | ||||||
| 		clust_num_ores = 5, |  | ||||||
| 		clust_size     = 2, |  | ||||||
| 		height_min     = 10000, |  | ||||||
| 		height_max     = 31000, |  | ||||||
| 	}) |  | ||||||
|  |  | ||||||
| 	minetest.register_ore({ |  | ||||||
| 		ore_type       = "scatter", |  | ||||||
| 		ore            = "default:sand", |  | ||||||
| 		wherein        = "default:stone", |  | ||||||
| 		clust_scarcity = 20*20*20, |  | ||||||
| 		clust_num_ores = 5*5*3, |  | ||||||
| 		clust_size     = 5, |  | ||||||
| 		height_min     = 500, |  | ||||||
| 		height_max     = 31000, |  | ||||||
| 	}) |  | ||||||
|  |  | ||||||
| 	-- Underground springs |  | ||||||
| 	minetest.register_ore({ |  | ||||||
| 		ore_type       = "scatter", |  | ||||||
| 		ore            = "default:water_source", |  | ||||||
| 		ore_param2     = 128, |  | ||||||
| 		wherein        = "default:stone", |  | ||||||
| 		clust_scarcity = 25*25*25, |  | ||||||
| 		clust_num_ores = 8, |  | ||||||
| 		clust_size     = 3, |  | ||||||
| 		height_min     = -10000, |  | ||||||
| 		height_max     = -10, |  | ||||||
| 	}) |  | ||||||
|  |  | ||||||
| 	minetest.register_ore({ |  | ||||||
| 		ore_type       = "scatter", |  | ||||||
| 		ore            = "default:lava_source", |  | ||||||
| 		ore_param2     = 128, |  | ||||||
| 		wherein        = "default:stone", |  | ||||||
| 		clust_scarcity = 35*35*35, |  | ||||||
| 		clust_num_ores = 5, |  | ||||||
| 		clust_size     = 2, |  | ||||||
| 		height_min     = -31000, |  | ||||||
| 		height_max     = -100, |  | ||||||
| 	}) |  | ||||||
| end |  | ||||||
|  |  | ||||||
| function default.generate_ore(name, wherein, minp, maxp, seed, chunks_per_volume, chunk_size, ore_per_chunk, height_min, height_max) | 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") | 	minetest.log('action', "WARNING: default.generate_ore is deprecated") | ||||||
| @@ -312,117 +260,39 @@ function default.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.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 |  | ||||||
|  |  | ||||||
| function default.make_cactus(pos, size) | function default.mgv6_ongen(minp, maxp, seed) | ||||||
| 	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 |  | ||||||
|  |  | ||||||
| -- facedir: 0/1/2/3 (head node facedir value) | 	function default.make_papyrus(pos, size) | ||||||
| -- length: length of rainbow tail | 		for y=0,size-1 do | ||||||
| function default.make_nyancat(pos, facedir, length) | 			local p = {x=pos.x, y=pos.y+y, z=pos.z} | ||||||
| 	local tailvec = {x=0, y=0, z=0} | 			local nn = minetest.get_node(p).name | ||||||
| 	if facedir == 0 then | 			if minetest.registered_nodes[nn] and | ||||||
| 		tailvec.z = 1 | 				minetest.registered_nodes[nn].buildable_to then | ||||||
| 	elseif facedir == 1 then | 				minetest.set_node(p, {name="default:papyrus"}) | ||||||
| 		tailvec.x = 1 | 			else | ||||||
| 	elseif facedir == 2 then | 				return | ||||||
| 		tailvec.z = -1 |  | ||||||
| 	elseif facedir == 3 then |  | ||||||
| 		tailvec.x = -1 |  | ||||||
| 	else |  | ||||||
| 		print("default.make_nyancat(): Invalid facedir: "+dump(facedir)) |  | ||||||
| 		facedir = 0 |  | ||||||
| 		tailvec.z = 1 |  | ||||||
| 	end |  | ||||||
| 	local p = {x=pos.x, y=pos.y, z=pos.z} |  | ||||||
| 	minetest.set_node(p, {name="default:nyancat", param2=facedir}) |  | ||||||
| 	for i=1,length do |  | ||||||
| 		p.x = p.x + tailvec.x |  | ||||||
| 		p.z = p.z + tailvec.z |  | ||||||
| 		minetest.set_node(p, {name="default:nyancat_rainbow"}) |  | ||||||
| 	end |  | ||||||
| end |  | ||||||
|  |  | ||||||
| function generate_nyancats(seed, minp, maxp) |  | ||||||
| 	local height_min = -31000 |  | ||||||
| 	local height_max = -32 |  | ||||||
| 	if maxp.y < height_min or minp.y > height_max then |  | ||||||
| 		return |  | ||||||
| 	end |  | ||||||
| 	local y_min = math.max(minp.y, height_min) |  | ||||||
| 	local y_max = math.min(maxp.y, height_max) |  | ||||||
| 	local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1) |  | ||||||
| 	local pr = PseudoRandom(seed + 9324342) |  | ||||||
| 	local max_num_nyancats = math.floor(volume / (16*16*16)) |  | ||||||
| 	for i=1,max_num_nyancats do |  | ||||||
| 		if pr:next(0, 1000) == 0 then |  | ||||||
| 			local x0 = pr:next(minp.x, maxp.x) |  | ||||||
| 			local y0 = pr:next(minp.y, maxp.y) |  | ||||||
| 			local z0 = pr:next(minp.z, maxp.z) |  | ||||||
| 			local p0 = {x=x0, y=y0, z=z0} |  | ||||||
| 			default.make_nyancat(p0, pr:next(0,3), pr:next(3,15)) |  | ||||||
| 		end |  | ||||||
| 	end |  | ||||||
| end |  | ||||||
|  |  | ||||||
| minetest.register_on_generated(function(minp, maxp, seed) |  | ||||||
| 	if maxp.y >= 2 and minp.y <= 0 then |  | ||||||
| 		-- Generate clay |  | ||||||
| 		-- Assume X and Z lengths are equal |  | ||||||
| 		local divlen = 4 |  | ||||||
| 		local divs = (maxp.x-minp.x)/divlen+1; |  | ||||||
| 		for divx=0+1,divs-1-1 do |  | ||||||
| 		for divz=0+1,divs-1-1 do |  | ||||||
| 			local cx = minp.x + math.floor((divx+0.5)*divlen) |  | ||||||
| 			local cz = minp.z + math.floor((divz+0.5)*divlen) |  | ||||||
| 			if minetest.get_node({x=cx,y=1,z=cz}).name == "default:water_source" and |  | ||||||
| 					minetest.get_node({x=cx,y=0,z=cz}).name == "default:sand" then |  | ||||||
| 				local is_shallow = true |  | ||||||
| 				local num_water_around = 0 |  | ||||||
| 				if minetest.get_node({x=cx-divlen*2,y=1,z=cz+0}).name == "default:water_source" then |  | ||||||
| 					num_water_around = num_water_around + 1 end |  | ||||||
| 				if minetest.get_node({x=cx+divlen*2,y=1,z=cz+0}).name == "default:water_source" then |  | ||||||
| 					num_water_around = num_water_around + 1 end |  | ||||||
| 				if minetest.get_node({x=cx+0,y=1,z=cz-divlen*2}).name == "default:water_source" then |  | ||||||
| 					num_water_around = num_water_around + 1 end |  | ||||||
| 				if minetest.get_node({x=cx+0,y=1,z=cz+divlen*2}).name == "default:water_source" then |  | ||||||
| 					num_water_around = num_water_around + 1 end |  | ||||||
| 				if num_water_around >= 2 then |  | ||||||
| 					is_shallow = false |  | ||||||
| 				end	 |  | ||||||
| 				if is_shallow then |  | ||||||
| 					for x1=-divlen,divlen do |  | ||||||
| 					for z1=-divlen,divlen do |  | ||||||
| 						if minetest.get_node({x=cx+x1,y=0,z=cz+z1}).name == "default:sand" then |  | ||||||
| 							minetest.set_node({x=cx+x1,y=0,z=cz+z1}, {name="default:clay"}) |  | ||||||
| 						end |  | ||||||
| 					end |  | ||||||
| 					end |  | ||||||
| 				end |  | ||||||
| 			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 | ||||||
|  | 	end | ||||||
|  |  | ||||||
|  | 	if maxp.y >= 2 and minp.y <= 0 then | ||||||
| 		-- Generate papyrus | 		-- Generate papyrus | ||||||
| 		local perlin1 = minetest.get_perlin(354, 3, 0.7, 100) | 		local perlin1 = minetest.get_perlin(354, 3, 0.7, 100) | ||||||
| 		-- Assume X and Z lengths are equal | 		-- Assume X and Z lengths are equal | ||||||
| @@ -530,8 +400,68 @@ minetest.register_on_generated(function(minp, maxp, seed) | |||||||
| 		end | 		end | ||||||
| 		end | 		end | ||||||
| 	end | 	end | ||||||
|  | end | ||||||
|  |  | ||||||
| 	-- Generate nyan cats | -- | ||||||
| 	generate_nyancats(seed, minp, maxp) | -- Detect mapgen and register suitable on-generated function | ||||||
|  | -- | ||||||
|  |  | ||||||
|  | minetest.register_on_mapgen_init(function(mg_params) | ||||||
|  | 	if mg_params.mgname == "v6" then | ||||||
|  | 		minetest.register_on_generated(default.mgv6_ongen) | ||||||
|  | 	end | ||||||
| end) | end) | ||||||
|  |  | ||||||
|  | -- | ||||||
|  | -- Generate nyan cats in all mapgens | ||||||
|  | -- | ||||||
|  |  | ||||||
|  | -- facedir: 0/1/2/3 (head node facedir value) | ||||||
|  | -- length: length of rainbow tail | ||||||
|  | function default.make_nyancat(pos, facedir, length) | ||||||
|  | 	local tailvec = {x=0, y=0, z=0} | ||||||
|  | 	if facedir == 0 then | ||||||
|  | 		tailvec.z = 1 | ||||||
|  | 	elseif facedir == 1 then | ||||||
|  | 		tailvec.x = 1 | ||||||
|  | 	elseif facedir == 2 then | ||||||
|  | 		tailvec.z = -1 | ||||||
|  | 	elseif facedir == 3 then | ||||||
|  | 		tailvec.x = -1 | ||||||
|  | 	else | ||||||
|  | 		--print("default.make_nyancat(): Invalid facedir: "+dump(facedir)) | ||||||
|  | 		facedir = 0 | ||||||
|  | 		tailvec.z = 1 | ||||||
|  | 	end | ||||||
|  | 	local p = {x=pos.x, y=pos.y, z=pos.z} | ||||||
|  | 	minetest.set_node(p, {name="default:nyancat", param2=facedir}) | ||||||
|  | 	for i=1,length do | ||||||
|  | 		p.x = p.x + tailvec.x | ||||||
|  | 		p.z = p.z + tailvec.z | ||||||
|  | 		minetest.set_node(p, {name="default:nyancat_rainbow", param2=facedir}) | ||||||
|  | 	end | ||||||
|  | end | ||||||
|  |  | ||||||
|  | function default.generate_nyancats(minp, maxp, seed) | ||||||
|  | 	local height_min = -31000 | ||||||
|  | 	local height_max = -32 | ||||||
|  | 	if maxp.y < height_min or minp.y > height_max then | ||||||
|  | 		return | ||||||
|  | 	end | ||||||
|  | 	local y_min = math.max(minp.y, height_min) | ||||||
|  | 	local y_max = math.min(maxp.y, height_max) | ||||||
|  | 	local volume = (maxp.x-minp.x+1)*(y_max-y_min+1)*(maxp.z-minp.z+1) | ||||||
|  | 	local pr = PseudoRandom(seed + 9324342) | ||||||
|  | 	local max_num_nyancats = math.floor(volume / (16*16*16)) | ||||||
|  | 	for i=1,max_num_nyancats do | ||||||
|  | 		if pr:next(0, 1000) == 0 then | ||||||
|  | 			local x0 = pr:next(minp.x, maxp.x) | ||||||
|  | 			local y0 = pr:next(minp.y, maxp.y) | ||||||
|  | 			local z0 = pr:next(minp.z, maxp.z) | ||||||
|  | 			local p0 = {x=x0, y=y0, z=z0} | ||||||
|  | 			default.make_nyancat(p0, pr:next(0,3), pr:next(3,15)) | ||||||
|  | 		end | ||||||
|  | 	end | ||||||
|  | end | ||||||
|  |  | ||||||
|  | minetest.register_on_generated(default.generate_nyancats) | ||||||
|   | |||||||
| Before Width: | Height: | Size: 3.1 KiB After Width: | Height: | Size: 2.7 KiB | 
| @@ -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_suvival_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.0 KiB After Width: | Height: | Size: 583 B | 
| Before Width: | Height: | Size: 247 B After Width: | Height: | Size: 320 B | 
| Before Width: | Height: | Size: 210 B After Width: | Height: | Size: 222 B | 
| Before Width: | Height: | Size: 511 B After Width: | Height: | Size: 639 B | 
| Before Width: | Height: | Size: 480 B After Width: | Height: | Size: 596 B | 
| Before Width: | Height: | Size: 562 B After Width: | Height: | Size: 568 B | 
| Before Width: | Height: | Size: 257 B After Width: | Height: | Size: 358 B | 
| Before Width: | Height: | Size: 649 B After Width: | Height: | Size: 589 B | 
| Before Width: | Height: | Size: 607 B After Width: | Height: | Size: 546 B | 
| Before Width: | Height: | Size: 761 B After Width: | Height: | Size: 630 B | 
| Before Width: | Height: | Size: 864 B After Width: | Height: | Size: 670 B | 
| Before Width: | Height: | Size: 709 B After Width: | Height: | Size: 576 B | 
| Before Width: | Height: | Size: 627 B After Width: | Height: | Size: 607 B | 
| Before Width: | Height: | Size: 496 B After Width: | Height: | Size: 318 B | 
| Before Width: | Height: | Size: 217 B After Width: | Height: | Size: 178 B | 
| Before Width: | Height: | Size: 337 B After Width: | Height: | Size: 333 B | 
| Before Width: | Height: | Size: 113 B After Width: | Height: | Size: 83 B | 
| Before Width: | Height: | Size: 418 B After Width: | Height: | Size: 290 B | 
| Before Width: | Height: | Size: 251 B After Width: | Height: | Size: 243 B | 
| Before Width: | Height: | Size: 585 B After Width: | Height: | Size: 739 B | 
| Before Width: | Height: | Size: 599 B After Width: | Height: | Size: 608 B | 
| Before Width: | Height: | Size: 264 B After Width: | Height: | Size: 356 B | 
| Before Width: | Height: | Size: 279 B After Width: | Height: | Size: 234 B | 
							
								
								
									
										
											BIN
										
									
								
								mods/default/textures/default_desert_cobble.png
									
									
									
									
									
										Normal file
									
								
							
							
						
						| After Width: | Height: | Size: 241 B | 
| Before Width: | Height: | Size: 670 B After Width: | Height: | Size: 647 B | 
| Before Width: | Height: | Size: 367 B After Width: | Height: | Size: 280 B | 
| Before Width: | Height: | Size: 483 B After Width: | Height: | Size: 516 B |