1
0
mirror of https://github.com/veden/Rampant.git synced 2025-01-05 22:53:24 +02:00
Rampant/prototypes/EnergyThief.lua

286 lines
9.8 KiB
Lua
Raw Normal View History

2022-01-15 00:08:58 +02:00
-- Copyright (C) 2022 veden
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <https://www.gnu.org/licenses/>.
2019-02-13 07:50:25 +02:00
-- imports
local thiefUtils = require("utils/ThiefUtils")
-- constants
local energyThief = {}
-- imported functions
local makeDrainCrystal = thiefUtils.makeDrainCrystal
function energyThief.addFactionAddon()
2019-02-13 07:50:25 +02:00
data:extend({
2019-02-19 02:43:01 +02:00
{
type = "simple-entity-with-force",
name = "drain-trigger-rampant",
render_layer = "object",
icon = "__base__/graphics/icons/steel-chest.png",
icon_size = 32,
flags = {"placeable-neutral", "player-creation"},
order = "s-e-w-f",
minable = {mining_time = 1, result = "drain-trigger-rampant"},
max_health = 100,
selectable_in_game = false,
corpse = nil,
2019-02-19 02:43:01 +02:00
collision_box = {{-0.35, -0.35}, {0.35, 0.35}},
selection_box = {{-0.5, -0.5}, {0.5, 0.5}},
picture =
{
filename = "__core__/graphics/empty.png",
priority = "extra-high",
2019-02-28 04:53:59 +02:00
width = 1,
height = 1,
shift = {0, 0}
2019-02-19 02:43:01 +02:00
}
},
{
type = "item",
name = "drain-trigger-rampant",
icon = "__Rampant__/graphics/icons/thief/crystal-drain.png",
icon_size = 32,
2020-03-22 03:27:42 +02:00
icon_mipmaps = 1,
2019-04-09 05:04:00 +02:00
flags = {"hidden"},
2019-02-19 02:43:01 +02:00
subgroup = "energy",
order = "e[accumulator]-a[accumulator]",
place_result = "drain-trigger-rampant",
stack_size = 50
},
2019-02-13 07:50:25 +02:00
{
type = "item",
name = "crystal-drain-pole-rampant",
icon = "__Rampant__/graphics/icons/thief/crystal-drain.png",
icon_size = 32,
2020-03-22 03:27:42 +02:00
icon_mipmaps = 1,
2019-04-09 05:04:00 +02:00
flags = {"hidden"},
2019-02-13 07:50:25 +02:00
subgroup = "energy",
order = "e[accumulator]-a[accumulator]",
place_result = "crystal-drain-pole-rampant",
stack_size = 50
},
{
type = "electric-pole",
name = "crystal-drain-pole-rampant",
icon = "__Rampant__/graphics/icons/thief/crystal-drain.png",
icon_size = 32,
2020-03-22 03:27:42 +02:00
icon_mipmaps = 1,
2019-04-09 05:04:00 +02:00
flags = {"hidden"},
2019-02-19 02:43:01 +02:00
selectable_in_game = false,
2019-02-13 07:50:25 +02:00
minable = {hardness = 0.2, mining_time = 0.5, result = "big-electric-pole"},
2019-02-19 02:43:01 +02:00
max_health = 750,
2019-02-13 07:50:25 +02:00
healing_per_tick = 0.02,
corpse = nil,
2019-02-13 07:50:25 +02:00
resistances =
{
2019-02-19 02:43:01 +02:00
{
type = "physical",
percent = 25
},
2019-02-13 07:50:25 +02:00
{
type = "fire",
2019-02-19 02:43:01 +02:00
percent = 85
2019-02-13 07:50:25 +02:00
},
{
type = "electric",
2019-02-19 02:43:01 +02:00
percent = 95
2019-02-13 07:50:25 +02:00
},
{
type = "laser",
2019-02-19 02:43:01 +02:00
percent = 90
2019-02-13 07:50:25 +02:00
}
},
collision_box = {{-0.55, -0.55}, {0.55, 0.55}},
selection_box = {{-0.55, -0.55}, {0.55, 0.55}},
drawing_box = {{-1, -3}, {1, 0.5}},
maximum_wire_distance = 30,
supply_area_distance = 9,
vehicle_impact_sound = { filename = "__base__/sound/car-metal-impact.ogg", volume = 0.65 },
pictures =
{
filename = "__Rampant__/graphics/entities/thief/crystal-drain-pole.png",
priority = "high",
width = 168,
height = 130,
direction_count = 4,
shift = {1.6, -1.4}
},
connection_points =
{
{
shadow =
{
copper = {2.7, 0},
green = {1.8, 0},
red = {3.6, 0}
},
wire =
{
copper = {0, -2.5},
green = {-0.59375, -2.5},
red = {0.625, -2.5}
}
},
{
shadow =
{
copper = {3.1, 0.2},
green = {2.3, -0.3},
red = {3.8, 0.6}
},
wire =
{
copper = {-0.0625, -2.5},
green = {-0.5, -3},
red = {0.34375, -2}
}
},
{
shadow =
{
copper = {2.9, 0.06},
green = {3.0, -0.6},
red = {3.0, 0.8}
},
wire =
{
copper = {-0.09375, -2.5},
green = {-0.09375, -3},
red = {-0.09375, -2}
}
},
{
shadow =
{
copper = {3.1, 0.2},
green = {3.8, -0.3},
red = {2.35, 0.6}
},
wire =
{
copper = {-0.0625, -2.4},
green = {0.375, -2.9},
red = {-0.46875, -2.4}
}
}
},
radius_visualisation_picture =
{
filename = "__base__/graphics/entity/small-electric-pole/electric-pole-radius-visualization.png",
width = 12,
height = 12,
priority = "extra-high-no-scale"
}
}
})
2019-02-19 02:43:01 +02:00
local chest = util.table.deepcopy(data.raw["radar"]["radar"])
chest.name = "pylon-target-rampant"
chest.icon = "__Rampant__/graphics/icons/thief/crystal-drain.png"
2019-11-02 22:57:36 +02:00
chest.icon_size = 32
chest.corpse = nil
2020-03-22 03:27:42 +02:00
chest.icon_mipmaps = 1
2019-04-09 05:04:00 +02:00
chest.flags = {"not-repairable", "not-on-map", "hidden"}
chest.subgroup = "enemies"
chest.next_upgrade = nil
2020-04-28 05:41:18 +02:00
chest.backer_name = false
data.raw["simple-entity-with-force"]["drain-trigger-rampant"].dying_explosion = chest.dying_explosion
2019-02-19 02:43:01 +02:00
chest.pictures = {
layers={
{
filename = "__Rampant__/graphics/entities/thief/crystal-drain-pole.png",
priority = "high",
width = 168,
height = 130,
direction_count = 4,
shift = {1.6, -1.4}
2019-02-19 02:43:01 +02:00
}
}}
chest.max_health = 750
chest.resistances =
{
{
type = "physical",
percent = 25
},
{
type = "fire",
percent = 85
},
{
type = "electric",
percent = 95
},
{
type = "laser",
percent = 90
}
}
chest.energy_usage = "500kW"
-- chest.collision_mask = {}
chest.collision_box = nil
chest.selection_box = {{-0.55, -0.55}, {0.55, 0.55}}
chest.minable.result = "pylon-target-rampant"
chest.working_sound = {
sound = {
{
filename = "__base__/sound/accumulator-working.ogg"
}
},
apparent_volume = 2,
}
data:extend({
chest,
{
type = "item",
name = "pylon-target-rampant",
icon = "__Rampant__/graphics/icons/thief/crystal-drain.png",
icon_size = 32,
2020-03-22 03:27:42 +02:00
icon_mipmaps = 1,
2019-04-09 05:04:00 +02:00
flags = {"hidden"},
subgroup = "enemies",
2019-02-19 02:43:01 +02:00
order = "a[items]-h[steel-collector]",
place_result = "pylon-target-rampant",
stack_size = 50
}
})
2019-02-13 07:50:25 +02:00
for i=1,10 do
local drainCrystalAttributes = {
name = "crystal-v" .. i,
2019-02-19 02:43:01 +02:00
drain = i * 1.3 .. "MW",
2019-02-13 07:50:25 +02:00
scale = (i * 0.1) + 0.5,
2019-02-19 02:43:01 +02:00
health = 400 * i
2019-02-13 07:50:25 +02:00
}
makeDrainCrystal(drainCrystalAttributes)
end
end
return energyThief