1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-05-13 21:56:29 +02:00

more fixes

This commit is contained in:
Gerkiz 2021-06-06 20:35:04 +02:00
parent 3822005bd7
commit d39a8704a3
2 changed files with 12 additions and 7 deletions

View File

@ -211,6 +211,9 @@ local function insert_item_into_chest(player_inventory, chests, filtered_chests,
local try = 0
local to_insert = floor(count / #chests)
if to_insert <= 0 then
return
end
local variate = count % #chests
local chests_available = #chests
local tries = #chests

View File

@ -1100,19 +1100,21 @@ local function on_player_used_capsule(event)
rpg_t.mana = rpg_t.mana - object.mana_cost
elseif obj_name == 'pointy_explosives' then
local entities =
player.surface.find_entities_filtered {force = player.force, type = 'container', area = {{position.x - 5, position.y - 5}, {position.x + 5, position.y + 5}}}
player.surface.find_entities_filtered {force = player.force, type = 'container', area = {{position.x - 1, position.y - 1}, {position.x + 1, position.y + 1}}}
local detonate_chest
for i = 1, #entities do
local e = entities[i]
detonate_chest = e
end
local success = Explosives.detonate_chest(detonate_chest)
if success then
player.print(({'rpg_main.detonate_chest'}), Color.success)
rpg_t.mana = rpg_t.mana - object.mana_cost
else
player.print(({'rpg_main.detonate_chest_failed'}), Color.fail)
if detonate_chest and detonate_chest.valid then
local success = Explosives.detonate_chest(detonate_chest)
if success then
player.print(({'rpg_main.detonate_chest'}), Color.success)
rpg_t.mana = rpg_t.mana - object.mana_cost
else
player.print(({'rpg_main.detonate_chest_failed'}), Color.fail)
end
end
elseif obj_name == 'warp-gate' then
player.teleport(surface.find_non_colliding_position('character', game.forces.player.get_spawn_position(surface), 3, 0, 5), surface)