diff options
| author | Maciej Kasatkin <mk@realbadangel.pl> | 2012-10-16 00:17:32 +0200 | 
|---|---|---|
| committer | Maciej Kasatkin <mk@realbadangel.pl> | 2012-10-16 00:17:32 +0200 | 
| commit | 5a9e866d23ade15461cbcf339cfd4a1d58d4bf2d (patch) | |
| tree | 51d5f699b19d7a7e18bd4e01f89eba2f374bb014 | |
| parent | 77e83840f56e364ef94a072fb161bb67c9ac5323 (diff) | |
Update to battery box
| -rw-r--r-- | battery_box.lua | 56 | ||||
| -rw-r--r-- | solar_panel.lua | 4 | ||||
| -rw-r--r-- | textures/technic_battery_box_bottom.png | bin | 439 -> 2046 bytes | |||
| -rw-r--r-- | textures/technic_battery_box_side0.png | bin | 0 -> 2313 bytes | |||
| -rw-r--r-- | textures/technic_battery_box_side1.png | bin | 0 -> 2335 bytes | |||
| -rw-r--r-- | textures/technic_battery_box_side2.png | bin | 0 -> 2374 bytes | |||
| -rw-r--r-- | textures/technic_battery_box_side3.png | bin | 0 -> 2386 bytes | |||
| -rw-r--r-- | textures/technic_battery_box_side4.png | bin | 0 -> 2382 bytes | |||
| -rw-r--r-- | textures/technic_battery_box_side5.png | bin | 0 -> 2382 bytes | |||
| -rw-r--r-- | textures/technic_battery_box_side6.png | bin | 0 -> 2381 bytes | |||
| -rw-r--r-- | textures/technic_battery_box_side7.png | bin | 0 -> 2399 bytes | |||
| -rw-r--r-- | textures/technic_battery_box_side8.png | bin | 0 -> 2392 bytes | |||
| -rw-r--r-- | textures/technic_battery_box_top.png | bin | 208 -> 2390 bytes | |||
| -rw-r--r-- | textures/technic_menu_bg.png | bin | 0 -> 11018 bytes | |||
| -rw-r--r-- | textures/technic_solar_panel_bottom.png | bin | 0 -> 2046 bytes | 
15 files changed, 54 insertions, 6 deletions
| diff --git a/battery_box.lua b/battery_box.lua index 225984b..93f07ee 100644 --- a/battery_box.lua +++ b/battery_box.lua @@ -64,11 +64,13 @@ battery_box_formspec =  minetest.register_node("technic:battery_box", {  	description = "Battery box", -	tiles = {"technic_battery_box_top.png", "technic_battery_box_bottom.png", "technic_battery_box_side.png", -		"technic_battery_box_side.png", "technic_battery_box_side.png", "technic_battery_box_side.png"}, +	tiles = {"technic_battery_box_top.png", "technic_battery_box_bottom.png", "technic_battery_box_side0.png", +		"technic_battery_box_side0.png", "technic_battery_box_side0.png", "technic_battery_box_side0.png"},  	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},  	sounds = default.node_sound_wood_defaults(),  	technic_power_machine=1, +	last_side_shown=0, +	drop="technic:battery_box",  	on_construct = function(pos)  		local meta = minetest.env:get_meta(pos)  		meta:set_string("infotext", "Battery box") @@ -79,6 +81,7 @@ minetest.register_node("technic:battery_box", {  		inv:set_size("dst", 1)  		battery_charge = 0  		max_charge = 60000 +		last_side_shown=0  		end,	  	can_dig = function(pos,player)  		local meta = minetest.env:get_meta(pos); @@ -93,6 +96,42 @@ minetest.register_node("technic:battery_box", {  }) +for i=1,8,1 do +minetest.register_node("technic:battery_box"..i, { +	description = "Battery box", +	tiles = {"technic_battery_box_top.png", "technic_battery_box_bottom.png", "technic_battery_box_side"..i..".png", +		"technic_battery_box_side"..i..".png", "technic_battery_box_side"..i..".png", "technic_battery_box_side"..i..".png"}, +	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2,not_in_creative_inventory=1}, +	sounds = default.node_sound_wood_defaults(), +	technic_power_machine=1, +	last_side_shown=0, +	drop="technic:battery_box", +	on_construct = function(pos) +		local meta = minetest.env:get_meta(pos) +		meta:set_string("infotext", "Battery box") +		meta:set_float("technic_power_machine", 1) +		meta:set_string("formspec", battery_box_formspec) +		local inv = meta:get_inventory() +		inv:set_size("src", 1) +		inv:set_size("dst", 1) +		battery_charge = 0 +		max_charge = 60000 +		last_side_shown=0 +		end,	 +	can_dig = function(pos,player) +		local meta = minetest.env:get_meta(pos); +		local inv = meta:get_inventory() +		if not inv:is_empty("dst") then +			return false +		elseif not inv:is_empty("src") then +			return false +		end +		return true +	end, +}) +end + +  LV_nodes_visited = {}  function get_RE_item_load (load1,max_load) @@ -110,14 +149,23 @@ return math.floor(temp)  end  minetest.register_abm({ -	nodenames = {"technic:battery_box"}, +	nodenames = {"technic:battery_box","technic:battery_box1","technic:battery_box2","technic:battery_box3","technic:battery_box4", +		     "technic:battery_box5","technic:battery_box6","technic:battery_box7","technic:battery_box8" +			},  	interval = 1,  	chance = 1,  	action = function(pos, node, active_object_count, active_object_count_wider)  	local meta = minetest.env:get_meta(pos)  	charge= meta:get_float("battery_charge")  	max_charge= 60000 - +	local i=math.ceil((charge/max_charge)*8) +	if i>8 then i=8 end +	j=meta:get_float("last_side_shown") +	if i~=j then +	if i>0 then hacky_swap_node(pos,"technic:battery_box"..i)   +	elseif i==0 then hacky_swap_node(pos,"technic:battery_box") end  +	meta:set_float("last_side_shown",i) +	end  	local inv = meta:get_inventory()  	if inv:is_empty("src")==false  then   		srcstack = inv:get_stack("src", 1) diff --git a/solar_panel.lua b/solar_panel.lua index eacf987..f2d08f6 100644 --- a/solar_panel.lua +++ b/solar_panel.lua @@ -1,5 +1,5 @@  minetest.register_node("technic:solar_panel", { -	tiles = {"technic_solar_panel_top.png", "technic_solar_panel_side.png", "technic_solar_panel_side.png", +	tiles = {"technic_solar_panel_top.png", "technic_solar_panel_bottom.png", "technic_solar_panel_side.png",  		"technic_solar_panel_side.png", "technic_solar_panel_side.png", "technic_solar_panel_side.png"},  	groups = {snappy=2,choppy=2,oddly_breakable_by_hand=2},  	sounds = default.node_sound_wood_defaults(), @@ -54,7 +54,7 @@ minetest.register_abm(  		local light = minetest.env:get_node_light(pos1, nil)  		local meta = minetest.env:get_meta(pos)  		if light == nil then light = 0 end -		if light >= 12 then +		if light >= 14 then  			meta:set_string("infotext", "Solar Panel is active ")  			meta:set_float("active",1)  			local internal_EU_buffer=meta:get_float("internal_EU_buffer") diff --git a/textures/technic_battery_box_bottom.png b/textures/technic_battery_box_bottom.pngBinary files differ index 1b3cf48..03c7ccc 100644 --- a/textures/technic_battery_box_bottom.png +++ b/textures/technic_battery_box_bottom.png diff --git a/textures/technic_battery_box_side0.png b/textures/technic_battery_box_side0.pngBinary files differ new file mode 100644 index 0000000..2662ac0 --- /dev/null +++ b/textures/technic_battery_box_side0.png diff --git a/textures/technic_battery_box_side1.png b/textures/technic_battery_box_side1.pngBinary files differ new file mode 100644 index 0000000..7b8b99e --- /dev/null +++ b/textures/technic_battery_box_side1.png diff --git a/textures/technic_battery_box_side2.png b/textures/technic_battery_box_side2.pngBinary files differ new file mode 100644 index 0000000..56a44dc --- /dev/null +++ b/textures/technic_battery_box_side2.png diff --git a/textures/technic_battery_box_side3.png b/textures/technic_battery_box_side3.pngBinary files differ new file mode 100644 index 0000000..6bbe61b --- /dev/null +++ b/textures/technic_battery_box_side3.png diff --git a/textures/technic_battery_box_side4.png b/textures/technic_battery_box_side4.pngBinary files differ new file mode 100644 index 0000000..23caa0b --- /dev/null +++ b/textures/technic_battery_box_side4.png diff --git a/textures/technic_battery_box_side5.png b/textures/technic_battery_box_side5.pngBinary files differ new file mode 100644 index 0000000..8d4067d --- /dev/null +++ b/textures/technic_battery_box_side5.png diff --git a/textures/technic_battery_box_side6.png b/textures/technic_battery_box_side6.pngBinary files differ new file mode 100644 index 0000000..cd5b847 --- /dev/null +++ b/textures/technic_battery_box_side6.png diff --git a/textures/technic_battery_box_side7.png b/textures/technic_battery_box_side7.pngBinary files differ new file mode 100644 index 0000000..865b074 --- /dev/null +++ b/textures/technic_battery_box_side7.png diff --git a/textures/technic_battery_box_side8.png b/textures/technic_battery_box_side8.pngBinary files differ new file mode 100644 index 0000000..910c3bc --- /dev/null +++ b/textures/technic_battery_box_side8.png diff --git a/textures/technic_battery_box_top.png b/textures/technic_battery_box_top.pngBinary files differ index f10be04..4953a32 100644 --- a/textures/technic_battery_box_top.png +++ b/textures/technic_battery_box_top.png diff --git a/textures/technic_menu_bg.png b/textures/technic_menu_bg.pngBinary files differ new file mode 100644 index 0000000..18e6a56 --- /dev/null +++ b/textures/technic_menu_bg.png diff --git a/textures/technic_solar_panel_bottom.png b/textures/technic_solar_panel_bottom.pngBinary files differ new file mode 100644 index 0000000..b0ad82f --- /dev/null +++ b/textures/technic_solar_panel_bottom.png | 
