Skip to content

Commit

Permalink
Merge pull request #4 from undarl/master
Browse files Browse the repository at this point in the history
Round 2: New Charging Poles
  • Loading branch information
avosirenfal authored Apr 19, 2017
2 parents 700c885 + ac2aa2a commit b903220
Show file tree
Hide file tree
Showing 8 changed files with 497 additions and 31 deletions.
27 changes: 21 additions & 6 deletions Localized_Charging_1.0.0/control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,25 @@ script.on_init(function()
end)

local charging_info = {
["localized-charging-pole"] = {
['interface'] = 'localized-charging-pole-interface',
['range'] = 10,
['efficiency'] = 0.5,
["localized-charging-pole-1"] = {
['interface'] = 'localized-charging-pole-interface-1',
['range'] = 10,
['efficiency'] = 0.5,
},
["localized-charging-pole-2"] = {
['interface'] = 'localized-charging-pole-interface-2',
['range'] = 10,
['efficiency'] = 0.5,
},
["localized-charging-pole-3"] = {
['interface'] = 'localized-charging-pole-interface-3',
['range'] = 10,
['efficiency'] = 0.5,
},
["localized-charging-pole-4"] = {
['interface'] = 'localized-charging-pole-interface-4',
['range'] = 10,
['efficiency'] = 0.5,
},
}

Expand Down Expand Up @@ -240,7 +255,7 @@ local function on_entity_created(entity)
if(charging_info[entity.name] ~= nil) then
local uid = entity.unit_number
local interface = entity.surface.create_entity{
name = "localized-charging-pole-interface",
name = charging_info[entity.name].interface,
position = {entity.position['x'], entity.position['y']},
-- stop ai in everything mode from attacking this invulnerable building
force=game.forces['enemy'] --entity.force
Expand Down Expand Up @@ -313,4 +328,4 @@ end)
-- entity.energy = entity.energy + 1000
-- game.print('added: ' .. tostring(entity.energy - current))
-- end
-- end)
-- end)
7 changes: 5 additions & 2 deletions Localized_Charging_1.0.0/locale/en.cfg
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
[entity-name]
localized-charging-pole=Localized Charging Pole
localized-charging-pole-1=Localized Charging Pole (2.5MW/s)
localized-charging-pole-2=Localized Charging Pole (5MW/s)
localized-charging-pole-3=Localized Charging Pole (10MW/s)
localized-charging-pole-4=Localized Charging Pole (20MW/s)

[vehicles]
electric-locomotive=Electric Locomotive
Expand All @@ -10,4 +13,4 @@ voltage-wireless-energy-distribution=Wireless Energy Distribution

[technology-description]
voltage-electric-trains=Higher powered trains that run off of electric batteries.
voltage-wireless-energy-distribution=A powerful charging system that will charge nearby power armor and certain electric vehicles at 20MW/s. It will use 40MW/s because the charging is inefficient.
voltage-wireless-energy-distribution=A powerful charging system that will charge nearby power armor and certain electric vehicles at between 2.5 and 20MW/s, depending on the charging pole used. It will use twice the amount charged because the charging is inefficient.
12 changes: 12 additions & 0 deletions Localized_Charging_1.0.0/migrations/Localized_Charging_1.0.0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
{
"entity":
[
["localized-charging-pole-interface", "localized-charging-pole-interface-4"],
["localized-charging-pole", "localized-charging-pole-4"]
],

"item":
[
["localized-charging-pole", "localized-charging-pole-4"]
]
}
10 changes: 10 additions & 0 deletions Localized_Charging_1.0.0/migrations/Localized_Charging_1.0.0.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
for i, force in pairs(game.forces) do
force.reset_recipes()
force.reset_technologies()
if force.technologies["voltage-wireless-energy-distribution"].researched then
force.recipes["localized-charging-pole-1"].enabled = true
force.recipes["localized-charging-pole-2"].enabled = true
force.recipes["localized-charging-pole-3"].enabled = true
force.recipes["localized-charging-pole-4"].enabled = true
end
end
Loading

0 comments on commit b903220

Please sign in to comment.