diff --git a/c-inv_0.0.2/config.lua b/c-inv_0.0.2/config.lua new file mode 100644 index 00000000..9fa3b4b1 --- /dev/null +++ b/c-inv_0.0.2/config.lua @@ -0,0 +1,11 @@ +--the chest that a player put things in +INPUT_CHEST_NAME = "put-chest" +INPUT_CHEST_PICTURE_PATH = nil +INPUT_CHEST_ICON_PATH = nil +INPUT_CHEST_FILE = "intput-items.txt" + +--the chest that the player get things from +OUTPUT_CHEST_NAME = "get-chest" +OUTPUT_CHEST_PICTURE_PATH = nil +OUTPUT_CHEST_ICON_PATH = nil +OUTPUT_CHEST_FILE = "output-items.txt" \ No newline at end of file diff --git a/c-inv_0.0.2/control.lua b/c-inv_0.0.2/control.lua index 1b7a9046..b8c46c67 100644 --- a/c-inv_0.0.2/control.lua +++ b/c-inv_0.0.2/control.lua @@ -1,236 +1,142 @@ -script.on_init(function() - if global.timer == nil then - global.timer = 0 - end - if global.guitimer == nil then - global.guitimer = 0 - end - global.spentItems = {} - global.items = {} - global.items["iron-plate"] = 100 -end) --- GUI functions ---[[ -/c game.player.gui.left.clusterio.destroy() -game.player.gui.left.add{type="frame", name="clusterio", caption="Clusterio"} -game.player.gui.left.clusterio.add{type="label", name="clusterioInputLabel", caption="Iron plates: "} -game.player.gui.left.clusterio.add{type="textfield", name="clusterioInput"} -game.player.gui.left.clusterio.add{type="button", name="clusterioButtonSave", caption="Save"} -game.player.gui.left.clusterio.style.maximal_height=10 -]]-- -global.items = {} --- request items -script.on_event(defines.events.on_tick, function(event) - if global.guitimer > 1800 then - global.guitimer = 0 - -- request spentItems * 2 - items left - for k, v in pairs(spentItems) do - _print(k, v, " | ", (v * 2) - items[k]) - game.write_file("order.txt", k .. " " .. (v * 2) - items[k] .. "\n", true) - global.spentItems[k] = 0 - end - - else - global.guitimer = global.guitimer + 1 - end -end) -remote.add_interface("clusterio", { - hello = function() game.player.print("Hi!") end, - import = function(name, value) - _print(name) - _print(value) - if(type(name) == "string" and type(tonumber(value)) == "number") then - if(global.items == nil) then global.items = {} end - global.items[name] = tonumber(value); +require("config") + +function HashPosition(position) + return 40000 * (position.y) + position.x +end + +function OnBuiltEntity(event) + local entity = event.created_entity + --only add entities that are not ghosts + if entity.type ~= "entity-ghost" then + if entity.name == INPUT_CHEST_NAME then + --if the table hasn't been initialized then do it + global.inputChests = global.inputChests or {} + --add the chests to a lists if these chests so they can be interated over + global.inputChests[HashPosition(entity.position)] = entity + elseif entity.name == OUTPUT_CHEST_NAME then + --if the table hasn't been initialized then do it + global.outputChests = global.outputChests or {} + --add the chests to a lists if these chests so they can be interated over + global.outputChests[HashPosition(entity.position)] = entity end end -}) -script.on_load(function() - if global.timer == nil then - global.timer = 0 +end + +function OnKilledEntity(event) + local entity = event.entity + if entity.type ~= "entity-ghost" then + --remove the entities from the tables as they are dead + if entity.name == INPUT_CHEST_NAME then + global.inputChests[HashPosition(entity.position)] = nil + elseif entity.name == OUTPUT_CHEST_NAME then + global.outputChests[HashPosition(entity.position)] = nil + end end - if global.guitimer == nil then - global.guitimer = 0 - end - if global.spentItems == nil then - global.spentItems = {} - end - global.items = {} -end) -script.on_event(defines.events.on_tick, function(event) - if global.timer > 9 then - global.timer = 0 - voidChests() - else - global.timer = global.timer + 1 - end -end) +end + + + +--[[ Thing Creation Events ]]-- script.on_event(defines.events.on_built_entity, function(event) - if event.created_entity.name == "c-inv_voidChest" then - if global.voidChests == nil then global.voidChests = {} end - table.insert(global.voidChests, event.created_entity) - end + OnBuiltEntity(event) +end) +script.on_event(defines.events.on_robot_built_entity, function(event) + OnBuiltEntity(event) end) -function voidChests() - if global.voidChests ~= nil then - for i = 1, #global.voidChests do - if global.voidChests[i].valid then - local chest = global.voidChests[i].get_inventory(1) - if global.voidChests[i].get_inventory(defines.inventory.chest).get_contents() ~= nil then - for k,v in pairs(global.voidChests[i].get_inventory(defines.inventory.chest).get_contents()) do - -- WTF, string conectation in lua is done with .. instead of +? - game.write_file("output.txt", k .. " " .. v .. "\n", true) - end - end - global.voidChests[i].clear_items_inside() - else - table.remove(global.voidChests, i) - break - end - end - end -end - --- spawn belts - -local belts -local spawn_item = "iron-ore" -local chest_detection_rate = 50 -remote.add_interface("spawnbelt", { - setitem = function(item) - global.spawn_item = item; - spawn_item = global.spawn_item; - end -}) - -script.on_load(function(event) - if global.belts ~= nil then - belts = global.belts; - script.on_event(defines.events.on_tick, tick_belts); - end - if global.spawn_item ~= nil then - spawn_item = global.spawn_item; - end +--[[ Thing Killing Events ]]-- +script.on_event(defines.events.on_entity_died, function(event) + OnKilledEntity(event) +end) +script.on_event(defines.events.on_robot_pre_mined, function(event) + OnKilledEntity(event) +end) +script.on_event(defines.events.on_preplayer_mined_item, function(event) + OnKilledEntity(event) end) -script.on_event(defines.events.on_built_entity, function(event) - if event.created_entity.name == "spawn-belt" - or event.created_entity.name == "void-belt" then - initalize_globals(); - new_belt = {}; - new_belt["entity"] = event.created_entity; - new_belt["item"] = spawn_item; - new_belt["chest"] = nil; - table.insert(belts, new_belt) - end + + + +script.on_event(defines.events.on_tick, function(event) + global.inputChests = global.inputChests or {} + global.outputChests = global.outputChests or {} + + HandleInputChests() + HandleOutputChests() end) -function _print(...) - local args = { n = select("#", ...); ... }; - local string = ""; - for i, player in pairs(game.players) do - for i = 1, args.n do - string = string .. serpent.block(args[i]) .. "\t"; - end - player.print(string); - end -end - - -function initalize_globals() - if global.belts == nil then - global.belts = {}; - global.pumps = {}; - belts = global.belts; - pumps = global.pumps; - script.on_event(defines.events.on_tick, tick_belts) - end -end - -function destroy_globals() - if #global.belts == 0 then - belts = nil; - pumps = nil; - global.pumps = nil; - global.pumps = nil; - script.on_event(defines.events.on_tick, nil); - end -end - -function tick_belts(tick) - for k, belt in ipairs(belts) do - if belt.entity.valid ~= true then - table.remove(belts, k) - destroy_globals(); - else - if belt.entity.name == "spawn-belt" then - - -- On a lower interval rate, look for chests behind the belt to copy item type - if tick.tick % chest_detection_rate == 0 then - x = belt.entity.position.x; - y = belt.entity.position.y; - if belt.entity.direction == 0 then - y = y + 1; - elseif belt.entity.direction == 2 then - x = x - 1; - elseif belt.entity.direction == 4 then - y = y - 1; - elseif belt.entity.direction == 6 then - x = x + 1; - end - - chests = belt.entity.surface.find_entities_filtered({area = {{x,y},{x,y}}, type="container"}); - if #chests > 0 then - inventory = chests[1].get_inventory(defines.inventory.chest); - if inventory ~= nil - and inventory.valid == true - and inventory.is_empty() == false - and inventory[1].valid == true - and inventory[1].valid_for_read == true then - belt.item = inventory[1].name; +function HandleInputChests() + local linesToWriteToFile = {} + for k, v in pairs(global.inputChests) do + if v.valid then + --get the content of the chest + local items = v.get_inventory(defines.inventory.chest).get_contents() + --write everything to the file + for itemName, itemCount in pairs(items) do + linesToWriteToFile[#linesToWriteToFile + 1] = itemName..", "..itemCount.."\n" end - end + -- clear the inventory + v.get_inventory(defines.inventory.chest).clear() end - - -- Fill the belt with selected item - line1 = belt.entity.get_transport_line(1); - if line1.can_insert_at_back() then - if(global.items ~= nil and global.spentItems ~= nil) then - if(global.items[belt.item] ~= nil and global.spentItems[belt.item] ~= nil) then - if(global.items[belt.item] > 1) then - global.items[belt.item] = global.items[belt.item] - 1; - global.spentItems[belt.item] = global.spentItems[belt.item] + 1; - line1.insert_at_back({name = belt.item}); + end + if #linesToWriteToFile > 0 then + --only write to file once as i/o is slow + --it's much faster to concatenate all the lines with table.concat + --instead of doing it with the .. operator + game.write_file(INPUT_CHEST_FILE, table.concat(linesToWriteToFile), true) + end +end + +function HandleOutputChests() + local linesToWriteToFile = {} + local simpleItemStack = {} + for k, v in pairs(global.outputChests) do + if v.valid and not v.to_be_deconstructed(v.force) then + --get the inventory here once for faster execution + local chestInventory = v.get_inventory(defines.inventory.chest) + for i = 1, 10 do + --the item the chest wants + local requestItem = v.get_request_slot(i) + if requestItem ~= nil then + local itemsInChest = chestInventory.get_item_count(requestItem.name) + --if there isn't enough items in the chest + if itemsInChest < requestItem.count then + simpleItemStack.name = requestItem.name + simpleItemStack.count = requestItem.count - itemsInChest + --insert the missing items + local insertedItemsCount = chestInventory.insert(simpleItemStack) + --write how many items was inserted + linesToWriteToFile[#linesToWriteToFile + 1] = simpleItemStack.name..", "..insertedItemsCount.."\n" end - else - global.items[belt.item] = 0 - global.spentItems[belt.item] = 0 end end end - line2 = belt.entity.get_transport_line(2); - if line2.can_insert_at_back() then - if(global.items ~= nil) then - if(global.items[belt.item] ~= nil) then - if(global.items[belt.item] > 1) then - global.items[belt.item] = global.items[belt.item] - 1; - global.spentItems[belt.item] = global.spentItems[belt.item] + 1; - line2.insert_at_back({name = belt.item}); - end - else - global.items[belt.item] = 0 - end - end - end - - elseif belt.entity.name == "void-belt" then - belt.entity.get_transport_line(1).clear(); - belt.entity.get_transport_line(2).clear(); - end end - end + if #linesToWriteToFile > 0 then + --only write to file once as i/o is slow + --it's much faster to concatenate all the lines with table.concat + --instead of doing it with the .. operator + game.write_file(OUTPUT_CHEST_FILE, table.concat(linesToWriteToFile), true) + end end + + + + + + + + + + + + + + + + + diff --git a/c-inv_0.0.2/data.lua b/c-inv_0.0.2/data.lua index ac33aabb..f23ed413 100644 --- a/c-inv_0.0.2/data.lua +++ b/c-inv_0.0.2/data.lua @@ -1,8 +1,87 @@ -require("prototypes.groups") -require("prototypes.items") -require("prototypes.recipes") -require("prototypes.entitys") --- spawn belt -require("prototypes.item") -require("prototypes.recipe") -require("prototypes.entity") \ No newline at end of file +require("util") +require("config") + +function MakeLogisticEntity(entity, name, picturePath, iconPath) + entity.name = name + entity.minable.result = name + --if no picture is defined then use the default one + entity.picture.filename = picturePath or entity.picture.filename + --if no icon is defined then use the default one + entity.icon = iconPath or entity.icon + + -- add the entity to a technology so it can be unlocked + local wasAddedToTech = AddEntityToTech("construction-robotics", name) + + data:extend( + { + -- add the entity + entity, + -- add the recipe for the entity + { + type = "recipe", + name = name, + --if the recipe was succesfully attached to the tech then the recipe + --shouldn't be enabled to begin with. + --but if the recipe isn't attached to a tech then it should + --be enabled to begin with because otherwise the player can never use the item ingame + enabled = not wasAddedToTech, + ingredients = + { + {"steel-chest", 1}, + {"electronic-circuit", 3}, + {"advanced-circuit", 1} + }, + result = name, + requester_paste_multiplier = 4 + }, + { + type = "item", + name = name, + icon = entity.icon, + flags = {"goes-to-quickbar"}, + subgroup = "storage", + order = "a[items]-b["..name.."]", + place_result = name, + stack_size = 50 + } + }) +end + +--adds a recipe to a tech and returns true or if that fails returns false +function AddEntityToTech(techName, name) + --can't add the recipe to the tech if it doesn't exist + if data.raw["technology"][techName] ~= nil then + local effects = data.raw["technology"][techName].effects + --if another mod removed the effects or made it nil then make a new table to put the recipe in + effects = effects or {} + --insert the recipe as an unlock when the research is done + effects[#effects + 1] = { + type = "unlock-recipe", + recipe = name + } + --if a new table for the effects is made then the effects has to be attached to the + -- tech again because the table won't otherwise be owned by the tech + data.raw["technology"][techName].effects = effects + return true + end + return false +end + + + +MakeLogisticEntity(table.deepcopy(data.raw["logistic-container"]["logistic-chest-requester"]), OUTPUT_CHEST_NAME, OUTPUT_CHEST_PICTURE_PATH, OUTPUT_CHEST_ICON_PATH) +MakeLogisticEntity(table.deepcopy(data.raw["container"]["iron-chest"]), INPUT_CHEST_NAME, INPUT_CHEST_PICTURE_PATH, INPUT_CHEST_ICON_PATH) + + + + + + + + + + + + + + diff --git a/c-inv_0.0.2/graphics/entity/spawn-belt/spawn-belt.png b/c-inv_0.0.2/graphics/entity/spawn-belt/spawn-belt.png deleted file mode 100644 index 65097990..00000000 Binary files a/c-inv_0.0.2/graphics/entity/spawn-belt/spawn-belt.png and /dev/null differ diff --git a/c-inv_0.0.2/graphics/entity/void-belt/void-belt.png b/c-inv_0.0.2/graphics/entity/void-belt/void-belt.png deleted file mode 100644 index 65097990..00000000 Binary files a/c-inv_0.0.2/graphics/entity/void-belt/void-belt.png and /dev/null differ diff --git a/c-inv_0.0.2/graphics/icons/spawn-belt.png b/c-inv_0.0.2/graphics/icons/spawn-belt.png deleted file mode 100644 index af378a95..00000000 Binary files a/c-inv_0.0.2/graphics/icons/spawn-belt.png and /dev/null differ diff --git a/c-inv_0.0.2/graphics/icons/void-belt.png b/c-inv_0.0.2/graphics/icons/void-belt.png deleted file mode 100644 index af378a95..00000000 Binary files a/c-inv_0.0.2/graphics/icons/void-belt.png and /dev/null differ diff --git a/c-inv_0.0.2/inspect.lua b/c-inv_0.0.2/inspect.lua deleted file mode 100644 index be805452..00000000 --- a/c-inv_0.0.2/inspect.lua +++ /dev/null @@ -1,336 +0,0 @@ -local inspect ={ - _VERSION = 'inspect.lua 3.1.0', - _URL = 'http://github.com/kikito/inspect.lua', - _DESCRIPTION = 'human-readable representations of tables', - _LICENSE = [[ - MIT LICENSE - Copyright (c) 2013 Enrique García Cota - Permission is hereby granted, free of charge, to any person obtaining a - copy of this software and associated documentation files (the - "Software"), to deal in the Software without restriction, including - without limitation the rights to use, copy, modify, merge, publish, - distribute, sublicense, and/or sell copies of the Software, and to - permit persons to whom the Software is furnished to do so, subject to - the following conditions: - The above copyright notice and this permission notice shall be included - in all copies or substantial portions of the Software. - THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - ]] -} - -local tostring = tostring - -inspect.KEY = setmetatable({}, {__tostring = function() return 'inspect.KEY' end}) -inspect.METATABLE = setmetatable({}, {__tostring = function() return 'inspect.METATABLE' end}) - --- Apostrophizes the string if it has quotes, but not aphostrophes --- Otherwise, it returns a regular quoted string -local function smartQuote(str) - if str:match('"') and not str:match("'") then - return "'" .. str .. "'" - end - return '"' .. str:gsub('"', '\\"') .. '"' -end - --- \a => '\\a', \0 => '\\0', 31 => '\31' -local shortControlCharEscapes = { - ["\a"] = "\\a", ["\b"] = "\\b", ["\f"] = "\\f", ["\n"] = "\\n", - ["\r"] = "\\r", ["\t"] = "\\t", ["\v"] = "\\v" -} -local longControlCharEscapes = {} -- \a => nil, \0 => \000, 31 => \031 -for i=0, 31 do - local ch = string.char(i) - if not shortControlCharEscapes[ch] then - shortControlCharEscapes[ch] = "\\"..i - longControlCharEscapes[ch] = string.format("\\%03d", i) - end -end - -local function escape(str) - return (str:gsub("\\", "\\\\") - :gsub("(%c)%f[0-9]", longControlCharEscapes) - :gsub("%c", shortControlCharEscapes)) -end - -local function isIdentifier(str) - return type(str) == 'string' and str:match( "^[_%a][_%a%d]*$" ) -end - -local function isSequenceKey(k, sequenceLength) - return type(k) == 'number' - and 1 <= k - and k <= sequenceLength - and math.floor(k) == k -end - -local defaultTypeOrders = { - ['number'] = 1, ['boolean'] = 2, ['string'] = 3, ['table'] = 4, - ['function'] = 5, ['userdata'] = 6, ['thread'] = 7 -} - -local function sortKeys(a, b) - local ta, tb = type(a), type(b) - - -- strings and numbers are sorted numerically/alphabetically - if ta == tb and (ta == 'string' or ta == 'number') then return a < b end - - local dta, dtb = defaultTypeOrders[ta], defaultTypeOrders[tb] - -- Two default types are compared according to the defaultTypeOrders table - if dta and dtb then return defaultTypeOrders[ta] < defaultTypeOrders[tb] - elseif dta then return true -- default types before custom ones - elseif dtb then return false -- custom types after default ones - end - - -- custom types are sorted out alphabetically - return ta < tb -end - --- For implementation reasons, the behavior of rawlen & # is "undefined" when --- tables aren't pure sequences. So we implement our own # operator. -local function getSequenceLength(t) - local len = 1 - local v = rawget(t,len) - while v ~= nil do - len = len + 1 - v = rawget(t,len) - end - return len - 1 -end - -local function getNonSequentialKeys(t) - local keys = {} - local sequenceLength = getSequenceLength(t) - for k,_ in pairs(t) do - if not isSequenceKey(k, sequenceLength) then table.insert(keys, k) end - end - table.sort(keys, sortKeys) - return keys, sequenceLength -end - -local function getToStringResultSafely(t, mt) - local __tostring = type(mt) == 'table' and rawget(mt, '__tostring') - local str, ok - if type(__tostring) == 'function' then - ok, str = pcall(__tostring, t) - str = ok and str or 'error: ' .. tostring(str) - end - if type(str) == 'string' and #str > 0 then return str end -end - -local function countTableAppearances(t, tableAppearances) - tableAppearances = tableAppearances or {} - - if type(t) == 'table' then - if not tableAppearances[t] then - tableAppearances[t] = 1 - for k,v in pairs(t) do - countTableAppearances(k, tableAppearances) - countTableAppearances(v, tableAppearances) - end - countTableAppearances(getmetatable(t), tableAppearances) - else - tableAppearances[t] = tableAppearances[t] + 1 - end - end - - return tableAppearances -end - -local copySequence = function(s) - local copy, len = {}, #s - for i=1, len do copy[i] = s[i] end - return copy, len -end - -local function makePath(path, ...) - local keys = {...} - local newPath, len = copySequence(path) - for i=1, #keys do - newPath[len + i] = keys[i] - end - return newPath -end - -local function processRecursive(process, item, path, visited) - - if item == nil then return nil end - if visited[item] then return visited[item] end - - local processed = process(item, path) - if type(processed) == 'table' then - local processedCopy = {} - visited[item] = processedCopy - local processedKey - - for k,v in pairs(processed) do - processedKey = processRecursive(process, k, makePath(path, k, inspect.KEY), visited) - if processedKey ~= nil then - processedCopy[processedKey] = processRecursive(process, v, makePath(path, processedKey), visited) - end - end - - local mt = processRecursive(process, getmetatable(processed), makePath(path, inspect.METATABLE), visited) - setmetatable(processedCopy, mt) - processed = processedCopy - end - return processed -end - - - -------------------------------------------------------------------- - -local Inspector = {} -local Inspector_mt = {__index = Inspector} - -function Inspector:puts(...) - local args = {...} - local buffer = self.buffer - local len = #buffer - for i=1, #args do - len = len + 1 - buffer[len] = args[i] - end -end - -function Inspector:down(f) - self.level = self.level + 1 - f() - self.level = self.level - 1 -end - -function Inspector:tabify() - self:puts(self.newline, string.rep(self.indent, self.level)) -end - -function Inspector:alreadyVisited(v) - return self.ids[v] ~= nil -end - -function Inspector:getId(v) - local id = self.ids[v] - if not id then - local tv = type(v) - id = (self.maxIds[tv] or 0) + 1 - self.maxIds[tv] = id - self.ids[v] = id - end - return tostring(id) -end - -function Inspector:putKey(k) - if isIdentifier(k) then return self:puts(k) end - self:puts("[") - self:putValue(k) - self:puts("]") -end - -function Inspector:putTable(t) - if t == inspect.KEY or t == inspect.METATABLE then - self:puts(tostring(t)) - elseif self:alreadyVisited(t) then - self:puts('') - elseif self.level >= self.depth then - self:puts('{...}') - else - if self.tableAppearances[t] > 1 then self:puts('<', self:getId(t), '>') end - - local nonSequentialKeys, sequenceLength = getNonSequentialKeys(t) - local mt = getmetatable(t) - local toStringResult = getToStringResultSafely(t, mt) - - self:puts('{') - self:down(function() - if toStringResult then - self:puts(' -- ', escape(toStringResult)) - if sequenceLength >= 1 then self:tabify() end - end - - local count = 0 - for i=1, sequenceLength do - if count > 0 then self:puts(',') end - self:puts(' ') - self:putValue(t[i]) - count = count + 1 - end - - for _,k in ipairs(nonSequentialKeys) do - if count > 0 then self:puts(',') end - self:tabify() - self:putKey(k) - self:puts(' = ') - self:putValue(t[k]) - count = count + 1 - end - - if mt then - if count > 0 then self:puts(',') end - self:tabify() - self:puts(' = ') - self:putValue(mt) - end - end) - - if #nonSequentialKeys > 0 or mt then -- result is multi-lined. Justify closing } - self:tabify() - elseif sequenceLength > 0 then -- array tables have one extra space before closing } - self:puts(' ') - end - - self:puts('}') - end -end - -function Inspector:putValue(v) - local tv = type(v) - - if tv == 'string' then - self:puts(smartQuote(escape(v))) - elseif tv == 'number' or tv == 'boolean' or tv == 'nil' then - self:puts(tostring(v)) - elseif tv == 'table' then - self:putTable(v) - else - self:puts('<',tv,' ',self:getId(v),'>') - end -end - -------------------------------------------------------------------- - -function inspect.inspect(root, options) - options = options or {} - - local depth = options.depth or math.huge - local newline = options.newline or '\n' - local indent = options.indent or ' ' - local process = options.process - - if process then - root = processRecursive(process, root, {}, {}) - end - - local inspector = setmetatable({ - depth = depth, - level = 0, - buffer = {}, - ids = {}, - maxIds = {}, - newline = newline, - indent = indent, - tableAppearances = countTableAppearances(root) - }, Inspector_mt) - - inspector:putValue(root) - - return table.concat(inspector.buffer) -end - -setmetatable(inspect, { __call = function(_, ...) return inspect.inspect(...) end }) - -return inspect diff --git a/c-inv_0.0.2/locale/en/item-names.cfg b/c-inv_0.0.2/locale/en/item-names.cfg index cbd4883c..714754ed 100644 --- a/c-inv_0.0.2/locale/en/item-names.cfg +++ b/c-inv_0.0.2/locale/en/item-names.cfg @@ -1,22 +1,8 @@ [entity-name] -c-inv_creativeChest=Creative Chest -c-inv_creativeTank=Creative Tank -c-inv_voidChest=Void Chest -c-inv_voidTank=Void Tank +put-chest=Put chest +get-chest=Get chest [item-name] -c-inv_creativeChest=Creative Chest -c-inv_creativeTank=Creative Tank -c-inv_voidChest=Void Chest -c-inv_voidTank=Void Tank - -[item-description] -c-inv_creativeChest=A chest that refill itselfe -c-inv_creativeTank=A everfull Tank -c-inv_voidChest=There is a black hole inside -c-inv_voidTank=A bottomless pit - -[fluid-name] - -[fluid-description] +put-chest=Put chest +get-chest=Get chest \ No newline at end of file diff --git a/c-inv_0.0.2/locale/en/recipe-names.cfg b/c-inv_0.0.2/locale/en/recipe-names.cfg deleted file mode 100644 index 9eb734ac..00000000 --- a/c-inv_0.0.2/locale/en/recipe-names.cfg +++ /dev/null @@ -1,4 +0,0 @@ - -[recipe-name] - -[recipe-description] \ No newline at end of file diff --git a/c-inv_0.0.2/prototypes/entity.lua b/c-inv_0.0.2/prototypes/entity.lua deleted file mode 100644 index c637e276..00000000 --- a/c-inv_0.0.2/prototypes/entity.lua +++ /dev/null @@ -1,98 +0,0 @@ -require ("transport-belt-stuff") - -data:extend({ - { - type = "transport-belt", - name = "spawn-belt", - icon = "__c-inv__/graphics/icons/spawn-belt.png", - flags = {"placeable-neutral", "player-creation"}, - minable = {hardness = 0.2, mining_time = 0.3, result = "spawn-belt"}, - max_health = 50, - corpse = "small-remnants", - collision_box = {{-0.4, -0.4}, {0.4, 0.4}}, - selection_box = {{-0.5, -0.5}, {0.5, 0.5}}, - working_sound = - { - sound = - { - filename = "__base__/sound/express-transport-belt.ogg", - volume = 0.4 - }, - max_sounds_per_type = 3 - }, - animation_speed_coefficient = 32, - animations = - { - filename = "__c-inv__/graphics/entity/spawn-belt/spawn-belt.png", - priority = "extra-high", - width = 40, - height = 40, - frame_count = 32, - direction_count = 12 - }, - fast_replaceable_group = "transport-belt", - speed = 0.15375, - -- specified in transport-belt-stuff.lua - belt_horizontal = spawn_belt_horizontal, - belt_vertical = spawn_belt_vertical, - ending_top = spawn_belt_ending_top, - ending_bottom = spawn_belt_ending_bottom, - ending_side = spawn_belt_ending_side, - starting_top = spawn_belt_starting_top, - starting_bottom = spawn_belt_starting_bottom, - starting_side = spawn_belt_starting_side, - ending_patch = ending_patch_prototype, - ending_patch = ending_patch_prototype, - connector_frame_sprites = transport_belt_connector_frame_sprites, - circuit_connector_sprites = transport_belt_circuit_connector_sprites, - circuit_wire_connection_point = transport_belt_circuit_wire_connection_point, - circuit_wire_max_distance = transport_belt_circuit_wire_max_distance - }, - { - type = "transport-belt", - name = "void-belt", - icon = "__c-inv__/graphics/icons/void-belt.png", - flags = {"placeable-neutral", "player-creation"}, - minable = {hardness = 0.2, mining_time = 0.3, result = "void-belt"}, - max_health = 50, - corpse = "small-remnants", - collision_box = {{-0.4, -0.4}, {0.4, 0.4}}, - selection_box = {{-0.5, -0.5}, {0.5, 0.5}}, - working_sound = - { - sound = - { - filename = "__base__/sound/express-transport-belt.ogg", - volume = 0.4 - }, - max_sounds_per_type = 3 - }, - animation_speed_coefficient = 32, - animations = - { - filename = "__c-inv__/graphics/entity/void-belt/void-belt.png", - priority = "extra-high", - width = 40, - height = 40, - frame_count = 32, - direction_count = 12 - }, - fast_replaceable_group = "transport-belt", - speed = 0.15375, - -- specified in transport-belt-stuff.lua - belt_horizontal = spawn_belt_horizontal, - belt_vertical = spawn_belt_vertical, - ending_top = spawn_belt_ending_top, - ending_bottom = spawn_belt_ending_bottom, - ending_side = spawn_belt_ending_side, - starting_top = spawn_belt_starting_top, - starting_bottom = spawn_belt_starting_bottom, - starting_side = spawn_belt_starting_side, - ending_patch = ending_patch_prototype, - ending_patch = ending_patch_prototype, - connector_frame_sprites = transport_belt_connector_frame_sprites, - circuit_connector_sprites = transport_belt_circuit_connector_sprites, - circuit_wire_connection_point = transport_belt_circuit_wire_connection_point, - circuit_wire_max_distance = transport_belt_circuit_wire_max_distance - }, -}) \ No newline at end of file diff --git a/c-inv_0.0.2/prototypes/entitys.lua b/c-inv_0.0.2/prototypes/entitys.lua deleted file mode 100644 index 19e1f620..00000000 --- a/c-inv_0.0.2/prototypes/entitys.lua +++ /dev/null @@ -1,58 +0,0 @@ -data:extend( -{ - { - type = "logistic-container", - name = "c-inv_creativeChest", - icon = "__base__/graphics/icons/logistic-chest-passive-provider.png", - flags = {"placeable-player", "player-creation"}, - minable = {hardness = 0.2, mining_time = 0.5, result = "c-inv_creativeChest"}, - max_health = 150, - corpse = "small-remnants", - collision_box = {{-0.35, -0.35}, {0.35, 0.35}}, - selection_box = {{-0.5, -0.5}, {0.5, 0.5}}, - fast_replaceable_group = "container", - inventory_size = 48, - logistic_mode = "passive-provider", - open_sound = { filename = "__base__/sound/metallic-chest-open.ogg", volume=0.65 }, - close_sound = { filename = "__base__/sound/metallic-chest-close.ogg", volume = 0.7 }, - vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 }, - picture = - { - filename = "__base__/graphics/entity/logistic-chest/logistic-chest-passive-provider.png", - priority = "extra-high", - width = 38, - height = 32, - shift = {0.1, 0} - }, - circuit_wire_max_distance = 7.5 - - }, - { - type = "logistic-container", - name = "c-inv_voidChest", - icon = "__base__/graphics/icons/logistic-chest-requester.png", - flags = {"placeable-player", "player-creation"}, - minable = {hardness = 0.2, mining_time = 0.5, result = "c-inv_voidChest"}, - max_health = 150, - corpse = "small-remnants", - collision_box = {{-0.35, -0.35}, {0.35, 0.35}}, - selection_box = {{-0.5, -0.5}, {0.5, 0.5}}, - fast_replaceable_group = "container", - inventory_size = 48, - logistic_mode = "requester", - open_sound = { filename = "__base__/sound/metallic-chest-open.ogg", volume=0.65 }, - close_sound = { filename = "__base__/sound/metallic-chest-close.ogg", volume = 0.7 }, - picture = - { - filename = "__base__/graphics/entity/logistic-chest/logistic-chest-requester.png", - priority = "extra-high", - width = 38, - height = 32, - shift = {0.1, 0} - }, - circuit_wire_max_distance = 7.5 - - }, - - } -) diff --git a/c-inv_0.0.2/prototypes/groups.lua b/c-inv_0.0.2/prototypes/groups.lua deleted file mode 100644 index 01f07187..00000000 --- a/c-inv_0.0.2/prototypes/groups.lua +++ /dev/null @@ -1,16 +0,0 @@ -data:extend({ - - { - type = "item-group", - name = "c-inv", - order = "c", - inventory_order = "c", - icon = "__base__/graphics/icons/steel-chest.png" - }, - { - type = "item-subgroup", - name = "c-inv-storage", - group = "c-inv", - order = "a", - } -}) \ No newline at end of file diff --git a/c-inv_0.0.2/prototypes/item.lua b/c-inv_0.0.2/prototypes/item.lua deleted file mode 100644 index 47c93494..00000000 --- a/c-inv_0.0.2/prototypes/item.lua +++ /dev/null @@ -1,22 +0,0 @@ -data:extend({ - { - type = "item", - name = "spawn-belt", - icon = "__c-inv__/graphics/icons/spawn-belt.png", - flags = {"goes-to-quickbar"}, - subgroup = "belt", - order = "a[express-transport-belt]-d[spawn-belt]", - place_result = "spawn-belt", - stack_size = 50 - }, - { - type = "item", - name = "void-belt", - icon = "__c-inv__/graphics/icons/void-belt.png", - flags = {"goes-to-quickbar"}, - subgroup = "belt", - order = "c[spawn-belt]-d[void-belt]", - place_result = "void-belt", - stack_size = 50 - } -}) \ No newline at end of file diff --git a/c-inv_0.0.2/prototypes/items.lua b/c-inv_0.0.2/prototypes/items.lua deleted file mode 100644 index 89ed3be4..00000000 --- a/c-inv_0.0.2/prototypes/items.lua +++ /dev/null @@ -1,25 +0,0 @@ - ---automatically generated file | fMT-Export (c)YT v0.03-215Jul17 - -data:extend({ - -{ - type="item", - name="c-inv_creativeChest", - icon="__base__/graphics/icons/logistic-chest-passive-provider.png", - flags={"goes-to-main-inventory"}, - group="c-inv", subgroup="c-inv-storage", - stack_size=100, - place_result="c-inv_creativeChest", -}, -{ - type="item", - name="c-inv_voidChest", - icon="__base__/graphics/icons/logistic-chest-requester.png", - flags={"goes-to-main-inventory"}, - group="c-inv", subgroup="c-inv-storage", - stack_size=100, - place_result="c-inv_voidChest", -}, - -}) \ No newline at end of file diff --git a/c-inv_0.0.2/prototypes/recipe.lua b/c-inv_0.0.2/prototypes/recipe.lua deleted file mode 100644 index 5cdded5f..00000000 --- a/c-inv_0.0.2/prototypes/recipe.lua +++ /dev/null @@ -1,20 +0,0 @@ -data:extend({ - { - type = "recipe", - name = "spawn-belt", - enabled = true, - ingredients = { - {"iron-plate", 1} - }, - result = "spawn-belt" - }, - { - type = "recipe", - name = "void-belt", - enabled = true, - ingredients = { - {"iron-plate", 1} - }, - result = "void-belt" - } -}) \ No newline at end of file diff --git a/c-inv_0.0.2/prototypes/recipes.lua b/c-inv_0.0.2/prototypes/recipes.lua deleted file mode 100644 index 0a31b4a9..00000000 --- a/c-inv_0.0.2/prototypes/recipes.lua +++ /dev/null @@ -1,26 +0,0 @@ - ---automatically generated file | fMT-Export (c)YT v0.03-215Jul17 - -data:extend({ - { - type = "recipe", - name = "c-inv_voidChest", - category = "crafting", -- - enabled = "true", - energy_required = 1.00, - ingredients = { - { type = "item", name = "alien-artifact" , amount = 1.0, }, - { type = "item", name = "coal" , amount = 1.0, }, - { type = "item", name = "copper-ore" , amount = 1.0, }, - { type = "item", name = "iron-ore" , amount = 1.0, }, - { type = "item", name = "stone" , amount = 1.0, }, - { type = "item", name = "wooden-chest" , amount = 1.0, }, - }, - results = { - { type = "item", name = "c-inv_voidChest", amount = 1.0, }, - }, - icon = "__base__/graphics/icons/wooden-chest.png", - order = "0", group = "c-inv", subgroup = "", - }, - -}) \ No newline at end of file diff --git a/c-inv_0.0.2/prototypes/transport-belt-stuff.lua b/c-inv_0.0.2/prototypes/transport-belt-stuff.lua deleted file mode 100644 index a50530d4..00000000 --- a/c-inv_0.0.2/prototypes/transport-belt-stuff.lua +++ /dev/null @@ -1,250 +0,0 @@ -spawn_belt_horizontal = { - filename = "__c-inv__/graphics/entity/spawn-belt/spawn-belt.png", - priority = "extra-high", - width = 40, - height = 40, - frame_count = 32 -} -spawn_belt_vertical = { - filename = "__c-inv__/graphics/entity/spawn-belt/spawn-belt.png", - priority = "extra-high", - width = 40, - height = 40, - frame_count = 32, - y = 40, -} -spawn_belt_ending_top = { - filename = "__c-inv__/graphics/entity/spawn-belt/spawn-belt.png", - priority = "extra-high", - width = 40, - height = 40, - frame_count = 32, - y = 80 -} -spawn_belt_ending_bottom = { - filename = "__c-inv__/graphics/entity/spawn-belt/spawn-belt.png", - priority = "extra-high", - width = 40, - height = 40, - frame_count = 32, - y = 120 -} -spawn_belt_ending_side = { - filename = "__c-inv__/graphics/entity/spawn-belt/spawn-belt.png", - priority = "extra-high", - width = 40, - height = 40, - frame_count = 32, - y = 160 -} -spawn_belt_starting_top = { - filename = "__c-inv__/graphics/entity/spawn-belt/spawn-belt.png", - priority = "extra-high", - width = 40, - height = 40, - frame_count = 32, - y = 200 -} -spawn_belt_starting_bottom = { - filename = "__c-inv__/graphics/entity/spawn-belt/spawn-belt.png", - priority = "extra-high", - width = 40, - height = 40, - frame_count = 32, - y = 240 -} -spawn_belt_starting_side = { - filename = "__c-inv__/graphics/entity/spawn-belt/spawn-belt.png", - priority = "extra-high", - width = 40, - height = 40, - frame_count = 32, - y = 280 -} - -transport_belt_connector_frame_sprites = { - frame_main_h = - { - filename = "__base__/graphics/entity/transport-belt/connector/transport-belt-connector-frame-main-h.png", - priority = "low", - width = 34, - height = 38, - shift = {0, -0.0625}, - }, - frame_main_ne = - { - filename = "__base__/graphics/entity/transport-belt/connector/transport-belt-connector-frame-main-ne.png", - priority = "low", - width = 35, - height = 34, - shift = {-0.015625, 0}, - }, - frame_main_nw = - { - filename = "__base__/graphics/entity/transport-belt/connector/transport-belt-connector-frame-main-nw.png", - priority = "low", - width = 34, - height = 34, - shift = {0, 0}, - }, - frame_main_se = - { - filename = "__base__/graphics/entity/transport-belt/connector/transport-belt-connector-frame-main-se.png", - priority = "low", - width = 34, - height = 39, - shift = {0, -0.078125}, - }, - frame_main_sw = - { - filename = "__base__/graphics/entity/transport-belt/connector/transport-belt-connector-frame-main-sw.png", - priority = "low", - width = 34, - height = 39, - shift = {0, -0.078125}, - }, - frame_main_v = - { - filename = "__base__/graphics/entity/transport-belt/connector/transport-belt-connector-frame-main-v.png", - priority = "low", - width = 34, - height = 34, - shift = {0, 0}, - }, - frame_main_x = - { - filename = "__base__/graphics/entity/transport-belt/connector/transport-belt-connector-frame-main-x.png", - priority = "low", - width = 34, - height = 34, - shift = {0, 0}, - }, - frame_shadow_h = - { - filename = "__base__/graphics/entity/transport-belt/connector/transport-belt-connector-frame-shadow-h.png", - priority = "low", - width = 37, - height = 34, - shift = {0.078125, 0}, - }, - frame_shadow_ne = - { - filename = "__base__/graphics/entity/transport-belt/connector/transport-belt-connector-frame-shadow-ne.png", - priority = "low", - width = 39, - height = 34, - shift = {0.109375, 0}, - }, - frame_shadow_nw = - { - filename = "__base__/graphics/entity/transport-belt/connector/transport-belt-connector-frame-shadow-nw.png", - priority = "low", - width = 40, - height = 34, - shift = {0.09375, 0}, - }, - frame_shadow_se = - { - filename = "__base__/graphics/entity/transport-belt/connector/transport-belt-connector-frame-shadow-se.png", - priority = "low", - width = 39, - height = 34, - shift = {0.109375, 0}, - }, - frame_shadow_sw = - { - filename = "__base__/graphics/entity/transport-belt/connector/transport-belt-connector-frame-shadow-sw.png", - priority = "low", - width = 39, - height = 34, - shift = {0.109375, 0}, - }, - frame_shadow_v = - { - filename = "__base__/graphics/entity/transport-belt/connector/transport-belt-connector-frame-shadow-v.png", - priority = "low", - width = 39, - height = 34, - shift = {0.109375, 0}, - }, - frame_shadow_x = - { - filename = "__base__/graphics/entity/transport-belt/connector/transport-belt-connector-frame-shadow-x.png", - priority = "low", - width = 39, - height = 34, - shift = {0.109375, 0}, - }, - frame_main_scanner = - { - filename = "__base__/graphics/entity/transport-belt/connector/transport-belt-connector-frame-main-scanner.png", - priority = "low", - blend_mode = "additive", - width = 10, - height = 31, - frame_count = 8, - shift = {0, 0.015625}, - }, - - frame_main_scanner_movement_speed = 0.032258064516129, - - frame_main_scanner_horizontal_start_shift = {-0.25, -0.125 + 1/32}, - frame_main_scanner_horizontal_end_shift = {0.25, -0.125 + 1/32}, - frame_main_scanner_horizontal_y_scale = 0.70, - frame_main_scanner_horizontal_rotation = 0, - - frame_main_scanner_vertical_start_shift = {0, -0.3125}, - frame_main_scanner_vertical_end_shift = {0, 0.1875} , - frame_main_scanner_vertical_y_scale = 0.75, - frame_main_scanner_vertical_rotation = 0.25, - - frame_main_scanner_cross_horizontal_start_shift = {-0.3125, -0.0625}, - frame_main_scanner_cross_horizontal_end_shift = {0.3125, -0.0625} , - frame_main_scanner_cross_horizontal_y_scale = 0.60, - frame_main_scanner_cross_horizontal_rotation = 0, - - frame_main_scanner_cross_vertical_start_shift = {0, -0.3125}, - frame_main_scanner_cross_vertical_end_shift = {0, 0.1875} , - frame_main_scanner_cross_vertical_y_scale = 0.75, - frame_main_scanner_cross_vertical_rotation = 0.25, - - - frame_main_scanner_nw_ne = - { - filename = "__base__/graphics/entity/transport-belt/connector/transport-belt-connector-frame-main-scanner-nw-ne.png", - priority = "low", - blend_mode = "additive", - line_length = 8, - width = 28, - height = 24, - frame_count = 32, - shift = {-0.03125, -0.0625}, - }, - - frame_main_scanner_sw_se = - { - filename = "__base__/graphics/entity/transport-belt/connector/transport-belt-connector-frame-main-scanner-sw-se.png", - priority = "low", - blend_mode = "additive", - line_length = 8, - width = 29, - height = 28, - frame_count = 32, - shift = {0.015625, -0.09375}, - }, -} - -transport_belt_circuit_wire_connection_point = { - shadow = - { - red = {0.703125, -0.296875}, - green = {0.703125, -0.203125}, - }, - wire = - { - red = {0.4375, -0.59375}, - green = {0.4375, -0.46875}, - } -} -transport_belt_circuit_wire_max_distance = 7.5 -transport_belt_circuit_connector_sprites = get_circuit_connector_sprites({0.1875, -0.5}, {0.3125, -0.34375}, 2)