Добавлены все обновления от сообщества, вплоть до #148
This commit is contained in:
19
ElectricResistance/MIT_license.txt
Normal file
19
ElectricResistance/MIT_license.txt
Normal file
@@ -0,0 +1,19 @@
|
||||
Copyright 2020 darkfrei
|
||||
|
||||
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.
|
||||
37
ElectricResistance/changelog.txt
Normal file
37
ElectricResistance/changelog.txt
Normal file
@@ -0,0 +1,37 @@
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 1.1.5
|
||||
Date: 2020-09-26
|
||||
Changes:
|
||||
- Update to Factorio 1.1
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 1.0.5
|
||||
Date: 2020-09-26
|
||||
Changes:
|
||||
- Added events on script_raised_built, script_raised_destroy for Klonan's construction drones compatibility
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 1.0.4
|
||||
Date: 2020-09-22
|
||||
Changes:
|
||||
- Resistor will be indestructible
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 1.0.3
|
||||
Date: 2020-09-05
|
||||
Changes:
|
||||
- Fixed issue with damage and ghosts
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 1.0.2
|
||||
Date: 2020-09-05
|
||||
Changes:
|
||||
- Update to 1.0
|
||||
- Fixed issue with deconstruction planer
|
||||
- Added settings value; default is 1 kW
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 0.0.2
|
||||
Date: 2020-08-14
|
||||
Changes:
|
||||
- Fixed issue with mined entity without entity
|
||||
---------------------------------------------------------------------------------------------------
|
||||
Version: 0.0.1
|
||||
Date: 2020-07-20
|
||||
Changes:
|
||||
- First release
|
||||
100
ElectricResistance/control.lua
Normal file
100
ElectricResistance/control.lua
Normal file
@@ -0,0 +1,100 @@
|
||||
|
||||
|
||||
script.on_configuration_changed(function(data)
|
||||
for i, surface in pairs (game.surfaces) do
|
||||
local resistors = surface.find_entities_filtered{name="hidden-electric-resistance"}
|
||||
for j, resistor in pairs (resistors) do
|
||||
-- surface.find_entity("", position)
|
||||
local count = surface.count_entities_filtered{position=resistor.position, type="electric-pole"}
|
||||
if count == 0 then
|
||||
resistor.destroy() -- 1.0.2
|
||||
elseif resistor.destructible then
|
||||
resistor.destructible = false
|
||||
end
|
||||
end
|
||||
end
|
||||
end)
|
||||
|
||||
script.on_init(function(data)
|
||||
local n = 0
|
||||
for i, surface in pairs (game.surfaces) do
|
||||
local entities = surface.find_entities_filtered({type="electric-pole"})
|
||||
for j, entity in pairs (entities) do
|
||||
add_resistor(entity)
|
||||
end
|
||||
n=n+#entities
|
||||
end
|
||||
game.print ('[Electric Resistance]: added ' .. n .. ' resistors')
|
||||
end)
|
||||
|
||||
|
||||
script.on_event(defines.events.on_robot_mined_entity, function(event)
|
||||
|
||||
end)
|
||||
|
||||
function add_resistor(entity)
|
||||
local surface = entity.surface
|
||||
-- local position = entity.position
|
||||
-- create_entity{name=…, position=…, direction=…, force=…, target=…, source=…, fast_replace=…, player=…, spill=…, raise_built=…, create_build_effect_smoke=…}
|
||||
local resistor = surface.create_entity{name="hidden-electric-resistance",
|
||||
position = entity.position,
|
||||
force = entity.force,
|
||||
create_build_effect_smoke=false
|
||||
}
|
||||
resistor.destructible = false -- added in 1.0.4
|
||||
end
|
||||
|
||||
function on_built_entity (entity)
|
||||
if entity.type == "electric-pole" then
|
||||
add_resistor(entity)
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
script.on_event(defines.events.on_built_entity, function(event)
|
||||
on_built_entity (event.created_entity)
|
||||
end)
|
||||
|
||||
script.on_event(defines.events.on_robot_built_entity, function(event)
|
||||
on_built_entity (event.created_entity)
|
||||
end)
|
||||
|
||||
-- added in 1.0.5
|
||||
script.on_event(defines.events.script_raised_built, function(event)
|
||||
on_built_entity (event.entity) -- why not created_entity, devs?
|
||||
end)
|
||||
|
||||
|
||||
function on_mined_entity (entity)
|
||||
-- if entity.valid
|
||||
if entity and entity.type == "electric-pole" then
|
||||
local surface = entity.surface
|
||||
local resistor = surface.find_entity("hidden-electric-resistance", entity.position)
|
||||
if resistor then
|
||||
resistor.destroy()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
script.on_event(defines.events.on_player_mined_entity, function(event)
|
||||
-- game.print('on_player_mined_entity')
|
||||
on_mined_entity (event.entity)
|
||||
end)
|
||||
|
||||
script.on_event(defines.events.on_robot_mined_entity, function(event) -- changed in 1.0.3
|
||||
-- game.print('on_robot_mined_entity')
|
||||
on_mined_entity (event.entity)
|
||||
end)
|
||||
|
||||
script.on_event(defines.events.on_entity_died, function(event)
|
||||
-- game.print('on_entity_died')
|
||||
on_mined_entity (event.entity)
|
||||
end)
|
||||
|
||||
-- added in 1.0.5
|
||||
script.on_event(defines.events.script_raised_destroy, function(event)
|
||||
-- game.print('on_entity_died')
|
||||
on_mined_entity (event.entity)
|
||||
end)
|
||||
|
||||
|
||||
64
ElectricResistance/data-final-fixes.lua
Normal file
64
ElectricResistance/data-final-fixes.lua
Normal file
@@ -0,0 +1,64 @@
|
||||
-- I have a lot of mods, but sometimes I get errors like:
|
||||
|
||||
-- ===================================== --
|
||||
-- 33.126 Error ModManager.cpp:1024: Error in assignID, item with name 'clowns-plate-osmium' does not exist.
|
||||
-- Source: alt2-production-science-pack (recipe).
|
||||
|
||||
-- 33.295 Mods to disable:Failed to load mods: Error in assignID, item with name 'clowns-plate-osmium' does not exist.
|
||||
-- Source: alt2-production-science-pack (recipe).
|
||||
-- Mods to be disabled:
|
||||
-- Clowns-Science
|
||||
-- angelsrefining
|
||||
-- ===================================== --
|
||||
|
||||
-- let's fix it!
|
||||
|
||||
log ('adding lost items and fluids')
|
||||
local mod_name = "__RITEG__"
|
||||
|
||||
function is_wrong_item (item_name)
|
||||
if not item_name then return end
|
||||
local item_type_list = {"ammo", "armor", "gun", "item", "capsule", "repair-tool", "mining-tool", "item-with-entity-data", "rail-planner", "tool", "blueprint", "deconstruction-item", "blueprint-book", "selection-tool", "item-with-tags", "item-with-label", "item-with-inventory", "module"}
|
||||
local item_prot
|
||||
for _,typ in pairs(item_type_list) do
|
||||
local prot = data.raw[typ][item_name]
|
||||
if prot then item_prot = prot end
|
||||
end
|
||||
|
||||
if not item_prot then
|
||||
-- new_item =
|
||||
-- {
|
||||
-- type = "item",
|
||||
-- name = item_name,
|
||||
-- -- flags = {"goes-to-main-inventory"},
|
||||
-- icons = {{icon = mod_name.."/graphics/icons/no-icon.png"}}, icon_size = 32,
|
||||
-- -- order = "e[electric-energy-interface]-b[electric-energy-interface]",
|
||||
-- stack_size = 50,
|
||||
-- -- subgroup = "energy",
|
||||
-- }
|
||||
log ('Deleted wrong item: '.. item_name)
|
||||
return true
|
||||
end
|
||||
return false
|
||||
end
|
||||
|
||||
for recipe_name, recipe in pairs (data.raw.recipe) do
|
||||
local handlers = {recipe}
|
||||
if recipe.normal and recipe.expensive then handlers = {recipe.normal, recipe.expensive} end
|
||||
for i, handler in pairs (handlers) do
|
||||
if handler.ingredients then
|
||||
for j, ingredient in pairs (handler.ingredients) do
|
||||
local item_name, fluid_name
|
||||
if ingredient.type and ingredient.type == "item" or ingredient[1] then
|
||||
item_name = ingredient.name or ingredient[1]
|
||||
elseif ingredient.type and ingredient.type == "fluid" then
|
||||
fluid_name = ingredient.name
|
||||
end
|
||||
if is_wrong_item (item_name) then
|
||||
handler.ingredients[j] = nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
113
ElectricResistance/data.lua
Normal file
113
ElectricResistance/data.lua
Normal file
@@ -0,0 +1,113 @@
|
||||
local mod_name = "__ElectricResistance__"
|
||||
local name = "hidden-electric-resistance"
|
||||
|
||||
local consumption = (settings.startup["electric-resistance-power-consumption"].value) .. "kW"
|
||||
|
||||
local buffer_capacity = (17*settings.startup["electric-resistance-power-consumption"].value) .. "J"
|
||||
|
||||
local energy_usage = (10*settings.startup["electric-resistance-power-consumption"].value) .. "kW"
|
||||
|
||||
data:extend({
|
||||
-- items --
|
||||
{
|
||||
type = "item",
|
||||
icons = {{icon = mod_name.."/graphics/icons/"..name..".png"}},
|
||||
icon_size = 32,
|
||||
name = name,
|
||||
order = "e[electric-energy-interface]-b[electric-energy-interface]",
|
||||
place_result = name,
|
||||
stack_size = 50,
|
||||
subgroup = "energy"
|
||||
|
||||
},
|
||||
|
||||
|
||||
-- entities --
|
||||
{
|
||||
type = "electric-energy-interface",
|
||||
name = name,
|
||||
-- flags = {"placeable-off-grid", "not-on-map"}, -- fixed in 1.0.3
|
||||
-- added from WiredLamps 1.0.3
|
||||
flags = {
|
||||
"placeable-neutral",
|
||||
"player-creation",
|
||||
"fast-replaceable-no-build-while-moving",
|
||||
"placeable-off-grid",
|
||||
"not-on-map",
|
||||
"not-blueprintable",
|
||||
"not-deconstructable",
|
||||
"not-selectable-in-game",
|
||||
-- "hidden" -- not added in 1.0.4
|
||||
},
|
||||
collision_mask = {}, -- nothing
|
||||
selectable_in_game = false,
|
||||
|
||||
|
||||
allow_copy_paste = false,
|
||||
|
||||
-- gui_mode = "all",
|
||||
gui_mode = "none",
|
||||
|
||||
energy_production = "0kW",
|
||||
energy_source = {
|
||||
type = "electric",
|
||||
-- buffer_capacity = "17J",
|
||||
buffer_capacity = buffer_capacity,
|
||||
-- input_flow_limit = "1kW",
|
||||
input_flow_limit = consumption,
|
||||
output_flow_limit = "0kW",
|
||||
|
||||
render_no_power_icon = false,
|
||||
-- usage_priority = "tertiary",
|
||||
usage_priority = "primary-input",
|
||||
drain = "10kW"
|
||||
},
|
||||
-- energy_usage = "10kW",
|
||||
energy_usage = energy_usage,
|
||||
icon = mod_name.."/graphics/icons/"..name..".png",
|
||||
icon_size = 32,
|
||||
max_health = 100,
|
||||
-- minable = {
|
||||
-- hardness = 0.2,
|
||||
-- mining_time = 5,
|
||||
-- results = {{used_up_name, 1},{"used-up-uranium-fuel-cell", 5}}
|
||||
-- },
|
||||
|
||||
picture = {
|
||||
filename = mod_name.."/graphics/entities/"..name..".png",
|
||||
width = 32,
|
||||
height = 32,
|
||||
priority = "low",
|
||||
},
|
||||
|
||||
collision_box = {{-0.23, -0.23}, {0.23, 0.23}},
|
||||
selection_box = {{-0.23, -0.23}, {0.23, 0.23}},
|
||||
|
||||
|
||||
-- vehicle_impact_sound = {
|
||||
-- filename = "__base__/sound/car-metal-impact.ogg",
|
||||
-- volume = 0.65
|
||||
-- }
|
||||
}
|
||||
|
||||
|
||||
})
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
BIN
ElectricResistance/graphics/entities/electric-resistance.png
Normal file
BIN
ElectricResistance/graphics/entities/electric-resistance.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 437 B |
Binary file not shown.
|
After Width: | Height: | Size: 96 B |
BIN
ElectricResistance/graphics/icons/hidden-electric-resistance.png
Normal file
BIN
ElectricResistance/graphics/icons/hidden-electric-resistance.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 437 B |
BIN
ElectricResistance/graphics/icons/no-icon.png
Normal file
BIN
ElectricResistance/graphics/icons/no-icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 250 B |
14
ElectricResistance/info.json
Normal file
14
ElectricResistance/info.json
Normal file
@@ -0,0 +1,14 @@
|
||||
{
|
||||
"name": "ElectricResistance",
|
||||
"version": "1.1.5",
|
||||
"date": "2020-11-28",
|
||||
|
||||
"title": "Electric Resistance",
|
||||
"description": "Every electric pole needs 1 kW of electric power; UPS-free",
|
||||
|
||||
"author": "darkfrei",
|
||||
"license": "MIT",
|
||||
|
||||
"dependencies": ["base"],
|
||||
"factorio_version": "1.1"
|
||||
}
|
||||
5
ElectricResistance/locale/en/locale.cfg
Normal file
5
ElectricResistance/locale/en/locale.cfg
Normal file
@@ -0,0 +1,5 @@
|
||||
[entity-name]
|
||||
hidden-electric-resistance=Electric Resistance
|
||||
|
||||
[mod-setting-name]
|
||||
electric-resistance-power-consumption=Power Consumption, kW
|
||||
10
ElectricResistance/settings.lua
Normal file
10
ElectricResistance/settings.lua
Normal file
@@ -0,0 +1,10 @@
|
||||
data:extend({
|
||||
{
|
||||
type = "int-setting",
|
||||
name = "electric-resistance-power-consumption",
|
||||
setting_type = "startup",
|
||||
minimum_value = 1,
|
||||
maximum_value = 600,
|
||||
default_value = 1
|
||||
}
|
||||
})
|
||||
53
ElectricResistance/test/data.lua
Normal file
53
ElectricResistance/test/data.lua
Normal file
@@ -0,0 +1,53 @@
|
||||
|
||||
--[[
|
||||
--from
|
||||
data.raw.ammo["firearm-magazine"].type = "ammo"
|
||||
data.raw.ammo["firearm-magazine"].name = "firearm-magazine"
|
||||
data.raw.ammo["firearm-magazine"].icon = "__base__/graphics/icons/firearm-magazine.png"
|
||||
data.raw.ammo["firearm-magazine"].icon_size = 64
|
||||
data.raw.ammo["firearm-magazine"].icon_mipmaps = 4
|
||||
data.raw.ammo["firearm-magazine"].ammo_type.category = "bullet"
|
||||
data.raw.ammo["firearm-magazine"].ammo_type.action[1].type = "direct"
|
||||
data.raw.ammo["firearm-magazine"].ammo_type.action[1].action_delivery[1].type = "instant"
|
||||
data.raw.ammo["firearm-magazine"].ammo_type.action[1].action_delivery[1].source_effects[1] = {type = "create-explosion", entity_name = "explosion-gunshot"}
|
||||
data.raw.ammo["firearm-magazine"].ammo_type.action[1].action_delivery[1].target_effects[1].type = "create-entity"
|
||||
data.raw.ammo["firearm-magazine"].ammo_type.action[1].action_delivery[1].target_effects[1].entity_name = "explosion-hit"
|
||||
data.raw.ammo["firearm-magazine"].ammo_type.action[1].action_delivery[1].target_effects[1].offsets[1] = {0, 1}
|
||||
data.raw.ammo["firearm-magazine"].ammo_type.action[1].action_delivery[1].target_effects[1].offset_deviation[1] = {-0.5, -0.5}
|
||||
data.raw.ammo["firearm-magazine"].ammo_type.action[1].action_delivery[1].target_effects[1].offset_deviation[2] = {0.5, 0.5}
|
||||
data.raw.ammo["firearm-magazine"].ammo_type.action[1].action_delivery[1].target_effects[2].type = "damage"
|
||||
data.raw.ammo["firearm-magazine"].ammo_type.action[1].action_delivery[1].target_effects[2].damage = {amount = 5, type = "physical"}
|
||||
data.raw.ammo["firearm-magazine"].magazine_size = 10
|
||||
data.raw.ammo["firearm-magazine"].subgroup = "ammo"
|
||||
data.raw.ammo["firearm-magazine"].order = "a[basic-clips]-a[firearm-magazine]"
|
||||
data.raw.ammo["firearm-magazine"].stack_size = 200
|
||||
|
||||
--to
|
||||
data.raw.item.stone.type = "item"
|
||||
data.raw.item.stone.name = "stone"
|
||||
data.raw.item.stone.icon = "__base__/graphics/icons/stone.png"
|
||||
data.raw.item.stone.icon_size = 64
|
||||
data.raw.item.stone.icon_mipmaps = 4
|
||||
data.raw.item.stone.pictures[1] = {size = 64, filename = "__base__/graphics/icons/stone.png", scale = 0.25, mipmap_count = 4}
|
||||
data.raw.item.stone.pictures[2] = {size = 64, filename = "__base__/graphics/icons/stone-1.png", scale = 0.25, mipmap_count = 4}
|
||||
data.raw.item.stone.pictures[3] = {size = 64, filename = "__base__/graphics/icons/stone-2.png", scale = 0.25, mipmap_count = 4}
|
||||
data.raw.item.stone.pictures[4] = {size = 64, filename = "__base__/graphics/icons/stone-3.png", scale = 0.25, mipmap_count = 4}
|
||||
data.raw.item.stone.subgroup = "raw-resource"
|
||||
data.raw.item.stone.order = "d[stone]"
|
||||
data.raw.item.stone.stack_size = 50
|
||||
|
||||
--]]
|
||||
|
||||
|
||||
local stone = data.raw.item.stone
|
||||
data.raw.item.stone = nil
|
||||
local ammo_stone = table.deepcopy (data.raw.ammo["firearm-magazine"])
|
||||
|
||||
|
||||
stone.type = ammo_stone.type
|
||||
stone.ammo_type = ammo_stone.ammo_type
|
||||
stone.magazine_size = ammo_stone.magazine_size
|
||||
stone.subgroup = ammo_stone.subgroup
|
||||
stone.ammo_type.action[1].action_delivery[1].target_effects[2].damage = {amount = 1, type = "physical"}
|
||||
|
||||
data:extend({stone})
|
||||
BIN
ElectricResistance/thumbnail.png
Normal file
BIN
ElectricResistance/thumbnail.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.6 KiB |
Reference in New Issue
Block a user