Fixed jewelry station.
parent
fdbd1b052f
commit
ccff10b733
|
@ -230,13 +230,6 @@ armor.set_player_armor = function(self, player)
|
|||
for _, phys in pairs(self.physics) do
|
||||
local value = def.groups["physics_"..phys] or 0
|
||||
physics[phys] = physics[phys] + value
|
||||
if def.groups['physics_gravity'] then
|
||||
local pos = player:get_pos()
|
||||
local altitude = pos.y
|
||||
if altitude > 5000 and altitude < 7500 then
|
||||
physics['gravity'] = physics['gravity'] - .2
|
||||
end
|
||||
end
|
||||
end
|
||||
for _, attr in pairs(self.attributes) do
|
||||
local value = def.groups["armor_"..attr] or 0
|
||||
|
@ -271,7 +264,12 @@ armor.set_player_armor = function(self, player)
|
|||
local mult = attr == "heal" and self.config.heal_multiplier or 1
|
||||
self.def[name][attr] = attributes[attr] * mult
|
||||
end
|
||||
local pos = player:get_pos()
|
||||
local altitude = pos.y
|
||||
for _, phys in pairs(self.physics) do
|
||||
if altitude > 5000 and altitude < 7500 then
|
||||
physics['gravity'] = physics['gravity'] - .2
|
||||
end
|
||||
self.def[name][phys] = physics[phys]
|
||||
end
|
||||
if use_armor_monoid then
|
||||
|
|
|
@ -3,6 +3,7 @@ local news = {
|
|||
'Armor in space should work properly now!!!',
|
||||
'Added ring and amulet recipes to show how to make the items with perks.',
|
||||
'All armors are displayed in spawn.',
|
||||
'Added Nether Basalt Brick, and stairs.',
|
||||
'',
|
||||
'10/7/20',
|
||||
'Lifeforce potions can be put in vessel shevles.',
|
||||
|
|
|
@ -14,7 +14,7 @@ local jewelry_formspec =
|
|||
'Input a plain ring, amulet or pair of gloves, and a Gemstone with the perk you want added.'..
|
||||
'\nYou\'ll also need a mese crystal and lava orb.'..
|
||||
'\nRelics can be added to tweak the chances that control how powerful the outputted item will be.'..
|
||||
' Relics are not consumed and can be used time and time again.]'..
|
||||
' Relics are not typically consumed and can be used time and time again.]'..
|
||||
'label[0,3;Relics\n--->]'
|
||||
|
||||
minetest.register_node('stations:jewelry', {
|
||||
|
@ -73,26 +73,26 @@ minetest.register_node('stations:jewelry', {
|
|||
if listname == 'jewelry' then
|
||||
if input == 'armor:ring_gol' or input == 'armor:ring_tit' --[[or input == 'armor:gloves']]
|
||||
or input == 'armor:amulet_gol' or input == 'armor:amulet_tit' then
|
||||
return 1
|
||||
return 99
|
||||
else
|
||||
return 0
|
||||
end
|
||||
elseif listname == 'mese' then
|
||||
if input == 'default:mese_crystal' then
|
||||
return 1
|
||||
return 99
|
||||
else
|
||||
return 0
|
||||
end
|
||||
elseif listname == 'orb' then
|
||||
if input == 'mobs:lava_orb' then
|
||||
return 1
|
||||
return 99
|
||||
else
|
||||
return 0
|
||||
end
|
||||
elseif listname == 'crystal' then
|
||||
if input == 'epic:float_crystal' or input == 'epic:bloodstone' or input == 'epic:huntite'
|
||||
or input == 'ocean:prismarine_crystals' or input == 'epic:garnet' or input == 'quartz:quartz_crystal_piece' then
|
||||
return 1
|
||||
return 99
|
||||
else
|
||||
return 0
|
||||
end
|
||||
|
@ -117,18 +117,18 @@ minetest.register_node('stations:jewelry', {
|
|||
on_receive_fields = function(pos, formname, fields, sender)
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory(pos)
|
||||
if fields['forge'] then
|
||||
local output = inv:get_stack('output', 1)
|
||||
local output_count = output:get_count()
|
||||
if fields['forge'] and output_count == 0 then
|
||||
local jewelry = inv:get_stack('jewelry', 1)
|
||||
local mese = inv:get_stack('mese', 1)
|
||||
local orb = inv:get_stack('orb', 1)
|
||||
local crystal = inv:get_stack('crystal', 1)
|
||||
local relics = inv:get_list('relics')
|
||||
local jewelry_name = jewelry:get_name()
|
||||
local mese_name = mese:get_name()
|
||||
local orb_name = orb:get_name()
|
||||
local crystal_name = crystal:get_name()
|
||||
local jewelry_count = jewelry:get_count()
|
||||
local mese_count = mese:get_count()
|
||||
local orb_count = orb:get_count()
|
||||
local inputs = (jewelry_count + mese_count + orb_count)
|
||||
local perk = 'nothing'
|
||||
if crystal_name == 'epic:float_crystal' then
|
||||
perk = 'gravity'
|
||||
|
@ -176,17 +176,28 @@ minetest.register_node('stations:jewelry', {
|
|||
if phase == 4 and (time_of_day < .2 or time_of_day > .8) then
|
||||
tier = tier + 1
|
||||
end
|
||||
if perk ~= 'nothing' and inputs == 3 and tier ~= 0 then
|
||||
inv:set_stack('jewelry', 1, '')
|
||||
inv:set_stack('mese', 1, '')
|
||||
inv:set_stack('orb', 1, '')
|
||||
inv:set_stack('crystal', 1, '')
|
||||
if perk ~= 'nothing' and jewelry_name ~= '' and mese_name ~= '' and orb_name ~= '' and tier ~= 0 then
|
||||
jewelry:take_item(1)
|
||||
mese:take_item(1)
|
||||
orb:take_item(1)
|
||||
crystal:take_item(1)
|
||||
inv:set_stack('jewelry', 1, jewelry)
|
||||
inv:set_stack('mese', 1, mese)
|
||||
inv:set_stack('orb', 1, orb)
|
||||
inv:set_stack('crystal', 1, crystal)
|
||||
inv:set_stack('output', 1, jewelry_name..'_'..perk..'_'..tier)
|
||||
minetest.chat_send_all('hello')
|
||||
minetest.log("action", sender:get_player_name() .. " crafts "..jewelry_name..'_'..perk..'_'..tier)
|
||||
else
|
||||
inv:set_stack('jewelry', 1, '')
|
||||
inv:set_stack('mese', 1, '')
|
||||
inv:set_stack('orb', 1, '')
|
||||
inv:set_stack('crystal', 1, '')
|
||||
jewelry:take_item(1)
|
||||
mese:take_item(1)
|
||||
orb:take_item(1)
|
||||
crystal:take_item(1)
|
||||
inv:set_stack('jewelry', 1, jewelry)
|
||||
inv:set_stack('mese', 1, mese)
|
||||
inv:set_stack('orb', 1, orb)
|
||||
inv:set_stack('crystal', 1, crystal)
|
||||
minetest.chat_send_all('hi')
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
@ -251,26 +262,26 @@ minetest.register_node('stations:jewelry_locked', {
|
|||
if listname == 'jewelry' then
|
||||
if input == 'armor:ring_gol' or input == 'armor:ring_tit' --[[or input == 'armor:gloves']]
|
||||
or input == 'armor:amulet_gol' or input == 'armor:amulet_tit' then
|
||||
return 1
|
||||
return 99
|
||||
else
|
||||
return 0
|
||||
end
|
||||
elseif listname == 'mese' then
|
||||
if input == 'default:mese_crystal' then
|
||||
return 1
|
||||
return 99
|
||||
else
|
||||
return 0
|
||||
end
|
||||
elseif listname == 'orb' then
|
||||
if input == 'mobs:lava_orb' then
|
||||
return 1
|
||||
return 99
|
||||
else
|
||||
return 0
|
||||
end
|
||||
elseif listname == 'crystal' then
|
||||
if input == 'epic:float_crystal' or input == 'epic:bloodstone' or input == 'epic:huntite'
|
||||
or input == 'ocean:prismarine_crystals' or input == 'epic:garnet' or input == 'quartz:quartz_crystal_piece' then
|
||||
return 1
|
||||
return 99
|
||||
else
|
||||
return 0
|
||||
end
|
||||
|
@ -293,83 +304,89 @@ minetest.register_node('stations:jewelry_locked', {
|
|||
end
|
||||
end,
|
||||
on_receive_fields = function(pos, formname, fields, sender)
|
||||
local player_name = sender:get_player_name()
|
||||
if minetest.is_protected(pos, player_name) and not minetest.check_player_privs(player, 'protection_bypass') then
|
||||
minetest.chat_send_player(sender, 'You don\'t have access to this station.')
|
||||
else
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory(pos)
|
||||
if fields['forge'] then
|
||||
local jewelry = inv:get_stack('jewelry', 1)
|
||||
local mese = inv:get_stack('mese', 1)
|
||||
local orb = inv:get_stack('orb', 1)
|
||||
local crystal = inv:get_stack('crystal', 1)
|
||||
local relics = inv:get_list('relics')
|
||||
local jewelry_name = jewelry:get_name()
|
||||
local crystal_name = crystal:get_name()
|
||||
local jewelry_count = jewelry:get_count()
|
||||
local mese_count = mese:get_count()
|
||||
local orb_count = orb:get_count()
|
||||
local inputs = (jewelry_count + mese_count + orb_count)
|
||||
local perk = 'nothing'
|
||||
if crystal_name == 'epic:float_crystal' then
|
||||
perk = 'gravity'
|
||||
elseif crystal_name == 'epic:bloodstone' then
|
||||
perk = 'healing'
|
||||
elseif crystal_name == 'epic:huntite' then
|
||||
perk = 'fire'
|
||||
elseif crystal_name == 'ocean:prismarine_crystals' then
|
||||
perk = 'water'
|
||||
elseif crystal_name == 'epic:garnet' then
|
||||
perk = 'speed'
|
||||
elseif crystal_name == 'quartz:quartz_crystal_piece' then
|
||||
perk = 'jump'
|
||||
end
|
||||
local level = 0
|
||||
if type(relics) == 'table' then
|
||||
for i, stack in pairs(relics) do
|
||||
local def = stack:get_definition()
|
||||
if def.groups['relic_general'] then
|
||||
level = level + def.groups['relic_general']
|
||||
end
|
||||
if def.groups['relic_'..perk] then
|
||||
level = level + def.groups['relic_'..perk]
|
||||
end
|
||||
local meta = minetest.get_meta(pos)
|
||||
local inv = meta:get_inventory(pos)
|
||||
local output = inv:get_stack('output', 1)
|
||||
local output_count = output:get_count()
|
||||
if fields['forge'] and output_count == 0 then
|
||||
local jewelry = inv:get_stack('jewelry', 1)
|
||||
local mese = inv:get_stack('mese', 1)
|
||||
local orb = inv:get_stack('orb', 1)
|
||||
local crystal = inv:get_stack('crystal', 1)
|
||||
local relics = inv:get_list('relics')
|
||||
local jewelry_name = jewelry:get_name()
|
||||
local mese_name = mese:get_name()
|
||||
local orb_name = orb:get_name()
|
||||
local crystal_name = crystal:get_name()
|
||||
local perk = 'nothing'
|
||||
if crystal_name == 'epic:float_crystal' then
|
||||
perk = 'gravity'
|
||||
elseif crystal_name == 'epic:bloodstone' then
|
||||
perk = 'healing'
|
||||
elseif crystal_name == 'epic:huntite' then
|
||||
perk = 'fire'
|
||||
elseif crystal_name == 'ocean:prismarine_crystals' then
|
||||
perk = 'water'
|
||||
elseif crystal_name == 'epic:garnet' then
|
||||
perk = 'speed'
|
||||
elseif crystal_name == 'quartz:quartz_crystal_piece' then
|
||||
perk = 'jump'
|
||||
end
|
||||
local level = 0
|
||||
if type(relics) == 'table' then
|
||||
for i, stack in pairs(relics) do
|
||||
local def = stack:get_definition()
|
||||
if def.groups['relic_general'] then
|
||||
level = level + def.groups['relic_general']
|
||||
end
|
||||
if def.groups['relic_'..perk] then
|
||||
level = level + def.groups['relic_'..perk]
|
||||
end
|
||||
end
|
||||
--If you're looking at the code to see how this works please don't spoil it for other players.
|
||||
--If I expect that is going on, I'll be forced to change things around, and not release the code.
|
||||
local random = math.random(0, 100)
|
||||
local chance = random + level
|
||||
local tier = 1
|
||||
if chance < 0 then
|
||||
tier = 0
|
||||
elseif chance > 0 and chance <= 80 then
|
||||
tier = 1
|
||||
elseif chance > 80 and chance <= 90 then
|
||||
tier = 2
|
||||
elseif chance > 90 and chance <= 98 then
|
||||
tier = 3
|
||||
elseif chance > 98 and chance <= 100 then
|
||||
tier = 4
|
||||
end
|
||||
local phase = moon_phases.get_phase()
|
||||
local time_of_day = minetest.get_timeofday()
|
||||
if phase == 4 and (time_of_day < .2 or time_of_day > .8) then
|
||||
tier = tier + 1
|
||||
end
|
||||
if perk ~= 'nothing' and inputs == 3 and tier ~= 0 then
|
||||
inv:set_stack('jewelry', 1, '')
|
||||
inv:set_stack('mese', 1, '')
|
||||
inv:set_stack('orb', 1, '')
|
||||
inv:set_stack('crystal', 1, '')
|
||||
inv:set_stack('output', 1, jewelry_name..'_'..perk..'_'..tier)
|
||||
else
|
||||
inv:set_stack('jewelry', 1, '')
|
||||
inv:set_stack('mese', 1, '')
|
||||
inv:set_stack('orb', 1, '')
|
||||
inv:set_stack('crystal', 1, '')
|
||||
end
|
||||
end
|
||||
--If you're looking at the code to see how this works please don't spoil it for other players.
|
||||
--If I expect that is going on, I'll be forced to change things around, and not release the code.
|
||||
local random = math.random(0, 100)
|
||||
local chance = random + level
|
||||
local tier = 1
|
||||
if chance < 0 then
|
||||
tier = 0
|
||||
elseif chance > 0 and chance <= 80 then
|
||||
tier = 1
|
||||
elseif chance > 80 and chance <= 90 then
|
||||
tier = 2
|
||||
elseif chance > 90 and chance <= 98 then
|
||||
tier = 3
|
||||
elseif chance > 98 and chance <= 100 then
|
||||
tier = 4
|
||||
end
|
||||
local phase = moon_phases.get_phase()
|
||||
local time_of_day = minetest.get_timeofday()
|
||||
if phase == 4 and (time_of_day < .2 or time_of_day > .8) then
|
||||
tier = tier + 1
|
||||
end
|
||||
if perk ~= 'nothing' and jewelry_name ~= '' and mese_name ~= '' and orb_name ~= '' and tier ~= 0 then
|
||||
jewelry:take_item(1)
|
||||
mese:take_item(1)
|
||||
orb:take_item(1)
|
||||
crystal:take_item(1)
|
||||
inv:set_stack('jewelry', 1, jewelry)
|
||||
inv:set_stack('mese', 1, mese)
|
||||
inv:set_stack('orb', 1, orb)
|
||||
inv:set_stack('crystal', 1, crystal)
|
||||
inv:set_stack('output', 1, jewelry_name..'_'..perk..'_'..tier)
|
||||
minetest.chat_send_all('hello')
|
||||
minetest.log("action", sender:get_player_name() .. " crafts "..jewelry_name..'_'..perk..'_'..tier)
|
||||
else
|
||||
jewelry:take_item(1)
|
||||
mese:take_item(1)
|
||||
orb:take_item(1)
|
||||
crystal:take_item(1)
|
||||
inv:set_stack('jewelry', 1, jewelry)
|
||||
inv:set_stack('mese', 1, mese)
|
||||
inv:set_stack('orb', 1, orb)
|
||||
inv:set_stack('crystal', 1, crystal)
|
||||
minetest.chat_send_all('hi')
|
||||
end
|
||||
end
|
||||
end,
|
||||
|
|
Loading…
Reference in New Issue