1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-24 03:47:58 +02:00

Merge pull request #255 from ComfyFactory/fixes

rpg and autostash fixes
This commit is contained in:
Gerkiz 2022-04-23 17:11:19 +02:00 committed by GitHub
commit 67988c9ad4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 12 additions and 2 deletions

View File

@ -232,6 +232,9 @@ local function insert_to_furnace(player_inventory, chests, name, count, floaty_t
if valid_to_insert then
if chest_inventory.can_insert({name = name, count = amount}) then
local inserted_count = chest_inventory.insert({name = name, count = amount})
if inserted_count < 0 then
return
end
player_inventory.remove({name = name, count = inserted_count})
prepare_floaty_text(floaty_text_list, chest.surface, chest.position, name, inserted_count)
count = count - inserted_count
@ -251,6 +254,9 @@ local function insert_to_furnace(player_inventory, chests, name, count, floaty_t
else
if chest_inventory.can_insert({name = name, count = amount}) then
local inserted_count = chest_inventory.insert({name = name, count = amount})
if inserted_count < 0 then
return
end
player_inventory.remove({name = name, count = inserted_count})
prepare_floaty_text(floaty_text_list, chest.surface, chest.position, name, inserted_count)
count = count - inserted_count
@ -279,6 +285,9 @@ local function insert_to_furnace(player_inventory, chests, name, count, floaty_t
local chest_inventory = chest.get_inventory(defines.inventory.chest)
if chest_inventory and chest_inventory.can_insert({name = name, count = amount}) then
local inserted_count = chest_inventory.insert({name = name, count = amount})
if inserted_count < 0 then
return
end
player_inventory.remove({name = name, count = inserted_count})
prepare_floaty_text(floaty_text_list, chest.surface, chest.position, name, inserted_count)
count = count - inserted_count

View File

@ -128,6 +128,7 @@ local function create_projectiles(data)
local force = data.force
local target_pos = data.target_pos
local range = data.range
local projectile_types = Public.projectile_types
if self.aoe then
for _ = 1, self.amount do
@ -139,7 +140,7 @@ local function create_projectiles(data)
left_top = {x = position.x - 2, y = position.y - 2},
right_bottom = {x = position.x + 2, y = position.y + 2}
}
do_projectile(surface, self.entityName, position, force, target_pos, range)
do_projectile(surface, projectile_types[self.entityName].name, position, force, target_pos, range)
Public.remove_mana(player, self.mana_cost)
if self.damage then
for _, e in pairs(surface.find_entities_filtered({area = damage_area})) do
@ -152,7 +153,7 @@ local function create_projectiles(data)
left_top = {x = position.x - 2, y = position.y - 2},
right_bottom = {x = position.x + 2, y = position.y + 2}
}
do_projectile(surface, self.entityName, position, force, target_pos, range)
do_projectile(surface, projectile_types[self.entityName].name, position, force, target_pos, range)
Public.remove_mana(player, self.mana_cost)
if self.damage then