From eda31e53594fc638176eca7bea64c472fbc80afb Mon Sep 17 00:00:00 2001 From: Nemo 08 Date: Wed, 25 Apr 2012 00:04:18 +0400 Subject: [PATCH] barrels, modified bucket added --- shit/barrels/init.lua | 33 ++++ .../textures/barrels_woodbarrel_down.png | Bin 0 -> 616 bytes .../textures/barrels_woodbarrel_side.png | Bin 0 -> 528 bytes .../textures/barrels_woodbarrel_top.png | Bin 0 -> 647 bytes shit/bucket/README.txt | 26 ++++ shit/bucket/depends.txt | 2 + shit/bucket/init.lua | 141 ++++++++++++++++++ shit/bucket/textures/bucket.png | Bin 0 -> 329 bytes shit/bucket/textures/bucket_lava.png | Bin 0 -> 363 bytes shit/bucket/textures/bucket_water.png | Bin 0 -> 369 bytes 10 files changed, 202 insertions(+) create mode 100644 shit/barrels/init.lua create mode 100644 shit/barrels/textures/barrels_woodbarrel_down.png create mode 100644 shit/barrels/textures/barrels_woodbarrel_side.png create mode 100644 shit/barrels/textures/barrels_woodbarrel_top.png create mode 100644 shit/bucket/README.txt create mode 100644 shit/bucket/depends.txt create mode 100644 shit/bucket/init.lua create mode 100644 shit/bucket/textures/bucket.png create mode 100644 shit/bucket/textures/bucket_lava.png create mode 100644 shit/bucket/textures/bucket_water.png diff --git a/shit/barrels/init.lua b/shit/barrels/init.lua new file mode 100644 index 0000000..763730f --- /dev/null +++ b/shit/barrels/init.lua @@ -0,0 +1,33 @@ +function register_barrel(barrel_name, descr,brecipe, max) + minetest.register_craft({ + output = 'barrels:' .. barrel_name, + recipe = brecipe, + }) + minetest.register_node('barrels:' .. barrel_name, { + description = descr, + stack_max = 1, + metadata_name = 'generic', + tile_images = {'barrels_' .. barrel_name .. '_top.png', 'barrels_' .. barrel_name .. '_down.png', 'barrels_' .. barrel_name .. '_side.png', + 'barrels_' .. barrel_name .. '_side.png', 'barrels_' .. barrel_name .. '_side.png', 'barrels_' .. barrel_name .. '_side.png'}, + groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2, liquid_container=max}, + sounds = default.node_sound_wood_defaults(), + }) + minetest.register_on_placenode(function(pos, newnode, placer) + if newnode.name == ('barrels:' .. barrel_name) then + local meta = minetest.env:get_meta(pos) + meta:set_string('liquid', '') + meta:set_string('quantity', '0') + meta:set_infotext(descr .. ' empty') + end + end) +end + +register_barrel('woodbarrel', + 'Wood barrel', + { + {'default:wood 3', '', 'default:wood 3'}, + {'default:wood 3', '', 'default:wood 3'}, + {'default:wood 3', '', 'default:wood 3'}, + }, + 10 +) diff --git a/shit/barrels/textures/barrels_woodbarrel_down.png b/shit/barrels/textures/barrels_woodbarrel_down.png new file mode 100644 index 0000000000000000000000000000000000000000..250aeec4de7208597cd026415635df1037ce1404 GIT binary patch literal 616 zcmV-u0+;=XP)e zSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{00GcRL_t(I%T<%jZWBQegum*U zb^L=!B!U!&3uhjHXX1(B0gw_U#6n2Mj@L8Y9A!lZk3TB0v->APn&@nf%UTtaIDVgFd%-96#+G1kl39nNnnCyGIpmz5`4X1 z^8MGD9Kc}W^L6IWt8=?an8dL-`&Z{?ouK!;>?`kA#v%y=1Q>uvAPI%=0Dvq(h{0O( zSOa&+)~F{F&&Ps29V?|@lxVLb0tBPS+*~6l1ho$UxZe!ecHKk+a1SJA%I<+jFxHrB z!7S=n1FIe+wS7F`TrX4nGK?gM5J@7U0Rv6MBvGTGTBqP~p>H(cctamxcdFR)vHW+q zNSeQ`16^LW6@zB$-6~=Cn*j;330H9LHki~sYO4))sR1N4pz1;GVp*us?rS83Nt9^Q zEueT{5_KBXt}fnYYbtw>E1j+b-hoSh{BvKhr(?l-RHH}ut@4wlQ|czrvj-oSspVjj zE%lUDZ&sSr-3Wwcz$q*1Eb=7Aho!N}##L^j9ZGP0lex+*BLTe21IwZ9pG+*0ksl9* z+hyX%OJS_R?o`>XGyAi%FwJ$-L_8h}+jR!o@BI%2+6eOLm@M`H0000e zSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{00DSOL_t(I%iWVbjukNwguiNg z#yp9CZNid~?IHF6+<+sHaS;v#F+$=51Y}4EmIMgk?LLp~BA9syB!ZR5D9b->x5}>W zww|5c_I{XKbD|mM010x4eKRGA2pGd$HMo&P8wQ((hzPOEi3l@nltfCRVr+u|!JLB- z7?=_u(QWd>^T%8lcmJ}N4-d|nOQuYjsbuCUQ|5J^N+u*~U8uEFmqx9PdT77aAwb^f zY{X^=bd<0TN2m38bIbFmR{+$l|KR$Vfc*K*OHzW8#fNW=)BBl{gOY={AFnt&EwpZu z#Jh{iqmzl=%`(jUuZ;khB(}_uA_xhz+9fA;bD|^cHTu#jVG0o`{KvCO2v}ngzljYQ zFd<{H)y5!>x8)E+X6eR&5CpVt+AvA5F@iw~2+;GVPs~5yf2f0t*DqG4B)%`^&Mp8r zbaPqF$;|{98@}uZ_jZY;4=`Ldh~c#;*0$yzptgZozwxkW-Ao~RH!=)E2z~;h57?mA SmEw5-0000e zSad^gZEa<4bO1wgWnpw>WFU8GbZ8()Nlj2!fese{00HkwL_t(I%T1C!a}zNThM!&O z&h|OM8R8*d3_mPuiuBY)93tZuRc_vGV@S%qX3S<-7 z0RM)}yUQ`3e+@*ZG`*ZfZtsoxG@v5%$ynbTCtZNrbF7XtXqMvttHP3-zFa3h33eA=Mwr%WHQBfvx$zIlGhaBCVcPpNj{(J2OXwJ!Lb; z+{t#R1(0gs=_sJtoFGMyISlzQ#VT+YgySf@e%kQqdW(Aj28fGI;;2!w7gVhj%n$V2 zAj~hH(*}XX*S&-`2zoV*JU(rZ{kK*i>NF84^Z^xE+zmvnmr(^1XQ(<=q##sjA3lDA zDs=~T-bG?ICs(u7rEHg$wt%1_+$QJkS<8>ViSt=RMaVU8{n;m+L$*BSOokT{l3~=BmHjJC1zr?G=huD{!#D5Ep0@?2i99IAU002ovPDHLkV1flQ5wQRO literal 0 HcmV?d00001 diff --git a/shit/bucket/README.txt b/shit/bucket/README.txt new file mode 100644 index 0000000..bb898c6 --- /dev/null +++ b/shit/bucket/README.txt @@ -0,0 +1,26 @@ +Minetest 0.4 mod: bucket +========================= + +License of source code: +----------------------- +Copyright (C) 2011-2012 Kahrl +Copyright (C) 2011-2012 celeron55, Perttu Ahola + +This program is free software; you can redistribute it and/or modify +it under the terms of the GNU General Public License as published by +the Free Software Foundation; either version 2 of the License, or +(at your option) any later version. + +http://www.gnu.org/licenses/gpl-2.0.html + +License of media (textures and sounds) +-------------------------------------- +Attribution-ShareAlike 3.0 Unported (CC BY-SA 3.0) +http://creativecommons.org/licenses/by-sa/3.0/ + +Authors of media files +----------------------- +Everything not listed in here: +Copyright (C) 2010-2012 celeron55, Perttu Ahola + + diff --git a/shit/bucket/depends.txt b/shit/bucket/depends.txt new file mode 100644 index 0000000..3a7daa1 --- /dev/null +++ b/shit/bucket/depends.txt @@ -0,0 +1,2 @@ +default + diff --git a/shit/bucket/init.lua b/shit/bucket/init.lua new file mode 100644 index 0000000..ca1dfcc --- /dev/null +++ b/shit/bucket/init.lua @@ -0,0 +1,141 @@ +-- Minetest 0.4 mod: bucket +-- See README.txt for licensing and other information. + +minetest.register_alias("bucket", "bucket:bucket_empty") +minetest.register_alias("bucket_water", "bucket:bucket_water") +minetest.register_alias("bucket_lava", "bucket:bucket_lava") + +minetest.register_craft({ + output = 'bucket:bucket_empty 1', + recipe = { + {'default:steel_ingot', '', 'default:steel_ingot'}, + {'', 'default:steel_ingot', ''}, + } +}) + +bucket = {} +bucket.liquids = {} + +-- Register a new liquid +-- source = name of the source node +-- flowing = name of the flowing node +-- itemname = name of the new bucket item (or nil if liquid is not takeable) +-- inventory_image = texture of the new bucket item (ignored if itemname == nil) +-- This function can be called from any mod (that depends on bucket). +function bucket.register_liquid(source, flowing, itemname, inventory_image) + bucket.liquids[source] = { + source = source, + flowing = flowing, + itemname = itemname, + } + bucket.liquids[flowing] = bucket.liquids[source] + + if itemname ~= nil then + minetest.register_craftitem(itemname, { + inventory_image = inventory_image, + stack_max = 1, + liquids_pointable = true, + on_use = function(itemstack, user, pointed_thing) + -- Must be pointing to node + if pointed_thing.type ~= "node" then + return + end + -- Check for liquid container + n = minetest.env:get_node(pointed_thing.under) + local max_fill = minetest.get_item_group(n.name, 'liquid_container') + if max_fill ~= 0 then + local meta = minetest.env:get_meta(pointed_thing.under) + local liquid_type = meta:get_string('liquid') + local liquid_quantity = meta:get_string('quantity') + if (liquid_type == source)or(liquid_type == '') then + if tonumber(liquid_quantity) < max_fill then + meta:set_string('liquid', source) + meta:set_string('quantity', liquid_quantity + 1) + local node_descr = minetest.registered_nodes[source]['description'] + if node_descr == '' then + node_descr = source + end + meta:set_infotext(minetest.registered_nodes[n.name]['description'] .. ' filled by '.. node_descr .. ' ' .. (liquid_quantity + 1)) + end + return {name="bucket:bucket_empty"} + end + if (liquid_type ~= source)or(liquid_type ~= '') then + return + end + end + -- Check if pointing to a liquid + n = minetest.env:get_node(pointed_thing.under) + if bucket.liquids[n.name] == nil then + -- Not a liquid + minetest.env:add_node(pointed_thing.above, {name=source}) + elseif n.name ~= source then + -- It's a liquid + minetest.env:add_node(pointed_thing.under, {name=source}) + end + return {name="bucket:bucket_empty"} + end + }) + end +end + +minetest.register_craftitem("bucket:bucket_empty", { + inventory_image = "bucket.png", + stack_max = 1, + liquids_pointable = true, + on_use = function(itemstack, user, pointed_thing) + -- Must be pointing to node + if pointed_thing.type ~= "node" then + return + end + -- Check for liquid container + n = minetest.env:get_node(pointed_thing.under) + local max_fill = minetest.get_item_group(n.name, 'liquid_container') + if max_fill ~= 0 then + local meta = minetest.env:get_meta(pointed_thing.under) + local liquid_type = meta:get_string('liquid') + local liquid_quantity = meta:get_string('quantity') + liquiddef = bucket.liquids[liquid_type] + if liquiddef ~= nil and liquiddef.source == liquid_type and liquiddef.itemname ~= nil and tonumber(liquid_quantity)>=1 then + meta:set_string('quantity', liquid_quantity - 1) + local node_descr = minetest.registered_nodes[liquiddef.source]['description'] + if node_descr == '' then + node_descr = liquiddef.source + end + if (liquid_quantity - 1)~=0 then + meta:set_infotext(minetest.registered_nodes[n.name]['description'] .. ' filled by '.. node_descr .. ' ' .. (liquid_quantity - 1)) + else + meta:set_string('liquid', '') + meta:set_infotext(minetest.registered_nodes[n.name]['description'] .. ' empty') + end + return {name=liquiddef.itemname} + end + end + -- Check if pointing to a liquid source + n = minetest.env:get_node(pointed_thing.under) + liquiddef = bucket.liquids[n.name] + if liquiddef ~= nil and liquiddef.source == n.name and liquiddef.itemname ~= nil then + minetest.env:add_node(pointed_thing.under, {name="air"}) + return {name=liquiddef.itemname} + end + end, +}) + +bucket.register_liquid( + "default:water_source", + "default:water_flowing", + "bucket:bucket_water", + "bucket_water.png" +) + +bucket.register_liquid( + "default:lava_source", + "default:lava_flowing", + "bucket:bucket_lava", + "bucket_lava.png" +) + +minetest.register_craft({ + type = "fuel", + recipe = "default:bucket_lava", + burntime = 60, +}) diff --git a/shit/bucket/textures/bucket.png b/shit/bucket/textures/bucket.png new file mode 100644 index 0000000000000000000000000000000000000000..f165fd209e9dc30282c963ee27dcd34eeb84b115 GIT binary patch literal 329 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`jKx9jP7LeL$-D$|*pj^6T^Rm@ z;DWu&Cj&(|3p^r=85p>QL70(Y)*K0-AbW|YuPgg)Zdra)<*XK-XFws@%#er@=ltB< z)VvZPmw~~#C^fMpHASI3vm`^o-P1Q9MK6^dD89hc#WBR<^x2@3yhjvxwuHYtv`E5h zA=7sU_7DfnDTkPM_B~-WI_NU-+eT~s6r0B%89!t{P^;Vb^g-W=Gnd`HPCj`!_sp3K zQO4fZ&$kH7Vv@c0+jYT|O*c`o^Za=JJUMpDMelNy3 P732v|S3j3^P6QL70(Y)*K0-AbW|YuPgg)Zdray@#n4E9dnI@*Z;FalP;AGr??^ zsSzu$bV2fkSxtf(XJsTCRfAlvZ)(!?Sma&Q=pmBua>?YU|Nrj)`tbVGuwUCmA75)I z(_FsdvT}EE@rJAND)*PGxaKKHHaX8^eqOtJ)yh?0vv>?v$MYKqZWL%*8dh$(Y*}W9 zAyWZ!-}Q!$lk$+n(bncyXCpI3FShQL70(Y)*K0-AbW|YuPgg)ZdrZ{;h&$K*nvW_nIRD+&iT2y zsd*(pE(3#eQEFmIYKlU6W=V#EyQgnJie4&6;R#O{#}JFtXD8Y69Wvl)jn~Q(Y_&{( zajVsMgXVIz}ew22cvdq8QG3!Ig zx5?eVw`#vS60;_Hf7hR?GU2r=5~ueV6>h9iQ&Lm%OXF!MeI2=d9^;0s(|Qf(sNbGy zFt@nFaM@ky>9^&s-AeNG?Mvy2w0ZHnE~Z_;!A1DbvL{l>EmMRT7EC$x@xuzU(nNy* z9@Qr-n!i^aT(sG1rC|MOh2Hy?@7<@x))=2+su!1Ud+XlZe8h1c$g`fVelF{r5}E)& CZi&JG literal 0 HcmV?d00001