Skip to content

Commit

Permalink
Merge pull request #41 from Kiplacon/pre-1.2.0-reskinned
Browse files Browse the repository at this point in the history
Pre 1.2.0 reskinned
  • Loading branch information
Kiplacon authored Apr 29, 2023
2 parents fcf7b60 + b0e8372 commit 890f73a
Show file tree
Hide file tree
Showing 19 changed files with 671 additions and 454 deletions.
15 changes: 13 additions & 2 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,11 +1,22 @@
---------------------------------------------------------------------------------------------------
Version: 1.2.0
Date: 4/25/2023
Date: 4/28/2023
Additions:
- When the Focused Flinging tech is researched, thrower inserters can have their range adjusted via circuit signals with the new "Thrower Range" signal.
Changes:
- Throwing an Ironclad ship from the "AAI Vehicles: Ironclad" mod into the water now builds one on landing. Maybe one day I can generalize this to work for all vehicles. Specifically requested by toran.mallow
- Performance improvements when using tons (like thousands) of throwers at a time. My test map with 2000 throwers improved from 26 to 55 fps. Thanks to everyone on Reddit who commented on my thread: https://www.reddit.com/r/factorio/comments/12yj35v/codingwise_how_can_i_reduce_lag_from_my_mod/
- Unfortunately this new method means thrown items don't randomly tumble anymore :(
- Changed the Primer Thrower Inserter's minimum range from 5 -> 25 to help prevent friendly fire. It can still lead shots that end up behind its targeting range though, that's just how turrets are coded to work. Requested by DoshDoshington
- Manual adjustments to the base Rocket, Cannon Shell, and Uranium Cannon Shell primed projectile to be AOE on impact so that they can actually do damage. Requested by DoshDoshington
- Changed the way primed projectiles are generated so that I hopefully don't miss as many effects, like the Artillery Shell scortch marks.
- Made the Train Bounce Pad detection radius a bit more generous.
- Turned on the drop position arrow for the Ejector Hatch. I don't remember turning it off in the first place tbh but apparently I did.
- Throwing an Ironclad ship from the "AAI Vehicles: Ironclad" mod into the water now builds one on landing. Maybe one day I can generalize this to work for all vehicles. Oddly specific request by toran.mallow
Bugfixes:
- Fixed that Ejector Hatches couldn't be connected to circuit wire. Apparently I just missed adding that part in lol. Reported by ShatteredShadow.
- Fixed that the Player Launcher had the wrong sprite in standard graphics mode. Reported by GNeutrality
- Fixed that locomotive color wasn't carried over to the jumping train sprite
- Fixed that jumping train sprites would shrink in scale when bounced left or right
---------------------------------------------------------------------------------------------------
Version: 1.1.11
Date: 3/7/2023
Expand Down
402 changes: 212 additions & 190 deletions control.lua

Large diffs are not rendered by default.

301 changes: 165 additions & 136 deletions data-final-fixes.lua
Original file line number Diff line number Diff line change
@@ -1,110 +1,135 @@
function MakeProjectile(ThingData)

TheProjectile = table.deepcopy(data.raw.stream["acid-stream-spitter-small"])
TheProjectile.name = ThingData.name.."-projectileFromRenaiTransportation"
TheProjectile.special_neutral_target_damage = {amount = 0, type = "acid"}
--TheProjectile.scale = 5 --does nothing as far as i can tell
--TheProjectile.particle_buffer_size = 90
TheProjectile.particle_spawn_interval = 0
TheProjectile.particle_spawn_timeout = 0
TheProjectile.particle_vertical_acceleration = 0.0035 -- gravity, default 0.0045
if (ThingData.name == "MaybeIllBeTracer") then
TheProjectile.particle_horizontal_speed = 10
TheProjectile.shadow = nil
else
TheProjectile.particle_horizontal_speed = 0.18 -- speed, default 0.3375
end

TheProjectile.particle_horizontal_speed_deviation = 0
--TheProjectile.particle_start_alpha = 0.5
--TheProjectile.particle_end_alpha = 1
--TheProjectile.particle_alpha_per_part = 0.8
--TheProjectile.particle_scale_per_part = 0.8
--TheProjectile.particle_loop_frame_count = 15
--TheProjectile.particle_fade_out_duration = 2
--TheProjectile.particle_loop_exit_threshold = 0.25

TheProjectile.working_sound = nil

TheProjectile.initial_action =
{
type = "direct",
action_delivery =
function MakeProjectile(ThingData, speed)
local TheProjectile =
{
type = "instant",
target_effects =
{
{
type = "script",
effect_id = ThingData.name.."-LandedRT"
}
}
type = "stream",
name = "RTItemProjectile-"..ThingData.name..(speed*100 or 18),
flags = {"not-on-map"},
particle_spawn_interval = 0,
particle_spawn_timeout = 0,
particle_vertical_acceleration = 0.0035,
particle_horizontal_speed = speed or 0.18,
particle_horizontal_speed_deviation = 0,
particle =
{
layers =
{
{
filename = "__RenaiTransportation__/graphics/icon.png",
line_length = 1,
frame_count = 1,
priority = "high",
size = 32,
scale = 19.2/32
}
}
},
shadow =
{
layers =
{
{
filename = "__RenaiTransportation__/graphics/icon.png",
line_length = 1,
frame_count = 1,
priority = "high",
size = 32,
scale = 19.2/32,
tint = {0,0,0,0.5}
}
}
},
oriented_particle = true,
--shadow_scale_enabled = true
}
}

if (ThingData.icons) then
if (ThingData.icon_size) then
TheProjectile.particle.size = ThingData.icon_size
else
TheProjectile.particle.size = ThingData.icons[1].icon_size
end

TheProjectile.particle.layers = {}
for iconlayer, iconspecs in pairs(ThingData.icons) do
if (iconspecs.icon_size) then
eeee = iconspecs.icon_size
if (ThingData.icons) then
if (ThingData.icon_size) then
TheProjectile.particle.size = ThingData.icon_size
else
eeee = TheProjectile.particle.size
end

if (iconspecs.tint) then
rrrr = iconspecs.tint
else
rrrr = nil
TheProjectile.particle.size = ThingData.icons[1].icon_size
end

table.insert(TheProjectile.particle.layers,
{
filename = iconspecs.icon,
line_length = 1,
frame_count = 1,
priority = "high",
scale = 19.2/eeee,
size = eeee,
tint = rrrr
})
end
TheProjectile.particle.layers = {}
TheProjectile.shadow.layers = {}
for iconlayer, iconspecs in pairs(ThingData.icons) do
local eeee
local rrrr
if (iconspecs.icon_size) then
eeee = iconspecs.icon_size
else
eeee = TheProjectile.particle.size
end

elseif (ThingData.icon) then
TheProjectile.particle = {
filename = ThingData.icon,
line_length = 1,
width = ThingData.icon_size,
height = ThingData.icon_size,
frame_count = 1,
--shift = util.mul_shift(util.by_pixel(-2, 30), data.scale),
--tint = data.tint,
priority = "high",
scale = 19.2/ThingData.icon_size --0.3 of a tile
--animation_speed = 1,
}
else
TheProjectile.particle = {
filename = "__RenaiTransportation__/graphics/icon.png",
line_length = 1,
width = 32,
height = 32,
frame_count = 1,
--shift = util.mul_shift(util.by_pixel(-2, 30), data.scale),
--tint = data.tint,
priority = "high",
scale = 19.2/32 --0.3 of a tile
--animation_speed = 1,
}
end
if (iconspecs.tint) then
rrrr = iconspecs.tint
else
rrrr = nil
end

TheProjectile.spine_animation = nil
table.insert(TheProjectile.particle.layers,
{
filename = iconspecs.icon,
line_length = 1,
frame_count = 1,
priority = "high",
scale = 19.2/eeee,
size = eeee,
tint = rrrr
})
table.insert(TheProjectile.shadow.layers,
{
filename = iconspecs.icon,
line_length = 1,
frame_count = 1,
priority = "high",
scale = 19.2/eeee,
size = eeee,
tint = {0,0,0,0.5}
})
end

elseif (ThingData.icon) then
TheProjectile.particle =
{
filename = ThingData.icon,
line_length = 1,
width = ThingData.icon_size,
height = ThingData.icon_size,
frame_count = 1,
--shift = util.mul_shift(util.by_pixel(-2, 30), data.scale),
--tint = data.tint,
priority = "high",
scale = 19.2/ThingData.icon_size --0.3 of a tile
--animation_speed = 1,
}
TheProjectile.shadow =
{
filename = ThingData.icon,
line_length = 1,
width = ThingData.icon_size,
height = ThingData.icon_size,
frame_count = 1,
--shift = util.mul_shift(util.by_pixel(-2, 30), data.scale),
tint = {0,0,0,0.5},
priority = "high",
scale = 19.2/ThingData.icon_size --0.3 of a tile
--animation_speed = 1,
}
else
TheProjectile.particle =
{
filename = "__RenaiTransportation__/graphics/icon.png",
line_length = 1,
width = 32,
height = 32,
frame_count = 1,
--shift = util.mul_shift(util.by_pixel(-2, 30), data.scale),
--tint = data.tint,
priority = "high",
scale = 19.2/32 --0.3 of a tile
--animation_speed = 1,
}
end
data:extend({TheProjectile})
end

Expand All @@ -120,14 +145,10 @@ TheProjectile = table.deepcopy(data.raw.stream["acid-stream-spitter-small"])
TheProjectile.particle_horizontal_speed = 0.3 -- speed, default 0.3375
TheProjectile.particle_horizontal_speed_deviation = 0
TheProjectile.working_sound = nil


TheProjectile.lead_target_for_projectile_speed = 0.2* 0.75 * 1.5 *1.5


-- convert respective action to the primed projectile
if (ThingData.ammo_type and ThingData.ammo_type.category == "cannon-shell") then -- tank shells
TheProjectile.initial_action = data.raw.projectile[ThingData.ammo_type.action.action_delivery.projectile].final_action

TheProjectile.initial_action = {data.raw.projectile[ThingData.ammo_type.action.action_delivery.projectile].action, data.raw.projectile[ThingData.ammo_type.action.action_delivery.projectile].final_action}
elseif (ThingData.capsule_action) then --capsules with thrown actions: grenades, combat robots, poison, slowdown
if (ThingData.capsule_action.attack_parameters.ammo_type.action[1]) then
TheProjectile.initial_action = data.raw.projectile[ThingData.capsule_action.attack_parameters.ammo_type.action[1].action_delivery.projectile].action
Expand All @@ -136,27 +157,33 @@ TheProjectile = table.deepcopy(data.raw.stream["acid-stream-spitter-small"])
end
elseif (data.raw["land-mine"][ThingData.place_result]) then --landmines
TheProjectile.initial_action =
{
type = "direct",
action_delivery =
{
type = "direct",
action_delivery =
{
type = "instant",
target_effects =
{
type = "instant",
target_effects =
{
{
type = "create-entity",
entity_name = ThingData.place_result --ThingData.name
}
}
{
type = "create-entity",
entity_name = ThingData.place_result --ThingData.name
}
}

}
}
}
elseif (ThingData.ammo_type.action.action_delivery.type == "artillery") then -- artillery
TheProjectile.initial_action = data.raw["artillery-projectile"][ThingData.ammo_type.action.action_delivery.projectile].action

TheProjectile.initial_action = {data.raw["artillery-projectile"][ThingData.ammo_type.action.action_delivery.projectile].action, data.raw["artillery-projectile"][ThingData.ammo_type.action.action_delivery.projectile].final_action}
else -- rockets/atomic bombs/other
TheProjectile.initial_action = data.raw.projectile[ThingData.ammo_type.action.action_delivery.projectile].action

TheProjectile.initial_action = {data.raw.projectile[ThingData.ammo_type.action.action_delivery.projectile].action, data.raw.projectile[ThingData.ammo_type.action.action_delivery.projectile].final_action}
end
-- specific whitelist of single-target projectiles (base rocket/cannon shell) to AOE
if (ThingData.name == "rocket"
or ThingData.name == "cannon-shell"
or ThingData.name == "uranium-cannon-shell") then
for sbeve, effect in pairs(TheProjectile.initial_action) do
effect.type = "area"
effect.radius = 3
end
end

if (ThingData.icons) then
Expand Down Expand Up @@ -186,17 +213,18 @@ if (ThingData.icons) then
})
end
else
TheProjectile.particle = {
filename = ThingData.icon,
line_length = 1,
width = ThingData.icon_size,
height = ThingData.icon_size,
frame_count = 1,
tint = {255,70,70},
--shift = util.mul_shift(util.by_pixel(-2, 30), data.scale),
priority = "high",
scale = 19.2/ThingData.icon_size --0.3
--animation_speed = 1,
TheProjectile.particle =
{
filename = ThingData.icon,
line_length = 1,
width = ThingData.icon_size,
height = ThingData.icon_size,
frame_count = 1,
tint = {255,70,70},
--shift = util.mul_shift(util.by_pixel(-2, 30), data.scale),
priority = "high",
scale = 19.2/ThingData.icon_size --0.3
--animation_speed = 1,
}
end
TheProjectile.spine_animation = nil
Expand Down Expand Up @@ -262,7 +290,7 @@ end
type = "stream",
--damage_modifier = damage_modifier_worm_big,--defined in spitter-projectiles.lua
cooldown = 4,
range = 46,--defined in spitter-projectiles.lua
range = 51,--defined in spitter-projectiles.lua
min_range = 4,
turn_range = 0.155,
--projectile_creation_parameters = worm_shoot_shiftings(scale_worm_big, scale_worm_big * scale_worm_stream),
Expand Down Expand Up @@ -738,14 +766,15 @@ for Category, ThingsTable in pairs(data.raw) do
for ThingID, ThingData in pairs(ThingsTable) do
if (ThingData.stack_size) then
log("Creating item projectile for "..ThingData.type..": "..ThingData.name)
-- MakeProjectile(ThingData)

MakeProjectile(ThingData, 0.18)
MakeProjectile(ThingData, 0.25)
MakeProjectile(ThingData, 0.6)
if (settings.startup["RTBounceSetting"].value == true) then
if (ThingData.type == "ammo" -- looking for things like rockets, tank shells, missles, etc
and ThingData.ammo_type.action --if this ammo does something
and ThingData.ammo_type.action.action_delivery --in the form of
and (ThingData.ammo_type.action.action_delivery.type == "projectile" --a projectile
or ThingData.ammo_type.action.action_delivery.type == "artillery") --artillery gets its own projectile catagory
or ThingData.ammo_type.action.action_delivery.type == "artillery") --artillery has its own projectile catagory
) then
MakePrimedProjectile(ThingData)
elseif
Expand Down
Loading

0 comments on commit 890f73a

Please sign in to comment.