1
0
mirror of https://github.com/ComfyFactory/ComfyFactorio.git synced 2025-01-18 03:21:36 +02:00

fixes and things

This commit is contained in:
MewMew 2020-03-10 13:25:42 +01:00
parent 93b9894116
commit 5643582e84
3 changed files with 23 additions and 18 deletions

View File

@ -761,10 +761,6 @@ local function on_player_joined_game(event)
surface.min_brightness = 0.3
surface.brightness_visual_weights = {1, 1, 1}
global.explosion_cells_destructible_tiles = {
["out-of-map"] = 2500,
}
game.forces["player"].technologies["landfill"].enabled = false
game.forces["player"].technologies["night-vision-equipment"].enabled = false
game.forces["player"].technologies["artillery-shell-range-1"].enabled = false
@ -988,7 +984,7 @@ local function on_tick(event)
end
end
if game.tick % 900 == 0 then
if game.tick % 300 == 0 then
refresh_gui()
end
end
@ -1187,12 +1183,14 @@ local function on_player_mined_entity(event)
end
local function biters_chew_rocks_slower(event)
if event.entity.force.index ~= 3 then return end --Neutral Force
local entity = event.entity
if not entity.valid then return end
if entity.force.index ~= 3 then return end --Neutral Force
if not event.cause then return end
if not event.cause.valid then return end
if event.cause.force.index ~= 2 then return end --Enemy Force
if math_random(1, 8) == 1 then return end
event.entity.health = event.entity.health + event.final_damage_amount
entity.health = entity.health + event.final_damage_amount
end
local function on_entity_damaged(event)
@ -1312,6 +1310,10 @@ local function on_init()
global.rocks_yield_ore_maximum_amount = 250
global.rocks_yield_ore_base_amount = 35
global.rocks_yield_ore_distance_modifier = 0.1
global.explosion_cells_destructible_tiles = {
["out-of-map"] = 1000,
}
end
local Event = require 'utils.event'

View File

@ -4,6 +4,14 @@
local math_floor = math.floor
local print_color = {r = 120, g = 255, b = 0}
local ore_names = {
["coal"] = true,
["stone"] = true,
["iron-ore"] = true,
["copper-ore"] = true,
["uranium-ore"] = true
}
local function create_floaty_text(surface, position, name, count, height_offset)
if global.autostash_floating_text_y_offsets[position.x .. "_" .. position.y] then
global.autostash_floating_text_y_offsets[position.x .. "_" .. position.y] = global.autostash_floating_text_y_offsets[position.x .. "_" .. position.y] - 0.5
@ -228,19 +236,11 @@ local function auto_stash(player, event)
hotbar_items[prototype.name] = true
end
end
local ore_types = {
["coal"] = true,
["stone"] = true,
["iron-ore"] = true,
["copper-ore"] = true,
["uranium-ore"] = true
}
for name, count in pairs(inventory.get_contents()) do
if not inventory.find_item_stack(name).grid and not hotbar_items[name] then
if button == defines.mouse_button_type.right then
if ore_types[name] then
if game.entity_prototypes[name] and game.entity_prototypes[name].type == "resource" or ore_names[name] then
insert_item_into_chest(inventory, chests, filtered_chests, name, count)
end
elseif button == defines.mouse_button_type.left then

View File

@ -108,6 +108,7 @@ local function on_player_mined_entity(event)
count = math_floor(count * (1 + player.force.mining_drill_productivity_bonus))
global.rocks_yield_ore["ores_mined"] = global.rocks_yield_ore["ores_mined"] + count
global.rocks_yield_ore["rocks_broken"] = global.rocks_yield_ore["rocks_broken"] + 1
local position = {x = entity.position.x, y = entity.position.y}
@ -171,7 +172,9 @@ local function on_entity_died(event)
local count = math_random(1,3)
global.rocks_yield_ore["ores_mined"] = global.rocks_yield_ore["ores_mined"] + count
surface.spill_item_stack(pos,{name = "stone", count = math_random(1,3)}, true)
surface.spill_item_stack(pos,{name = "stone", count = math_random(1,3)}, true)
global.rocks_yield_ore["rocks_broken"] = global.rocks_yield_ore["rocks_broken"] + 1
end
local function on_init()