1
0
mirror of https://github.com/Refactorio/RedMew.git synced 2025-03-05 15:05:57 +02:00

Fixed lua checks

This commit is contained in:
Jayefuu 2020-11-19 21:25:56 +00:00
parent e33ba4462f
commit 5e78cb52d2

View File

@ -206,7 +206,6 @@ local spawn_poison_callback = Token.register(function(data)
end)
local function strike(args, player)
local player_name = player.name
local s = player.surface
local location_string = args.location
local coords = {}
@ -237,7 +236,7 @@ local function strike(args, player)
-- Check the chest is still there. Better than making destructible and mineable false because then players can upgrade the chest
local entities = s.find_entities_filtered {position = {-0.5, -3.5}, type = 'container', limit=1}
dropbox = entities[1]
local dropbox = entities[1]
if dropbox == nil then
player.print("Someone removed the chest. Replace it here: [gps=-0.5,-3.5,redmew] ")
return
@ -245,7 +244,7 @@ local function strike(args, player)
-- Check the contents of the chest by spawn for enough poison capsules to use as payment
local inv = dropbox.get_inventory(defines.inventory.chest)
capCount = inv.get_item_count("poison-capsule")
local capCount = inv.get_item_count("poison-capsule")
if capCount < strikeCost then
player.print("To send an air strike, load " .. strikeCost - capCount .. " more poison capsules into the payment chest [gps=-0.5,-3.5,redmew]")
@ -264,7 +263,6 @@ local function strike(args, player)
end
end
return
end
inv.remove({name = "poison-capsule", count = strikeCost})
@ -312,8 +310,6 @@ Event.add(Retailer.events.on_market_purchase, function(event)
item.price = math.floor(math.exp(airstrike_data.count_level^0.8)/2)*1000
item.description = {'command_description.crash_site_airstrike_count', (count_level + 1), count_level, count, strikeCost}
Retailer.set_item(market_id, item) -- this updates the retailer with the new item values.
local toast_message = player.name .. "has upgraded airstrike damage to level " .. airstrike_data.count_level
Toast.toast_all_players(2, "test")
elseif name == 'airstrike_radius' then
airstrike_data.radius_level = airstrike_data.radius_level + 1
Toast.toast_all_players(2, "Airstrike radius has been upgraded to level " .. radius_level)
@ -321,8 +317,6 @@ Event.add(Retailer.events.on_market_purchase, function(event)
item.description = {'command_description.crash_site_airstrike_radius', (radius_level + 1), radius_level, radius}
item.price = math.floor(math.exp(airstrike_data.radius_level^0.8)/2)*1000
Retailer.set_item(market_id, item) -- this updates the retailer with the new item values.
local toast_message = player.name .. " has upgraded airstrike radius to level " .. airstrike_data.radius_level
Toast.toast_all_players(2, "test")
end
end)