Add light to the crane top (#11)

This commit is contained in:
Emojigit 2021-04-29 00:57:22 +08:00 committed by GitHub
parent 599b2c93c6
commit 3975b970ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 9 deletions

@ -33,8 +33,9 @@ default
# License # License
Copyright (C) 2017-2020 Joachim Stolberg Copyright (C) 2017-2020 Joachim Stolberg
Code: Licensed under the GNU LGPL version 2.1 or later. See LICENSE.txt and http://www.gnu.org/licenses/lgpl-2.1.txt Code: Licensed under the GNU LGPL version 2.1 or later. See LICENSE.txt and http://www.gnu.org/licenses/lgpl-2.1.txt
Textures: CC0 (by Ammoth) Textures: Mostly CC0 (by Ammoth)
* `morelights_extras_blocklight.png`: CC BY-SA 4.0 (by random-geek)
# History: # History:
* 2017-06-04 v0.01 first version * 2017-06-04 v0.01 first version

@ -9,7 +9,7 @@
Nodes Meta data Nodes Meta data
+--------+ +--------+
| | - last_known_pos as "(x,y,z)" | | - last_known_pos as "(x,y,z)"
| switch | - last_used | switch | - last_used
| | - running | | - running
@ -26,7 +26,7 @@ local P2S = function(pos) if pos then return minetest.pos_to_string(pos) end end
local S2P = minetest.string_to_pos local S2P = minetest.string_to_pos
-- crane minimum size -- crane minimum size
local MIN_SIZE = 8 local MIN_SIZE = 8
towercrane = {} towercrane = {}
@ -53,7 +53,7 @@ local function formspec(height, width)
return "size[5,4]".. return "size[5,4]"..
"label[0,0;"..S("Construction area size").."]" .. "label[0,0;"..S("Construction area size").."]" ..
"field[1,1.5;3,1;size;height,width;"..text.."]" .. "field[1,1.5;3,1;size;height,width;"..text.."]" ..
"button_exit[1,2;2,1;exit;"..S("Build").."]" "button_exit[1,2;2,1;exit;"..S("Build").."]"
end end
local function get_node_lvm(pos) local function get_node_lvm(pos)
@ -154,7 +154,7 @@ end
local function construct_crane(pos, dir, height, width) local function construct_crane(pos, dir, height, width)
local add = function(pos, node_name, tArg) local add = function(pos, node_name, tArg)
minetest.add_node(pos, { minetest.add_node(pos, {
name = node_name, name = node_name,
param2 = minetest.dir_to_facedir(tArg.dir)}) param2 = minetest.dir_to_facedir(tArg.dir)})
end end
local tArg = {dir = dir} local tArg = {dir = dir}
@ -292,7 +292,7 @@ minetest.register_node("towercrane:base", {
return true return true
end, end,
-- evaluate user input (height, width), -- evaluate user input (height, width),
-- destroy old crane and build a new one with -- destroy old crane and build a new one with
-- the given size -- the given size
on_receive_fields = function(pos, formname, fields, player) on_receive_fields = function(pos, formname, fields, player)
@ -324,7 +324,7 @@ minetest.register_node("towercrane:base", {
end end
return true return true
end, end,
on_destruct = function(pos) on_destruct = function(pos)
towercrane.get_crane_down(pos) towercrane.get_crane_down(pos)
end, end,
@ -333,10 +333,11 @@ minetest.register_node("towercrane:base", {
minetest.register_node("towercrane:balance", { minetest.register_node("towercrane:balance", {
description = S("Tower Crane Balance"), description = S("Tower Crane Balance"),
tiles = { tiles = {
"towercrane_base.png^towercrane_screws.png", "towercrane_base.png^towercrane_screws.png^morelights_extras_blocklight.png",
}, },
paramtype = "light", paramtype = "light",
paramtype2 = "facedir", paramtype2 = "facedir",
light_source = 12,
sunlight_propagates = true, sunlight_propagates = true,
is_ground_content = false, is_ground_content = false,
groups = {crumbly=0, not_in_creative_inventory=1}, groups = {crumbly=0, not_in_creative_inventory=1},
@ -411,4 +412,3 @@ towercrane.turnright = turnright
towercrane.turnleft = turnleft towercrane.turnleft = turnleft
towercrane.is_my_crane = is_my_crane towercrane.is_my_crane = is_my_crane
towercrane.get_crane_data = get_crane_data towercrane.get_crane_data = get_crane_data

Binary file not shown.

After

Width:  |  Height:  |  Size: 204 B