Added a chalkboard and fixed more sabotage issues.
parent
6d7413e162
commit
ef4437a34a
|
@ -118,7 +118,7 @@ function doors.door_toggle(pos, node, clicker, close)
|
|||
local map_id = lobby.game[player_name]
|
||||
local sabotage_level = lobby.sabotage_level[map_id] or 5
|
||||
local level = meta:get_int('level') or 0
|
||||
if level <= sabotage_level then
|
||||
if level < sabotage_level then
|
||||
if lock_status == 1 and (minetest.is_protected(pos, player_name) or not minetest.check_player_privs(player_name, { creative = true })) then
|
||||
return
|
||||
elseif lock_status == 2 then
|
||||
|
@ -378,7 +378,7 @@ function doors.trapdoor_toggle(pos, node, clicker, close)
|
|||
local map_id = lobby.game[player_name]
|
||||
local sabotage_level = lobby.sabotage_level[map_id] or 5
|
||||
local level = meta:get_int('level') or 0
|
||||
if level <= sabotage_level then
|
||||
if level < sabotage_level then
|
||||
if lock_status == 1 and (minetest.is_protected(pos, player_name) or not minetest.check_player_privs(player_name, { creative = true })) then
|
||||
return
|
||||
elseif lock_status == 2 then
|
||||
|
|
|
@ -35,7 +35,7 @@ function sabotage.builder_formspec(pos)
|
|||
'and should include something to let them know where/what was sabotaged and needs to be fixed.\n'..
|
||||
'This will be a chat message. The node description will also be included in the HUD display.\n'..
|
||||
'Sabotage level controls which tasks can be completed, or nodes can be interacted with. '..
|
||||
'Sabotage can be in levels 1-4, configurable nodes can have levels defined, if the level is BELOW the sabotage level it can still be interacted with.]'..
|
||||
'Sabotage can be in levels 1-4, configurable nodes can have levels defined, if the node\'s level is BELOW the sabotage level it can still be interacted with.]'..
|
||||
'textarea[1,5;14,1;alert;Alert Text:;'..alert..']'..
|
||||
'field[1,6.5;2.5,.75;chance;Chance:;'..chance..']'..
|
||||
'field[4.83,6.5;2.5,.75;damage;Damage:;'..damage..']'..
|
||||
|
|
|
@ -0,0 +1,76 @@
|
|||
local esc = minetest.formspec_escape
|
||||
|
||||
local function chalkboard_edit(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local title = meta:get_string('infotext')
|
||||
local body = meta:get_string('body')
|
||||
local formspec =
|
||||
'formspec_version[3]'..
|
||||
'size[16,9]'..
|
||||
'background[0,0;16,9;signs_chalkboard_bg.png]'..
|
||||
'field[0.25,.75;15.5,.75;title;Title:;'..esc(title)..']'..
|
||||
'textarea[.25,1.75;15.5,5.5;body;;'..esc(body)..']'..
|
||||
'button_exit[4.25,7.5;3,1;save;Save]'..
|
||||
'button_exit[8.75,7.5;3,1;preview;Preview]'
|
||||
return formspec
|
||||
end
|
||||
|
||||
local function chalkboard_read(pos)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local title = meta:get_string('infotext')
|
||||
local body = meta:get_string('body')
|
||||
local formspec =
|
||||
'formspec_version[3]'..
|
||||
'size[16,9]'..
|
||||
'background[0,0;16,9;signs_chalkboard_bg.png]'..
|
||||
'hypertext[.25,.25;15.5,1.5;;<center><style color=white size=40>'..esc(title)..'</style></center>]'..
|
||||
'textarea[.25,1.75;15.5,7;;;'..esc(body)..']'
|
||||
return formspec
|
||||
end
|
||||
|
||||
minetest.register_node('signs:chalkboard', {
|
||||
description = 'Chalkboard',
|
||||
drawtype = 'mesh',
|
||||
mesh = 'signs_chalkboard.obj',
|
||||
tiles = {'signs_chalkboard.png'},
|
||||
paramtype2 = 'facedir',
|
||||
paramtype = 'light',
|
||||
selection_box = {
|
||||
type = 'fixed',
|
||||
fixed = {-1, -.75, .4375, 1, .5, .5},
|
||||
},
|
||||
collision_box = {
|
||||
type = 'fixed',
|
||||
fixed = {-1, -.75, .4375, 1, .5, .5},
|
||||
},
|
||||
groups = {breakable=1},
|
||||
after_place_node = function(pos, placer)
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string('infotext', '')
|
||||
meta:set_string('body', '')
|
||||
end,
|
||||
on_rightclick = function(pos, node, clicker, itemstack, pointed_thing)
|
||||
local name = clicker:get_player_name()
|
||||
if minetest.is_protected(pos, name) or minetest.check_player_privs(name, { server = true }) then
|
||||
signs.player_pos[name] = pos
|
||||
minetest.show_formspec(name, 'signs:chalkboard_edit', chalkboard_edit(pos))
|
||||
else
|
||||
minetest.show_formspec(name, 'signs:chalkboard_read', chalkboard_read(pos))
|
||||
end
|
||||
end,
|
||||
})
|
||||
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
if formname == 'signs:chalkboard_edit' then
|
||||
local name = player:get_player_name()
|
||||
local pos = signs.player_pos[name]
|
||||
if fields.save then
|
||||
local meta = minetest.get_meta(pos)
|
||||
meta:set_string('infotext', fields.title)
|
||||
meta:set_string('body', fields.body)
|
||||
minetest.log('action', (name or '')..' wrote \''..fields.title..'\' to chalkboard at '..minetest.pos_to_string(pos))
|
||||
elseif fields.preview then
|
||||
minetest.show_formspec(name, 'signs:chalkboard_read', chalkboard_read(pos))
|
||||
end
|
||||
end
|
||||
end)
|
|
@ -1,4 +1,6 @@
|
|||
signs = {}
|
||||
signs.player_pos = {}
|
||||
|
||||
dofile(minetest.get_modpath('signs')..'/functions.lua')
|
||||
dofile(minetest.get_modpath('signs')..'/basic_signs.lua') -- Signs that just have infotext
|
||||
dofile(minetest.get_modpath('signs')..'/chalkboard.lua')
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
# Blender v3.2.0 OBJ File: 'sign.blend'
|
||||
# www.blender.org
|
||||
o Chalkboard_Cube.001
|
||||
v 1.000000 -0.750000 0.437500
|
||||
v 1.000000 0.500000 0.437500
|
||||
v 1.000000 0.500000 0.500000
|
||||
v 1.000000 -0.750000 0.500000
|
||||
v -1.000000 -0.750000 0.500000
|
||||
v -1.000000 0.500000 0.500000
|
||||
v -1.000000 0.500000 0.437500
|
||||
v -1.000000 -0.750000 0.437500
|
||||
vt 0.031250 0.203125
|
||||
vt 0.031250 0.796875
|
||||
vt 0.000000 0.796875
|
||||
vt -0.000000 0.203125
|
||||
vt 0.968750 0.796875
|
||||
vt 0.968750 0.203125
|
||||
vt 1.000000 0.203125
|
||||
vt 1.000000 0.796875
|
||||
vt 1.000000 0.203125
|
||||
vt 1.000000 0.796875
|
||||
vt -0.000000 0.796875
|
||||
vt -0.000000 0.203125
|
||||
vt -0.000000 0.171875
|
||||
vt 1.000000 0.171875
|
||||
vt 0.000000 0.796875
|
||||
vt 1.000000 0.796875
|
||||
vt 1.000000 0.828125
|
||||
vt 0.000000 0.828125
|
||||
vn 1.0000 0.0000 0.0000
|
||||
vn -1.0000 0.0000 0.0000
|
||||
vn 0.0000 0.0000 -1.0000
|
||||
vn 0.0000 -1.0000 0.0000
|
||||
vn 0.0000 1.0000 0.0000
|
||||
s 1
|
||||
f 1/1/1 2/2/1 3/3/1 4/4/1
|
||||
f 5/5/2 6/6/2 7/7/2 8/8/2
|
||||
f 8/9/3 7/10/3 2/11/3 1/12/3
|
||||
f 4/13/4 5/14/4 8/9/4 1/12/4
|
||||
f 6/15/5 3/16/5 2/17/5 7/18/5
|
Binary file not shown.
After Width: | Height: | Size: 13 KiB |
Binary file not shown.
After Width: | Height: | Size: 47 KiB |
|
@ -62,7 +62,7 @@ minetest.register_node('tasks:food_crate_apple_active',{
|
|||
local sabotage_level = lobby.sabotage_level[map_id] or 5
|
||||
local meta = minetest.get_meta(pos)
|
||||
local level = meta:get_int('level') or 0
|
||||
if level <= sabotage_level then
|
||||
if level < sabotage_level then
|
||||
tasks.player_config[name] = pos
|
||||
minetest.show_formspec(name, 'tasks:food_crate_apple', formspec_apple_bad())
|
||||
else
|
||||
|
|
|
@ -88,7 +88,7 @@ function tasks.right_click_on(pos, node, clicker, formspec)
|
|||
local map_id = lobby.game[name]
|
||||
local sabotage_level = lobby.sabotage_level[map_id] or 5
|
||||
local level = meta:get_int('level') or 0
|
||||
if level <= sabotage_level then
|
||||
if level < sabotage_level then
|
||||
minetest.show_formspec(name, 'tasks:good', formspec)
|
||||
meta:set_string('formspec', '')--Can be removed at a future point, this just clears formspecs from individual nodes as they are now handled differently.
|
||||
else
|
||||
|
@ -102,7 +102,7 @@ function tasks.right_click_off(pos, node, clicker, formspec)
|
|||
local sabotage_level = lobby.sabotage_level[map_id] or 5
|
||||
local meta = minetest.get_meta(pos)
|
||||
local level = meta:get_int('level') or 0
|
||||
if level <= sabotage_level then
|
||||
if level < sabotage_level then
|
||||
tasks.player_config[name] = pos
|
||||
minetest.show_formspec(name, 'tasks:part_req_form', formspec)
|
||||
else
|
||||
|
|
|
@ -46,7 +46,7 @@ minetest.register_node('tasks:microscope',{
|
|||
local level = meta:get_int('level') or 0
|
||||
print ('sabotage level is '..sabotage_level)
|
||||
print ('node level is '..level)
|
||||
if level <= sabotage_level then --helps to check if the level is actually sabotaged
|
||||
if level < sabotage_level then --helps to check if the level is actually sabotaged
|
||||
tasks.player_config[name] = pos
|
||||
if count == 0 then
|
||||
tasks.right_click_on(pos, node, clicker, formspec_idle)
|
||||
|
|
Loading…
Reference in New Issue