1
0
mirror of https://github.com/veden/Rampant.git synced 2024-12-26 20:54:12 +02:00

fixed item collectors

This commit is contained in:
Aaron Veden 2017-08-13 17:35:44 -07:00
parent 343cdfffd9
commit b6f4612ce9
9 changed files with 52 additions and 43 deletions

View File

@ -61,10 +61,17 @@ Configure Options not in game menu:
# Version History
0.15.21 -
- Fixed: Added check for nil'ed itemCollection event (https://forums.factorio.com/viewtopic.php?f=94&t=31445&start=200#p302631)
- Fixed: Item Collector deconstruction not pulling items before destroying chest
- Fixed: Force Item Collector chest to be only minable and deconstructable piece to force contents to be moved to player
- Improvement: Switched over to on_player_mined_entity and on_robot_mined_entity instead of the pre variants
0.15.20 -
- Fixed: Added Low Resolution version of overlay, ISSUE: range of collector extends past visual display because of 2048px limit on sprites
- Fixed: Added Low Resolution version of overlay, ISSUE: range of collector extends past visual display because of 2048px limit on sprites (https://forums.factorio.com/viewtopic.php?f=94&t=31445&start=180#p302128)
- Tweak: Increased item collector build time from 0.5 seconds to 10 seconds
- Improvement: Added an expensive recipe variant that doubles the cost of the item collector
- Improvement: Added an expensive recipe variant that doubles the cost of the item collector (https://forums.factorio.com/viewtopic.php?f=94&t=31445&start=180#p302123)
- Optimization: Tuned chunk scoring heuristic
0.15.19 -
- Fixed: Error when processing item collectors

View File

@ -170,10 +170,10 @@ function upgrade.attempt(natives, world)
game.surfaces[1].print("Rampant - Version 0.15.18")
global.version = constants.VERSION_28
end
if (global.version < constants.VERSION_30) then
if (global.version < constants.VERSION_31) then
game.surfaces[1].print("Rampant - Version 0.15.20")
global.version = constants.VERSION_30
game.surfaces[1].print("Rampant - Version 0.15.21")
global.version = constants.VERSION_31
end
return starting ~= global.version, natives, world
end

BIN
blender/suicideNest.blend Executable file

Binary file not shown.

BIN
blender/suicideNest.blend1 Executable file

Binary file not shown.

View File

@ -495,8 +495,8 @@ script.on_event(defines.events.on_player_quickbar_inventory_changed,
script.on_event(defines.events.on_biter_base_built,
onEnemyBaseBuild)
script.on_event({defines.events.on_preplayer_mined_item,
defines.events.on_robot_pre_mined},
script.on_event({defines.events.on_player_mined_entity,
defines.events.on_robot_mined_entity},
onMine)
script.on_event({defines.events.on_built_entity,
defines.events.on_robot_built_entity},

View File

@ -1,7 +1,7 @@
{
"name" : "Rampant",
"factorio_version" : "0.15",
"version" : "0.15.20",
"version" : "0.15.21",
"title" : "Rampant",
"author" : "Veden",
"homepage" : "https://forums.factorio.com/viewtopic.php?f=94&t=31445",

View File

@ -15,7 +15,7 @@ constants.VERSION_25 = 25
constants.VERSION_26 = 26
constants.VERSION_27 = 27
constants.VERSION_28 = 28
constants.VERSION_30 = 30
constants.VERSION_31 = 31
-- misc

View File

@ -30,43 +30,46 @@ function worldProcessor.processWorld(surface, world, tick)
count = count + 1
local itemCollectorPair = collectorLookup[collectors[index]]
collectors[index] = nil
local chest = itemCollectorPair[1]
local dish = itemCollectorPair[2]
if chest.valid and dish.valid then
if itemCollectorPair then
local chest = itemCollectorPair[1]
local dish = itemCollectorPair[2]
local collectorPosition = dish.position
if chest.valid and dish.valid then
topLeftPosition.x = collectorPosition.x - ITEM_COLLECTOR_DISTANCE
topLeftPosition.y = collectorPosition.y - ITEM_COLLECTOR_DISTANCE
local collectorPosition = dish.position
bottomRightPosition.x = collectorPosition.x + ITEM_COLLECTOR_DISTANCE
bottomRightPosition.y = collectorPosition.y + ITEM_COLLECTOR_DISTANCE
topLeftPosition.x = collectorPosition.x - ITEM_COLLECTOR_DISTANCE
topLeftPosition.y = collectorPosition.y - ITEM_COLLECTOR_DISTANCE
local items = surface.find_entities_filtered({area = boundingArea,
name = "item-on-ground"})
bottomRightPosition.x = collectorPosition.x + ITEM_COLLECTOR_DISTANCE
bottomRightPosition.y = collectorPosition.y + ITEM_COLLECTOR_DISTANCE
local counts = {}
if (#items > 0) then
for x=1,#items do
local item = items[x]
local itemName = item.stack.name
if not counts[itemName] then
counts[itemName] = {item}
else
counts[itemName][#counts[itemName]+1] = item
local items = surface.find_entities_filtered({area = boundingArea,
name = "item-on-ground"})
local counts = {}
if (#items > 0) then
for x=1,#items do
local item = items[x]
local itemName = item.stack.name
if not counts[itemName] then
counts[itemName] = {item}
else
counts[itemName][#counts[itemName]+1] = item
end
end
end
for k,a in pairs(counts) do
inserter.name = k
inserter.count = #a
local stored = chest.insert(inserter)
for i=1,stored do
a[i].destroy()
for k,a in pairs(counts) do
inserter.name = k
inserter.count = #a
local stored = chest.insert(inserter)
for i=1,stored do
a[i].destroy()
end
end
-- dish.surface.create_entity({name="item-collector-base-particle-rampant",
-- position=dish.position})
end
-- dish.surface.create_entity({name="item-collector-base-particle-rampant",
-- position=dish.position})
end
end
if (count >= ITEM_COLLECTOR_QUEUE_SIZE) then

View File

@ -10,6 +10,7 @@ radar.max_distance_of_nearby_sector_revealed = 1
radar.max_distance_of_sector_revealed = 0
radar.energy_per_nearby_scan = "27MJ"
radar.energy_usage = "450KW"
radar.flags[#radar.flags+1] = "not-deconstructable"
radar.pictures = {
filename = "__Rampant__/graphics/entities/chest/itemCollector.png",
priority = "low",
@ -20,8 +21,7 @@ radar.pictures = {
line_length = 8,
shift = {0.1875, -0.24}
}
radar.minable = { result = "item-collector-base-rampant",
mining_time = 1 }
radar.minable = nil
-- local particle = {
-- type = "explosion",
@ -91,7 +91,6 @@ chest.picture = {
}
chest.selection_box = {{-0.485, -0.1}, {0.465, 0.6}}
chest.collision_mask = {}
chest.flags[#chest.flags+1] = "not-deconstructable"
chest.minable.result = "item-collector-base-rampant"