Updated tasks to a new infotext system.

master
Nathan Salapat 2022-08-29 21:05:26 -05:00
parent 116047ccdf
commit a28fe1e48b
35 changed files with 469 additions and 113 deletions

View File

@ -3,6 +3,7 @@ Thanks for your interest in contributing to the project. In an attempt to keep t
Code/Media
1. This isn't a resource collecting game, and there is no crafting, so recipes and craft items aren't needed.
2. Textures should be 32PX, please use global textures where possible. (check out lobby/nodes_passive.lua if you aren't sure what that looks like.)
2.5 GUI textures should be set to 32px per inventory slot. So a 10x10 formspec would use a 320x320 texture for the background.
3. 95% of all content will be in levels. This will hold all the building blocks save for the ones used in the lobby mod.
4. Task related content will go in the tasks mod.
5. Lighting nodes go in the lights mod.

View File

@ -0,0 +1,70 @@
# Blender v3.2.1 OBJ File: 'furniture.blend'
# www.blender.org
o Cube.001_Cube.075
v -0.375000 -0.500000 0.312500
v -0.375000 0.250000 0.312500
v -0.375000 -0.500000 -0.312500
v -0.375000 0.250000 -0.312500
v 0.375000 -0.500000 0.312500
v 0.375000 0.250000 0.312500
v 0.375000 -0.500000 -0.312500
v 0.375000 0.250000 -0.312500
v -0.437500 0.250000 0.437500
v -0.437500 0.250000 -0.437500
v 0.437500 0.250000 -0.437500
v 0.437500 0.250000 0.437500
v -0.437500 0.687500 0.437500
v -0.437500 0.687500 -0.437500
v 0.437500 0.687500 -0.437500
v 0.437500 0.687500 0.437500
vt 0.765625 0.468750
vt 0.765625 0.656250
vt 0.609375 0.656250
vt 0.609375 0.468750
vt 0.421875 0.656250
vt 0.421875 0.468750
vt 0.265625 0.656250
vt 0.265625 0.468750
vt 0.078125 0.656250
vt 0.078125 0.468750
vt 0.609375 0.281250
vt 0.765625 0.281250
vt 0.812500 0.468750
vt 0.812500 0.656250
vt 0.781250 0.671875
vt 0.781250 0.453125
vt 0.343750 0.671875
vt 0.562500 0.671875
vt 0.562500 0.781250
vt 0.343750 0.781250
vt 0.968750 0.468750
vt 1.000000 0.453125
vt 0.968750 0.656250
vt 1.000000 0.671875
vt 0.781250 1.000000
vt 0.781250 0.781250
vt 1.000000 0.781250
vt 1.000000 1.000000
vt 0.125000 0.671875
vt 0.125000 0.781250
vn -1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.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 off
f 1/1/1 2/2/1 4/3/1 3/4/1
f 3/4/2 4/3/2 8/5/2 7/6/2
f 7/6/3 8/5/3 6/7/3 5/8/3
f 5/8/4 6/7/4 2/9/4 1/10/4
f 3/4/5 7/11/5 5/12/5 1/1/5
f 8/13/5 4/14/5 10/15/5 11/16/5
f 12/17/3 11/18/3 15/19/3 16/20/3
f 6/21/5 8/13/5 11/16/5 12/22/5
f 4/14/5 2/23/5 9/24/5 10/15/5
f 2/23/5 6/21/5 12/22/5 9/24/5
f 15/25/6 14/26/6 13/27/6 16/28/6
f 10/15/1 9/24/1 13/27/1 14/26/1
f 9/29/4 12/17/4 16/20/4 13/30/4
f 11/18/2 10/15/2 14/26/2 15/19/2

View File

@ -0,0 +1,72 @@
# Blender v3.2.1 OBJ File: 'furniture.blend'
# www.blender.org
o Trash_bin_Cube.074
v -0.375000 -0.500000 0.375000
v -0.375000 0.500000 0.375000
v -0.375000 -0.500000 -0.375000
v -0.375000 0.500000 -0.375000
v 0.375000 -0.500000 0.375000
v 0.375000 0.500000 0.375000
v 0.375000 -0.500000 -0.375000
v 0.375000 0.500000 -0.375000
v -0.312500 0.500000 0.312500
v -0.312500 0.500000 -0.312500
v 0.312500 0.500000 -0.312500
v 0.312500 0.500000 0.312500
v -0.312500 -0.250000 0.312500
v -0.312500 -0.250000 -0.312500
v 0.312500 -0.250000 -0.312500
v 0.312500 -0.250000 0.312500
vt 0.375000 0.734375
vt 0.375000 0.984375
vt 0.187500 0.984375
vt 0.187500 0.734375
vt 0.000000 0.984375
vt 0.000000 0.734375
vt 0.750000 0.734375
vt 0.750000 0.984375
vt 0.562500 0.984375
vt 0.562500 0.734375
vt 0.734375 1.000000
vt 0.578125 1.000000
vt 0.359375 0.718750
vt 0.203125 0.718750
vt 0.203125 0.531250
vt 0.359375 0.531250
vt 0.359375 1.000000
vt 0.203125 1.000000
vt 0.546875 1.000000
vt 0.390625 1.000000
vt 0.171875 1.000000
vt 0.015625 1.000000
vt 0.828125 0.531250
vt 0.671875 0.531250
vt 0.671875 0.375000
vt 0.828125 0.375000
vt 0.671875 0.718750
vt 0.515625 0.718750
vt 0.515625 0.531250
vt 0.828125 0.718750
vt 0.000000 0.546875
vt 0.187500 0.546875
vn -1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.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 off
f 1/1/1 2/2/1 4/3/1 3/4/1
f 3/4/2 4/3/2 8/5/2 7/6/2
f 7/7/3 8/8/3 6/9/3 5/10/3
f 5/10/4 6/9/4 2/2/4 1/1/4
f 6/9/5 8/8/5 11/11/5 12/12/5
f 12/13/1 11/14/1 15/15/1 16/16/1
f 4/3/5 2/2/5 9/17/5 10/18/5
f 2/2/5 6/9/5 12/19/5 9/20/5
f 8/5/5 4/3/5 10/21/5 11/22/5
f 15/23/5 14/24/5 13/25/5 16/26/5
f 10/27/3 9/28/3 13/29/3 14/24/3
f 9/28/2 12/13/2 16/16/2 13/29/2
f 11/30/4 10/27/4 14/24/4 15/23/4
f 3/4/6 7/6/6 5/31/6 1/32/6

View File

@ -167,3 +167,43 @@ minetest.register_node('furniture:well', {
},
groups = {breakable=1},
})
minetest.register_node('furniture:trash_bin', {
description = 'Trash Bin',
drawtype = 'mesh',
mesh = 'furniture_trash_bin.obj',
tiles = {'furniture_trash_bin.png'},
paramtype = 'light',
paramtype2 = 'facedir',
selection_box = {
type = 'fixed',
fixed = {-.375, -.5, -.375, .375, .5, .375},
},
collision_box = {
type = 'fixed',
fixed = {-.375, -.5, -.375, .375, .5, .375},
},
groups = {breakable=1}
})
minetest.register_node('furniture:recycling_bin', {
description = 'Recycling Bin',
drawtype = 'mesh',
mesh = 'furniture_recycling_bin.obj',
tiles = {'furniture_recycling_bin.png'},
paramtype = 'light',
paramtype2 = 'facedir',
selection_box = {
type = 'fixed',
fixed = {{-.375, -.5, -.375, .375, .5, .375},
{-.4375, .25, -.4375, .4375, .6875, .4375}
},
},
collision_box = {
type = 'fixed',
fixed = {{-.375, -.5, -.375, .375, .5, .375},
{-.4375, .25, -.4375, .4375, .6875, .4375}
},
},
groups = {breakable=1}
})

Binary file not shown.

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@ -38,7 +38,7 @@ end
minetest.register_node('lobby:emergency_button', {
description = 'Emergency Button',
drawtype = 'mesh',
mesh = 'lobby_button.obj',
mesh = 'lobby_emergency_button.obj',
tiles = {'lobby_button_frame.png', 'lobby_button_button.png'},
use_texture_alpha = 'clip',
groups = {breakable=1},

View File

@ -1,4 +1,4 @@
# Blender v2.90.0 Beta OBJ File: 'button.blend'
# Blender v3.2.1 OBJ File: 'button.blend'
# www.blender.org
o Cube.001_Cube
v -0.500000 -0.500000 0.500000
@ -45,44 +45,44 @@ vt 0.000000 -0.000000
vt 0.000000 0.062500
vt 0.062500 0.000000
vt 0.062500 1.000000
vt 0.937500 0.937500
vt 0.937500 1.000000
vt 0.781250 1.000000
vt 0.781250 0.937500
vt 0.625000 1.000000
vt 0.625000 0.937500
vt 0.468750 1.000000
vt 0.468750 0.937500
vt 0.312500 1.000000
vt 0.312500 0.937500
vt 0.156250 1.000000
vt 1.000000 0.875000
vt 1.000000 0.937500
vt 0.843750 0.937500
vt 0.843750 0.875000
vt 0.656250 0.937500
vt 0.656250 0.875000
vt 0.500000 0.937500
vt 0.500000 0.875000
vt 0.343750 0.937500
vt 0.343750 0.875000
vt 0.156250 0.937500
vt -0.000000 1.000000
vt -0.000000 0.937500
vt -0.000000 0.875000
vt 0.156250 0.875000
vt 0.000000 0.937500
vt 0.000000 0.875000
vt 0.000000 1.000000
vt 0.156250 0.937500
vt 0.312500 0.875000
vt 0.312500 0.937500
vt 0.468750 0.875000
vt 0.468750 0.937500
vt 0.625000 0.875000
vt 0.625000 0.937500
vt 0.000000 0.468750
vt 0.000000 0.281250
vt 0.093750 0.093750
vt 0.281250 0.000000
vt 0.468750 0.000000
vt 0.656250 0.093750
vt 0.750000 0.281250
vt 0.750000 0.468750
vt 0.656250 0.656250
vt 0.468750 0.750000
vt 0.281250 0.750000
vt 0.093750 0.656250
vt 0.781250 0.875000
vt 0.781250 0.937500
vt 0.937500 0.875000
vt 0.156250 1.000000
vt 0.343750 0.937500
vt 0.343750 1.000000
vt 0.500000 0.937500
vt 0.500000 1.000000
vt 0.656250 0.937500
vt 0.656250 1.000000
vt 0.595238 0.733620
vt 0.404555 0.784348
vt 0.213872 0.733619
vt 0.074283 0.595028
vt 0.023190 0.405708
vt 0.074283 0.216388
vt 0.213872 0.077797
vt 0.404555 0.027069
vt 0.595237 0.077796
vt 0.734827 0.216388
vt 0.785920 0.405708
vt 0.734827 0.595028
vt 0.843750 0.937500
vt 0.843750 1.000000
vt 1.000000 1.000000
vn -1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
vn 1.0000 0.0000 0.0000
@ -114,10 +114,10 @@ f 13/18/8 14/17/8 16/19/8 15/20/8
f 15/20/9 16/19/9 18/21/9 17/22/9
f 17/22/10 18/21/10 20/23/10 19/24/10
f 19/24/11 20/23/11 22/25/11 21/26/11
f 21/26/12 22/27/12 24/28/12 23/29/12
f 21/27/12 22/25/12 24/28/12 23/29/12
f 23/29/13 24/28/13 26/30/13 25/31/13
f 25/31/14 26/30/14 28/32/14 27/33/14
f 27/33/15 28/32/15 30/34/15 29/35/15
f 12/36/5 10/37/5 32/38/5 30/39/5 28/40/5 26/41/5 24/42/5 22/43/5 20/44/5 18/45/5 16/46/5 14/47/5
f 29/35/16 30/34/16 32/48/16 31/49/16
f 31/49/17 32/48/17 10/50/17 9/13/17
f 31/49/17 32/48/17 10/14/17 9/50/17

Binary file not shown.

Before

Width:  |  Height:  |  Size: 5.7 KiB

After

Width:  |  Height:  |  Size: 4.6 KiB

View File

@ -25,12 +25,16 @@ minetest.register_tool('tasks:configurator', {
function tasks.configure(pos, name)
local meta = minetest.get_meta(pos)
local infotext = meta:get_string('infotext')
local info_working = meta:get_string('info_working')
local info_repair = meta:get_string('info_repair')
local time_min = meta:get_int('time_min') or 60
local time_max = meta:get_int('time_max') or 120
local xp = meta:get_int('xp') or 5
local level = meta:get_int('level') or 0
minetest.show_formspec(name, 'tasks:configuration', tasks.configuration_formspec(infotext, time_min, time_max, xp, level))
if info_working == '' then
info_working = meta:get_string('infotext')
end
minetest.show_formspec(name, 'tasks:configuration', tasks.configuration_formspec(info_working, info_repair, time_min, time_max, xp, level))
end
minetest.register_on_player_receive_fields(function(player, formname, fields)
@ -44,9 +48,10 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
local timer = minetest.get_node_timer(pos)
meta:set_int('time_min', math.max(fields.time_min,5))
meta:set_int('time_max', math.max(fields.time_max,20))
meta:set_int('xp', fields.xp)
meta:set_int('xp', math.max(fields.xp,0))
meta:set_int('level', math.min(fields.level, 4))
meta:set_string('infotext', fields.infotext)
meta:set_string('info_working', fields.info_working)
meta:set_string('info_repair', fields.info_repair)
local random_number = math.random(fields.time_min, fields.time_max)
timer:start(random_number)
else
@ -56,20 +61,27 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
end)
function tasks.configuration_formspec(infotext, time_min, time_max, xp, level)
function tasks.configuration_formspec(info_working, info_repair, time_min, time_max, xp, level)
local formspec =
'formspec_version[3]'..
'size[8,6]'..
'textarea[.5,.5;7,2;;;Set the minimum and maximum time a task will run before becoming available, and the XP to be awarded upon completion of the task. '..
'Minimum time must be 5 or more seconds, and max time must be 20 or more seconds. Whole numbers only.\n'..
'Pro-tip, set the min and max times the same to remove randomization.\n'..
'You can ignore the level input if you aren\'t adding a node you can sabotage.]'..
'field[1,3;6,.5;infotext;Infotext;'..infotext..']'..
'field[1,4;2,.5;time_min;Minimum time;'..time_min..']'..
'field[5,4;2,.5;time_max;Maximum time;'..time_max..']'..
'field[1,5;1.5,.5;xp;XP;'..xp..']'..
'field[3.25,5;1.5,.5;level;Level;'..level..']'..
'button_exit[5.5,5;1.5,.5;save;Submit]'
'size[12,10]'..
'background[-2,-2;16,14;tasks_configurator_ui_bg.png]'..
'textarea[0,0;12,3.5;;;Set the time range a task can become available within. '..
'A random number within the range will be used. Minimum time must be 5 or more seconds, '..
'and max time must be 20 or more seconds. Whole numbers only! '..
'Right-clicking on an unavailable task will restart the timer with a new random number. '..
'If you always want the task to take the same length of time to become available simply set both values to the same number.\n'..
'Enter the amount of XP to be granted to a player in a match. Ghosts will add half this value, '..
'and players solo playing a level will only get 1 XP.\n'..
'Levels can be 1-4, if the level is below the sabotage level it can be interacted with while the map is sabotaged.\n'..
'Do note that not all tasks have configurable infotexts even though they display here.]'..
'field[0,4.5;12,.6;info_working;Infotext to displayed when the task is unavailable;'..info_working..']'..
'field[0,5.75;12,.6;info_repair;Infotext to displayed when the task is available;'..info_repair..']'..
'field[0,7;2,.6;time_min;Min time;'..time_min..']'..
'field[3.25,7;2,.6;time_max;Max time;'..time_max..']'..
'field[6.75,7;2,.6;xp;XP;'..xp..']'..
'field[10,7;2,.6;level;Level;'..level..']'..
'button_exit[8,9;3,1;save;Submit]'
return formspec
end

View File

@ -33,7 +33,7 @@ minetest.register_node('tasks:engine_0_on',{
groups = {breakable = 1, tasks=1, plays_sound=1},
_sound = 'tasks_engine_0_run',
on_construct = function(pos)
tasks.on_construct(pos, 'Arc Reactor')
tasks.on_construct(pos, 'Arc Reactor', 'Broken Arc Reactor')
end,
on_rightclick = function(pos, node, clicker)
tasks.right_click_on(pos, node, clicker, formspec_good)
@ -41,9 +41,9 @@ minetest.register_node('tasks:engine_0_on',{
on_timer = function(pos)
local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos)
local infotext = meta:get_string('infotext')
local infotext = meta:get_string('info_repair')
minetest.sound_play('tasks_engine_0_stop', {pos = pos, gain = 1, max_hear_distance = 10})
meta:set_string('infotext', infotext..' (Needs repair!)')
meta:set_string('infotext', infotext)
minetest.after(11, function()
minetest.swap_node(pos, {name = 'tasks:engine_0_off', param2 = node.param2})
end)
@ -86,7 +86,7 @@ minetest.register_node('tasks:engine_0_off',{
local min = meta:get_int('time_min') or 30
local max = meta:get_int('time_max') or 60
local random_number = math.random(min,max)
local infotext = string.sub(meta:get_string('infotext'), 1, -17)
local infotext = meta:get_string('info_working')
inv:set_stack('part', 1, '')
minetest.sound_play('tasks_engine_0_start', {pos = pos, gain = 1, max_hear_distance = 10})
minetest.swap_node(pos, {name = 'tasks:engine_0_on', param2 = node.param2})

View File

@ -32,7 +32,7 @@ minetest.register_node('tasks:engine_1_on',{
_sound = 'tasks_engine_1_run',
groups = {breakable = 1, tasks=1, plays_sound=1},
on_construct = function(pos)
tasks.on_construct(pos, 'Plasma Accelerator')
tasks.on_construct(pos, 'Plasma Accelerator', 'Plasma Accelerator went too fast, needs repair.')
end,
on_rightclick = function(pos, node, clicker)
tasks.right_click_on(pos, node, clicker, formspec_good)
@ -40,9 +40,9 @@ minetest.register_node('tasks:engine_1_on',{
on_timer = function(pos)
local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos)
local infotext = meta:get_string('infotext')
local infotext = meta:get_string('info_repair')
minetest.sound_play('tasks_engine_1_stop', {pos = pos, gain = 1, max_hear_distance = 5})
meta:set_string('infotext', infotext..' (Needs repair!)')
meta:set_string('infotext', infotext)
minetest.after(5, function()
minetest.swap_node(pos, {name = 'tasks:engine_1_off', param2 = node.param2})
end)
@ -84,7 +84,7 @@ minetest.register_node('tasks:engine_1_off',{
local min = meta:get_int('time_min') or 30
local max = meta:get_int('time_max') or 60
local random_number = math.random(min,max)
local infotext = string.sub(meta:get_string('infotext'), 1, -17)
local infotext = meta:get_string('info_working')
inv:set_stack('part', 1, '')
minetest.sound_play('tasks_engine_1_start', {pos = pos, gain = 1, max_hear_distance = 10})
minetest.swap_node(pos, {name = 'tasks:engine_1_on', param2 = node.param2})

View File

@ -2,11 +2,11 @@
minetest.register_node('tasks:example_0', { --This node is inactive, so somebody completed the task.
description = 'example',
tiles = {name='task_1.png'},
tiles = {'task_1.png'},
groups = {breakable=1, not_in_creative_inventory=1, tasks=1},
light_source = 14,
on_construct = function(pos)
tasks.on_construct(pos, 'infotext')
tasks.on_construct(pos, 'Sample', 'Please don\'t use me')
end,
on_timer = function(pos)
local this_node = minetest.get_node(pos)
@ -24,7 +24,7 @@ minetest.register_node('tasks:example_0', { --This node is inactive, so somebody
minetest.register_node('tasks:example_1', { --This node is waiting for somebody to come along and complete the task.
description = 'example',
tiles = {name='task_1.png'},
tiles = {'task_1.png'},
groups = {breakable=1, not_in_creative_inventory=1, tasks=1},
light_source = 2,
drop = 'tasks:example_0',
@ -32,3 +32,55 @@ minetest.register_node('tasks:example_1', { --This node is waiting for somebody
tasks.add_xp(pos, node, puncher, 'tasks:example_0') --Everything is pulled from the node meta expect for what node to swap to.
end
})
local function math_clamp(val, lower, upper)
return math.max(lower, math.min(upper, val))
end
tasks.test = {}
local function test_formspec(name, pos, x, y)
x = math_clamp((x + math.random(-4,4)/10), 0, 9)
--y = math_clamp((y + math.random(-4,4)/10), 0, 6)
y = y - .2
local formspec =
'formspec_version[3]'..
'size[10,7]'..
'textarea[1,.5;8,1;;;Eww, something smells rotten! (Click the rotten food.)]'..
'image[1,1;8,5;tasks_food_crate_apples.png]'..
'image_button['..x..','..y..';1,1;tasks_food_crate_apple_rotten.png;rotten;;true;false;]'..
'image[3,3;4,1;doors_key_profile_2.png]'
minetest.show_formspec(name, 'tasks:test', formspec)
minetest.after(.1, function()
if y < 0 then
minetest.close_formspec(name, 'tasks:test')
tasks.test[name] = 'false'
end
if tasks.test[name] == 'true' then
test_formspec(name, pos, x, y)
end
end)
end
minetest.register_node('tasks:test', {
description = 'testing',
tiles = {'heart.png'},
groups = {breakable=1, not_in_creative_inventory=1, tasks=1},
on_rightclick = function(pos, node, clicker)
local name = clicker:get_player_name()
tasks.test[name] = 'true'
test_formspec(name, pos, 5, 6)
end,
})
minetest.register_on_player_receive_fields(function(player, formname, fields)
local name = player:get_player_name()
if formname == 'tasks:test' then
if fields.rotten then
minetest.close_formspec(name, 'tasks:test')
tasks.test[name] = 'false'
elseif fields.quit then
tasks.test[name] = 'false'
end
end
end)

View File

@ -1,6 +1,10 @@
local formspec_good =
'size[6,3]'..
'textarea[1,1;5,2;;;All the food looks good right now.]'
--Variations on this task could include;
--Oranges, Turnips, Beets, Carrots, Cabbage, Pears, Bananas
local formspec_apple_good =
'formspec_version[3]'..
'size[10,7]'..
'image[0,0;10,7;tasks_food_crate_apples.png]'
local function formspec_apple_bad()
local x = math.random(10,80)/10
@ -8,10 +12,26 @@ local function formspec_apple_bad()
local formspec =
'formspec_version[3]'..
'size[10,7]'..
'textarea[1,.5;8,1;;;Eww, something smells rotten! (Click the rotten food.)]'..
'image[1,1;8,5;tasks_food_crate_apples.png]'..
'image_button['..x..','..y..';1,1;tasks_food_crate_apple_rotten.png;rotten;;true;false;]'
'image[0,0;10,7;tasks_food_crate_apples.png]'..
'image_button['..x..','..y..';1,1;tasks_food_crate_apple_rotten.png;rotten;;true;false;]'..
'image[0,0;10,7;tasks_food_crate_apples_overlay.png]'
return formspec
end
local formspec_carrot_good =
'formspec_version[3]'..
'size[10,7]'..
'image[0,0;10,7;tasks_food_crate_carrots.png]'
local function formspec_carrot_bad()
local x = math.random(10,80)/10
local y = math.random(10,50)/10
local formspec =
'formspec_version[3]'..
'size[10,7]'..
'image[0,0;10,7;tasks_food_crate_carrots.png]'..
'image_button['..x..','..y..';1,1;tasks_food_crate_carrot_rotten.png;rotten;;true;false;]'..
'image[0,0;10,7;tasks_food_crate_carrots_overlay.png]'
return formspec
end
@ -24,23 +44,23 @@ minetest.register_node('tasks:food_crate_apple_idle',{
description = 'Apple Crate',
drawtype = 'mesh',
mesh = 'tasks_food_crate.obj',
tiles = {name = 'tasks_food_crate_apple.png'},
tiles = {'tasks_food_crate.png', 'tasks_food_crate_apples_node.png'},
paramtype = 'light',
paramtype2 = 'facedir',
selection_box = box,
collision_box = box,
groups = {breakable = 1, tasks=1},
on_construct = function(pos)
tasks.on_construct(pos, 'Apple Crate')
tasks.on_construct(pos, 'Apple Crate', 'Apple Crate with Rotten Fruit')
end,
on_rightclick = function(pos, node, clicker)
tasks.right_click_on(pos, node, clicker, formspec_good)
tasks.right_click_on(pos, node, clicker, formspec_apple_good)
end,
on_timer = function(pos)
local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos)
local infotext = meta:get_string('infotext')
meta:set_string('infotext', infotext..' (Rotten Fruit Inside)')
local infotext = meta:get_string('info_repair')
meta:set_string('infotext', infotext)
minetest.swap_node(pos, {name = 'tasks:food_crate_apple_active', param2 = node.param2})
end,
})
@ -49,7 +69,7 @@ minetest.register_node('tasks:food_crate_apple_active',{
description = 'Apple Crate',
drawtype = 'mesh',
mesh = 'tasks_food_crate.obj',
tiles = {name = 'tasks_food_crate_apple.png'},
tiles = {'tasks_food_crate.png', 'tasks_food_crate_apples_node.png'},
paramtype = 'light',
paramtype2 = 'facedir',
selection_box = box,
@ -71,6 +91,57 @@ minetest.register_node('tasks:food_crate_apple_active',{
end,
})
minetest.register_node('tasks:food_crate_carrot_idle',{
description = 'Carrot Crate',
drawtype = 'mesh',
mesh = 'tasks_food_crate.obj',
tiles = {'tasks_food_crate.png', 'tasks_food_crate_carrots_node.png'},
paramtype = 'light',
paramtype2 = 'facedir',
selection_box = box,
collision_box = box,
groups = {breakable = 1, tasks=1},
on_construct = function(pos)
tasks.on_construct(pos, 'Carrot Crate', 'Carrot Crate with Rotten Carrot')
end,
on_rightclick = function(pos, node, clicker)
tasks.right_click_on(pos, node, clicker, formspec_carrot_good)
end,
on_timer = function(pos)
local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos)
local infotext = meta:get_string('info_repair')
meta:set_string('infotext', infotext)
minetest.swap_node(pos, {name = 'tasks:food_crate_carrot_active', param2 = node.param2})
end,
})
minetest.register_node('tasks:food_crate_carrot_active',{
description = 'Carrot Crate',
drawtype = 'mesh',
mesh = 'tasks_food_crate.obj',
tiles = {'tasks_food_crate.png', 'tasks_food_crate_carrots_node.png'},
paramtype = 'light',
paramtype2 = 'facedir',
selection_box = box,
collision_box = box,
drop = 'tasks:food_crate_carrot_idle',
groups = {breakable = 1, tasks=1, not_in_creative_inventory=1},
on_rightclick = function(pos, node, clicker)
local name = clicker:get_player_name()
local map_id = lobby.game[name]
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
tasks.player_config[name] = pos
minetest.show_formspec(name, 'tasks:food_crate_carrot', formspec_carrot_bad())
else
minetest.chat_send_player(name, 'level is currently sabotaged, and you can\'t do this now.')
end
end,
})
minetest.register_on_player_receive_fields(function(player, formname, fields)
local name = player:get_player_name()
if formname == 'tasks:food_crate_apple'then
@ -78,10 +149,20 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
local pos = tasks.player_config[name]
local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos)
local infotext = string.sub(meta:get_string('infotext'), 1, -23)
local infotext = meta:get_string('info_working')
meta:set_string('infotext', infotext)
tasks.add_xp(pos, node, player, 'tasks:food_crate_apple_idle')
minetest.close_formspec(name, 'tasks:food_crate_apple')
end
elseif formname == 'tasks:food_crate_carrot'then
if fields.rotten then
local pos = tasks.player_config[name]
local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos)
local infotext = meta:get_string('info_working')
meta:set_string('infotext', infotext)
tasks.add_xp(pos, node, player, 'tasks:food_crate_carrot_idle')
minetest.close_formspec(name, 'tasks:food_crate_carrot')
end
end
end)

View File

@ -40,7 +40,7 @@ minetest.register_node('tasks:forcefield_gen_on',{
collision_box = on_box,
groups = {breakable = 1, tasks=1},
on_construct = function(pos)
tasks.on_construct(pos, 'Forcefield Generator')
tasks.on_construct(pos, 'Forcefield Generator', 'More like hole Generator')
end,
on_rightclick = function(pos, node, clicker)
tasks.right_click_on(pos, node, clicker, formspec_good)
@ -48,8 +48,8 @@ minetest.register_node('tasks:forcefield_gen_on',{
on_timer = function(pos)
local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos)
local infotext = meta:get_string('infotext')
meta:set_string('infotext', infotext..' (Needs repair!)')
local infotext = meta:get_string('info_repair')
meta:set_string('infotext', infotext)
minetest.swap_node(pos, {name = 'tasks:forcefield_gen_off', param2 = node.param2})
end,
})
@ -95,7 +95,7 @@ minetest.register_node('tasks:forcefield_gen_off',{
local min = meta:get_int('time_min') or 300
local max = meta:get_int('time_max') or 600
local random_number = math.random(min,max)
local infotext = string.sub(meta:get_string('infotext'), 1, -17)
local infotext = meta:get_string('info_working')
inv:set_stack('part', 1, '')
minetest.swap_node(pos, {name = 'tasks:forcefield_gen_on', param2 = node.param2})
minetest.close_formspec(name, 'tasks:part_req_form')

View File

@ -110,11 +110,13 @@ function tasks.right_click_off(pos, node, clicker, formspec)
end
end
function tasks.on_construct(pos, infotext)
function tasks.on_construct(pos, info_working, info_repair)
local meta = minetest.get_meta(pos)
local inv = meta:get_inventory()
inv:set_size('part', 1)
meta:set_string('infotext', infotext)
meta:set_string('infotext', info_working)
meta:set_string('info_working', info_working)
meta:set_string('info_repair', info_repair)
meta:set_int('time_min', 30)
meta:set_int('time_max', 90)
meta:set_int('xp', 5)
@ -157,3 +159,26 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
end
end
end)
minetest.register_lbm({ --This can be removed in a few months. 08/27/22
label = 'Tasks infotext update',
name = 'tasks:info_update',
run_at_every_load = false,
nodenames = {'group:tasks'},
action = function(pos, node)
local meta = minetest.get_meta(pos)
local info = meta:get_string('infotext')
local info_repair
local info_working
local i, j = string.find(info, "%(")
if i then
info_repair = info
info_working = string.sub(info, 1, (i-2))
else
info_working = info
info_repair = info..' (Needs Repair)'
end
meta:set_string('info_repair', info_repair)
meta:set_string('info_working', info_working)
end
})

View File

@ -1,6 +1,9 @@
--[[
Every tasks should be in it's own file. If there are multiple tasks that are all varients
of the same tasks it's okay to put them all the same file to allow for re-using local functions.
Node's with infotexts should have two varients;
info_repair : This is used when the task is available to complete.
info_working : This is used when the task is completed and is waiting to become available.
]]
tasks = {}

View File

@ -35,7 +35,7 @@ minetest.register_node('tasks:microscope',{
collision_box = box,
groups = {breakable = 1, tasks=1},
on_construct = function(pos)
tasks.on_construct(pos, 'Microscope')
tasks.on_construct(pos, 'Microscope', 'Microscope with Specimens')
end,
on_rightclick = function(pos, node, clicker)
local name = clicker:get_player_name()
@ -44,8 +44,6 @@ minetest.register_node('tasks:microscope',{
local meta = minetest.get_meta(pos)
local count = meta:get_int('count') or 0
local level = meta:get_int('level') or 0
print ('sabotage level is '..sabotage_level)
print ('node level is '..level)
if level < sabotage_level then
tasks.player_config[name] = pos
if count == 0 then

View File

@ -1,4 +1,4 @@
# Blender v2.93.5 OBJ File: 'tasks.blend'
# Blender v3.2.2 OBJ File: 'tasks.blend'
# www.blender.org
o Apple_Crate_Cube.001
v -0.500000 -0.500000 0.437500
@ -39,21 +39,22 @@ vt 0.468750 0.453125
vt 0.218750 0.453125
vt 0.234375 0.437500
vt 0.453125 0.437500
vt 0.000000 0.812500
vt 0.218750 0.812500
vt 0.218750 1.000000
vt 0.000000 1.000000
vt 0.445312 0.460938
vt 0.632812 0.460938
vt 0.632812 0.492188
vt 0.445312 0.492188
vt 0.851562 0.460938
vt 0.851562 0.492188
vt 0.000000 0.312500
vt 0.937500 0.312500
vt 0.937500 1.000000
vt 0.000000 1.000000
vn -1.0000 0.0000 0.0000
vn 0.0000 0.0000 -1.0000
vn 1.0000 0.0000 0.0000
vn 0.0000 0.0000 1.0000
vn 0.0000 1.0000 0.0000
g Apple_Crate_Cube.001_Food_Crate
s off
f 1/1/1 2/2/1 4/3/1 3/4/1
f 3/4/2 4/3/2 8/5/2 7/6/2
@ -64,7 +65,8 @@ f 12/15/1 11/16/1 15/17/1 16/18/1
f 8/19/5 4/20/5 10/21/5 11/22/5
f 6/12/5 8/19/5 11/22/5 12/13/5
f 4/20/5 2/11/5 9/14/5 10/21/5
f 15/23/5 14/24/5 13/25/5 16/26/5
f 10/27/3 9/28/3 13/29/3 14/30/3
f 9/28/2 12/31/2 16/32/2 13/29/2
f 11/16/4 10/27/4 14/30/4 15/17/4
f 10/23/3 9/24/3 13/25/3 14/26/3
f 9/24/2 12/27/2 16/28/2 13/25/2
f 11/16/4 10/23/4 14/26/4 15/17/4
g Apple_Crate_Cube.001_Food_Crate_Food
f 15/29/5 14/30/5 13/31/5 16/32/5

View File

@ -34,7 +34,7 @@ minetest.register_node('tasks:printing_press_on',{
collision_box = box,
groups = {breakable = 1, tasks=1},
on_construct = function(pos)
tasks.on_construct(pos, 'Printing Press')
tasks.on_construct(pos, 'Printing Press', 'Needs paper')
end,
on_rightclick = function(pos, node, clicker)
tasks.right_click_on(pos, node, clicker, formspec_good)
@ -42,8 +42,8 @@ minetest.register_node('tasks:printing_press_on',{
on_timer = function(pos)
local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos)
local infotext = meta:get_string('infotext')
meta:set_string('infotext', infotext..' (Needs paper!)')
local infotext = meta:get_string('info_repair')
meta:set_string('infotext', infotext)
minetest.swap_node(pos, {name = 'tasks:printing_press_off', param2 = node.param2})
end,
})
@ -83,7 +83,7 @@ minetest.register_node('tasks:printing_press_off',{
local min = meta:get_int('time_min') or 300
local max = meta:get_int('time_max') or 600
local random_number = math.random(min,max)
local infotext = string.sub(meta:get_string('infotext'), 1, -16)
local infotext = meta:get_string('info_working')
inv:set_stack('part', 1, '')
minetest.swap_node(pos, {name = 'tasks:printing_press_on', param2 = node.param2})
minetest.close_formspec(name, 'tasks:part_req_form')

View File

@ -33,7 +33,7 @@ minetest.register_node('tasks:radio_dish_on',{
collision_box = box,
groups = {breakable = 1, tasks=1},
on_construct = function(pos)
tasks.on_construct(pos, 'Satellite Dish')
tasks.on_construct(pos, 'Satellite Dish', 'Goofy Umbrella')
end,
on_rightclick = function(pos, node, clicker)
tasks.right_click_on(pos, node, clicker, formspec_good)
@ -41,8 +41,8 @@ minetest.register_node('tasks:radio_dish_on',{
on_timer = function(pos)
local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos)
local infotext = meta:get_string('infotext')
meta:set_string('infotext', infotext..' (Needs repair!)')
local infotext = meta:get_string('info_repair')
meta:set_string('infotext', infotext)
minetest.swap_node(pos, {name = 'tasks:radio_dish_off', param2 = node.param2})
end,
})
@ -82,7 +82,7 @@ minetest.register_node('tasks:radio_dish_off',{
local min = meta:get_int('time_min') or 300
local max = meta:get_int('time_max') or 600
local random_number = math.random(min,max)
local infotext = string.sub(meta:get_string('infotext'), 1, -17)
local infotext = meta:get_string('info_working')
inv:set_stack('part', 1, '')
minetest.swap_node(pos, {name = 'tasks:radio_dish_on', param2 = node.param2})
minetest.close_formspec(name, 'tasks:part_req_form')

View File

@ -33,7 +33,7 @@ minetest.register_node('tasks:smoke_detector_on',{
collision_box = box,
groups = {breakable = 1, tasks=1},
on_construct = function(pos)
tasks.on_construct(pos, 'Smoke Detector')
tasks.on_construct(pos, 'Smoke Detector', 'Wall Art?')
end,
on_rightclick = function(pos, node, clicker)
tasks.right_click_on(pos, node, clicker, formspec_good)
@ -41,8 +41,8 @@ minetest.register_node('tasks:smoke_detector_on',{
on_timer = function(pos)
local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos)
local infotext = meta:get_string('infotext')
meta:set_string('infotext', infotext..' (Needs repair!)')
local infotext = meta:get_string('info_repair')
meta:set_string('infotext', infotext)
minetest.swap_node(pos, {name = 'tasks:smoke_detector_off', param2 = node.param2})
minetest.sound_play('tasks_smoke_alarm_chirp', {pos = pos, gain = 2, max_hear_distance = 14})
end,
@ -83,7 +83,7 @@ minetest.register_node('tasks:smoke_detector_off',{
local min = meta:get_int('time_min') or 30
local max = meta:get_int('time_max') or 60
local random_number = math.random(min,max)
local infotext = string.sub(meta:get_string('infotext'), 1, -17)
local infotext = meta:get_string('info_working')
inv:set_stack('part', 1, '')
minetest.swap_node(pos, {name = 'tasks:smoke_detector_on'})
minetest.close_formspec(name, 'tasks:part_req_form')

Binary file not shown.

After

Width:  |  Height:  |  Size: 302 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 5.5 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 150 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 93 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 142 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.7 KiB

After

Width:  |  Height:  |  Size: 6.4 KiB

View File

@ -31,7 +31,7 @@ minetest.register_node('tasks:transformer_0_on',{
collision_box = col_box,
groups = {breakable = 1, tasks=1},
on_construct = function(pos)
tasks.on_construct(pos, 'Power Transformer')
tasks.on_construct(pos, 'Power Transformer', 'Laughably Large Paperweight')
end,
on_rightclick = function(pos, node, clicker)
tasks.right_click_on(pos, node, clicker, formspec_good)
@ -39,9 +39,9 @@ minetest.register_node('tasks:transformer_0_on',{
on_timer = function(pos)
local node = minetest.get_node(pos)
local meta = minetest.get_meta(pos)
local infotext = meta:get_string('infotext')
local infotext = meta:get_string('info_repair')
minetest.swap_node(pos, {name = 'tasks:transformer_0_off', param2 = node.param2})
meta:set_string('infotext', infotext..' (Needs repair!)')
meta:set_string('infotext', infotext)
end,
})
@ -79,7 +79,7 @@ minetest.register_node('tasks:transformer_0_off',{
local min = meta:get_int('time_min') or 30
local max = meta:get_int('time_max') or 60
local random_number = math.random(min,max)
local infotext = string.sub(meta:get_string('infotext'), 1, -17)
local infotext = meta:get_string('info_working')
inv:set_stack('part', 1, '')
minetest.swap_node(pos, {name = 'tasks:transformer_0_on', param2 = node.param2})
minetest.close_formspec(name, 'tasks:part_req_form')