Traitor/mods/sabotage/formspecs.lua

62 lines
3.3 KiB
Lua

function sabotage.traitor_formspec(pos)
local meta = minetest.get_meta(pos)
local timer = meta:get_int('timer') or 0
local chance = meta:get_int('chance') or 1
local damage = meta:get_int('damage') or 1
local formspec =
'formspec_version[3]'..
'size[10,8]'..
'textarea[.5,.5;9,6;;;Sabotage the crew, and risk life and limb. '..
'If the crew doesn\'t fix it in time you win, but you could die sabotaging.\n'..
'If you fail in sabotaging you could take up '..damage..' damage. '..
'If the Failure Timer is greater than 30 you will win or loose depending on if the crew \'repairs\' the node.'..
'If they repair the node in time they win, but if they don\'t you win!'..
'\n\nRisk Factor: '..chance..'/10 \nPotential Health Impact: '..damage..' \nFailure Timer: '..timer..' seconds]'..
'button_exit[3.5,7;3,.75;sabotage;Do It]'
return formspec
end
function sabotage.builder_formspec(pos)
local meta = minetest.get_meta(pos)
local timer = meta:get_int('timer') or 120
local chance = meta:get_int('chance') or 1
local damage = meta:get_int('damage') or 1
local alert = meta:get_string('alert') or ''
local level = meta:get_int('level') or 0
local formspec =
'formspec_version[3]'..
'size[16,9]'..
'textarea[1,1;14,3.5;;;Sabotaging is a risky business, the traitor can fail and take damage. '..
'Chance is the probability of failure when attempting to sabotage. (1-10 Traitor\'s luck level comes in play here.)\n'..
'Damage is the MAX amount of damage the traitor will incur. Keep in mind the default health level is 20.\n'..
'Timer is the amount of time the crew is given to \'repair\' the sabotaged node. Must be over 30 seconds. '..
'Set below 30 seconds to not use a timer. Effect will last until crew repairs it.\n'..
'Alert text will be sent to all players on the level, '..
'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.]'..
'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..']'..
'field[8.66,6.5;2.5,.75;timer_input;Timer:;'..timer..']'..
'field[12.5,6.5;2.5,.75;level;Sabotage level:;'..level..']'..
'button_exit[6.5,7.5;3,1;save;Save]'
return formspec
end
function sabotage.player_formspec(pos)
local meta = minetest.get_meta(pos)
local chance = meta:get_int('chance') or 1
local damage = meta:get_int('damage') or 1
local formspec =
'formspec_version[3]'..
'size[10,8]'..
'textarea[.5,.5;9,6;;;Careful now, you could get hurt messing around here, '..
'but you could save the lives of the entire party. Ultimately it\'s your choice.\n'..
'\nRisk Factor: '..chance..'/10 \nPotential Health Impact: '..damage..']'..
'button_exit[1.5,7;3,.75;repair;Attempt Repairs]'..
'button_exit[5.5,7;3,.75;leave;Cower in Fear]'
return formspec
end