From c3eb886244772240943a26b93c64489618335023 Mon Sep 17 00:00:00 2001 From: Joachim Stolberg Date: Tue, 15 Jun 2021 17:44:58 +0200 Subject: [PATCH] Add ta2 gravity energy storage system --- power/ta2_winch.lua | 84 +++++++++++++++++++++++++++-- textures/techage_weight_bottom.png | Bin 0 -> 3632 bytes textures/techage_weight_side.png | Bin 0 -> 2749 bytes 3 files changed, 80 insertions(+), 4 deletions(-) create mode 100644 textures/techage_weight_bottom.png create mode 100644 textures/techage_weight_side.png diff --git a/power/ta2_winch.lua b/power/ta2_winch.lua index fd5a8ed..5f76fee 100644 --- a/power/ta2_winch.lua +++ b/power/ta2_winch.lua @@ -42,7 +42,7 @@ minetest.register_node("techage:ta2_winch", { Axle:after_place_node(pos, {outdir}) local pos1, pos2 = techage.renew_rope(pos, 10) local pos3 = {x = pos1.x, y = (pos1.y + pos2.y) / 2, z = pos1.z} -- mid-pos - minetest.add_entity(pos3, "techage:ta2_weight_chest") + minetest.add_entity(pos3, "techage:ta2_weight_chest_entity") minetest.get_node_timer(pos):start(2) power.start_storage_calc(pos, Axle, outdir) end, @@ -63,7 +63,7 @@ minetest.register_node("techage:ta2_winch", { if mem.obj then mem.obj:remove() end - mem.obj = minetest.add_entity({x = pos.x, y = y, z = pos.z}, "techage:ta2_weight_chest") + mem.obj = minetest.add_entity({x = pos.x, y = y, z = pos.z}, "techage:ta2_weight_chest_entity") end --print("on_timer", nvm.load) return true @@ -87,12 +87,12 @@ minetest.register_node("techage:ta2_winch", { sounds = default.node_sound_wood_defaults(), }) -minetest.register_entity("techage:ta2_weight_chest", { +minetest.register_entity("techage:ta2_weight_chest_entity", { initial_properties = { physical = true, collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5}, visual = "wielditem", - textures = {"techage:chest_ta2"}, + textures = {"techage:ta2_weight_chest"}, visual_size = {x=0.66, y=0.66, z=0.66}, static_save = false, }, @@ -101,6 +101,82 @@ minetest.register_entity("techage:ta2_weight_chest", { power.register_nodes({"techage:ta2_winch"}, Axle, "sto", {"R"}) +local function allow_metadata_inventory_put(pos, listname, index, stack, player) + if minetest.is_protected(pos, player:get_player_name()) then + return 0 + end + return stack:get_count() +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 + +local function can_dig(pos, player) + if minetest.is_protected(pos, player:get_player_name()) then + return false + end + local inv = minetest.get_meta(pos):get_inventory() + return inv:is_empty("main") +end + +local function after_dig_node(pos, oldnode, oldmetadata, digger) + techage.remove_node(pos, oldnode, oldmetadata) +end + +local function formspec() + return "size[8,6.7]".. + default.gui_bg.. + default.gui_bg_img.. + default.gui_slots.. + "list[context;main;1,0;6,2;]".. + "list[current_player;main;0,3;8,4;]".. + "listring[context;main]".. + "listring[current_player;main]" +end + +minetest.register_node("techage:ta2_weight_chest", { + description = S("TA2 Weight Chest"), + tiles = { + -- up, down, right, left, back, front + "techage_filling_ta2.png^techage_frame_ta2.png^techage_weight_bottom.png", + "techage_filling_ta2.png^techage_frame_ta2.png^techage_weight_bottom.png", + "techage_filling_ta2.png^techage_frame_ta2.png^techage_appl_chest_back_ta3.png^techage_weight_side.png", + "techage_filling_ta2.png^techage_frame_ta2.png^techage_appl_chest_back_ta3.png^techage_weight_side.png", + "techage_filling_ta2.png^techage_frame_ta2.png^techage_appl_chest_back_ta3.png^techage_weight_side.png", + "techage_filling_ta2.png^techage_frame_ta2.png^techage_appl_chest_front_ta3.png^techage_weight_side.png", + }, + + on_construct = function(pos) + local meta = minetest.get_meta(pos) + local inv = meta:get_inventory() + inv:set_size('main', 12) + end, + + after_place_node = function(pos, placer) + local meta = minetest.get_meta(pos) + meta:set_string("owner", placer:get_player_name()) + meta:set_string("formspec", formspec()) + end, + + techage_set_numbers = function(pos, numbers, player_name) + return techage.logic.set_numbers(pos, numbers, player_name, S("TA2 Weight Chest")) + end, + + can_dig = can_dig, + after_dig_node = after_dig_node, + allow_metadata_inventory_put = allow_metadata_inventory_put, + allow_metadata_inventory_take = allow_metadata_inventory_take, + + paramtype2 = "facedir", + groups = {choppy=2, cracky=2, crumbly=2}, + is_ground_content = false, + sounds = default.node_sound_wood_defaults(), +}) + --minetest.register_craft({ -- output = "techage:ta4_laser_emitter", -- recipe = { diff --git a/textures/techage_weight_bottom.png b/textures/techage_weight_bottom.png new file mode 100644 index 0000000000000000000000000000000000000000..83838a05fe722662d7275b7c47207908c37a8cc8 GIT binary patch literal 3632 zcmV-04$tw4P) zaB^>EX>4U6ba`-PAZ2)IW&i+q+O3!AaqKz{h5s{(34t59gu_i$lfesrK2TCGwy*6w z^;+(xOi>_!0~~;6{qx_${D+S(&YCE>q?(fD6Kkx#aZ~L1sr%R2xPSM@Uyu0zZQeW{ zc%}klIRDMjwXY6(bMk#>K6?Lg_rdwTUGw3CFVp2CZoYir@IS z?Wc$??ipKQ;~ZEgjAvFjljkJ>7qPdXj0+%OlMCXKv)TLX9DXbS)X?0M8yy6kh@U9w zV+hHc?2FgEc_+KQ){9SGr{N}m5Hc%+O$`mOVie*h$3hG>2@*vlNtR-yN=qTdBq^nw zl;m0tIcCWz=Uj5lt%MSblvHvlrIuEG4RD~;RC6u0*4DgfY}Am|Sl^iGzK0&W^we`N zz4kT;pAmQ)Z8@`GiWQfvwDKyeu67V>M>ygkM>_IRj(W5Q zY8R@XuD?LdU8wnul&;GU)R;9n-y)pSi6~|u=A#4gtOyX$UNN)9#po3|#mrXaH1Q}Y zijA305d*@woR`BruzMo+E8L8fU*YC|Le403{|0gf=sx521!`04+}MbnS*Sj>f$Zb? zD$V%Pw5YZBvCpvj80Q!o=0e&cy?N|*zSlHMWosv^@s&eN1D-Ng8mAD-*(a$_>4+F> zozjWtXjN`#dB$aiq~#|LotX*zCNkU{r8cYY`!>pX1809XntgM`(GDsdj%fpB*=qq% zTk3ro%MCR^4XKBYan%wp8({C@|HelltqOf0IcL04^!d82tTEq(QNRVD7DBR3Yb93TlFy z3OkOz>cBcu=M*9ps{Jfp(eu1e=jho6UM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