Skip to content

Commit

Permalink
misc space age adaptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Kiplacon committed Nov 24, 2024
1 parent 74109d3 commit 5a644b1
Show file tree
Hide file tree
Showing 10 changed files with 151 additions and 47 deletions.
14 changes: 10 additions & 4 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,13 +1,19 @@
---------------------------------------------------------------------------------------------------
Version: 2.0.2
Date: 10/26/2024
Date: 11/23/2024
Additions:
- Train Ramps now placable on elevated rails.
- Train Ramps are now placable on elevated rails. Some of the animation are jumping between normal and elevated rails are still a bit jank
- Throwing items into lava makes a cool fiery splash
Changes:
- Re-enabled system for no collision while ziplining
- Better adapted ziplining code for the 2.0 API
- Items thrown by Thrower Inserters on space platforms don't arc as if there's gravity up there
- Re-enabled system for no collision while ziplining now that I've had some time to work out the 2.0 API stuff a bit better (if anyone knows how I can transfer ownership of a construction/logistics bot between characters pls hit me up, it's the last major thing that doesn't carry over when getting on/off the zipline)
- Changed the Dynamic Range setting by wrothmonk default to true (makes modded thrower inserter range based on the original arm length instead of always being 15, pretty neat imo)
- Removed Filter Ejector Hatch
- Removed Signal Bounce Pad
Bugfixes:
- Fixed items refreshing their spoilage timer when thrown by a Thrower Inserter
- Fixed some crashes relating to taking damage/dying while ziplining
- Fixed editor mode crash caused by there being no player character in editor mode
---------------------------------------------------------------------------------------------------
Version: 2.0.1
Date: 10/26/2024
Expand Down
2 changes: 1 addition & 1 deletion control.lua
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ function(event)
storage.OnTheWay[TargetDestroyNumber][HeldItem] = 0 -- correct any miscalculaltions resulting in negative values
end
local total = storage.OnTheWay[TargetDestroyNumber][HeldItem] + catapult.held_stack.count
local inserted = properties.targets[HeldItem].insert({name=HeldItem, count=total, quality=catapult.held_stack.quality.name})
local inserted = properties.targets[HeldItem].insert({name=HeldItem, count=total, quality=catapult.held_stack.quality.name, spoil_percent=catapult.held_stack.spoil_percent})
if (inserted < total) then
catapult.active = false
else
Expand Down
25 changes: 12 additions & 13 deletions data-updates.lua
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
function sound_variations(filename_string, variations, volume_parameter, modifiers_parameter)
local result = {}
for i = 1,variations do
result[i] = { filename = filename_string .. "-" .. i .. ".ogg", volume = volume_parameter or 0.5 }
if modifiers_parameter then
result[i].modifiers = modifiers_parameter
end
end
return result
end

if aai_vehicle_exclusions then
table.insert(aai_vehicle_exclusions, "RTPropCar")
end
if (data.raw.tree.lickmaw) then
table.insert(data.raw.tree.lickmaw.minable.results, {type="item", name="RTLickmawBalls", amount=1})
data:extend({
{
type = "item",
name = "RTLickmawBalls",
icon = "__RenaiTransportation__/graphics/LickmawBALLS.png",
icon_size = 64,
subgroup = "agriculture-processes",
weight = 1000,
order = "sawcon",
stack_size = 69
}
})
table.insert(data.raw.tree.lickmaw.minable.results, {type="item", name="RTLickmawBalls", amount=1})
end
46 changes: 42 additions & 4 deletions data.lua
Original file line number Diff line number Diff line change
Expand Up @@ -233,14 +233,52 @@ data:extend({
if (feature_flags["spoiling"]) then
data:extend({
{
type = "item",
type = "capsule",
name = "RTLickmawBalls",
icon = "__RenaiTransportation__/graphics/LickmawBALLS.png",
icon_size = 64,
subgroup = "agriculture-process",
weight = 1000,
subgroup = "agriculture-processes",
default_import_location = "gleba",
fuel_category = "chemical",
fuel_value = "1MJ",
weight = 2380,
order = "bbc",
stack_size = 69
stack_size = 69,
capsule_action = {
type = "use-on-self",
attack_parameters =
{
type = "projectile",
activation_type = "consume",
ammo_category = "capsule",
cooldown = 120,
range = 0,
ammo_type =
{
target_type = "position",
action =
{
type = "direct",
action_delivery =
{
type = "instant",
target_effects =
{
{
type = "damage",
damage = {type = "physical", amount = -125},
use_substitute = false
},
{
type = "play-sound",
sound = {"__base__/sound/eat-1.ogg"},
}
}
}
}
}
}
}
}
})
end
32 changes: 30 additions & 2 deletions prototypes/TrainGoBrrrr/prototypes/ramps.lua
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,9 @@ if feature_flags["rail_bridges"] then
{
type = "simple-entity-with-owner", -- Simplist entity that has 4 diections of sprites
name = "RTTrainRamp-Elevated"..variant[1],
icon = '__RenaiTransportation__/graphics/TrainRamp/RTTrainRamp-elevated-icon.png',
localised_name = {"entity-name.RTTrainRamp"},
localised_description = {"entity-description.RTTrainRamp"},
icon = '__RenaiTransportation__/graphics/TrainRamp/RTTrainRamp-icon.png',
icon_size = 64,
flags = {"player-creation", "not-on-map", "not-rotatable", "placeable-off-grid"},
hidden = true,
Expand All @@ -254,7 +256,33 @@ if feature_flags["rail_bridges"] then
collision_mask = {layers={["elevated_train"]=true}},
render_layer = "elevated-object",
picture = {
filename = '__RenaiTransportation__/graphics/TrainRamp/' .. "RTTrainRamp" .. '.png',
filename = '__RenaiTransportation__/graphics/TrainRamp/RTTrainRamp.png',
width = 200,
height = 200,
y = variant[4],
shift = util.mul_shift(constants.PLACER_TO_RAMP_SHIFT_BY_DIRECTION[variant[5]..constants.elevated], -1)
},
placeable_by = { item = "RTTrainRampItem", count = 1 }, -- Controls `q` and blueprint behavior
resistances = {{type = "impact", percent = 100}},
},
{
type = "simple-entity-with-owner", -- Simplist entity that has 4 diections of sprites
name = "RTTrainRamp-Elevated"..variant[1].."NoSkip",
localised_name = {"entity-name.RTTrainRampNoSkip"},
localised_description = {"entity-description.RTTrainRampNoSkip"},
icon = '__RenaiTransportation__/graphics/TrainRamp/RTTrainRamp-icon.png',
icon_size = 64,
flags = {"player-creation", "not-on-map", "not-rotatable", "placeable-off-grid"},
hidden = true,
minable = {mining_time = 0.5, result = "RTTrainRampItem"},
max_health = 500,
selection_box = variant[2],
selection_priority = 100,
collision_box = variant[3],
collision_mask = {layers={["elevated_train"]=true}},
render_layer = "elevated-object",
picture = {
filename = '__RenaiTransportation__/graphics/TrainRamp/RTTrainRampNoSkip.png',
width = 200,
height = 200,
y = variant[4],
Expand Down
2 changes: 1 addition & 1 deletion script/event/entity_built.lua
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ local function entity_built(event)
properties.RangeAdjustable = true
end

if (string.find(entity.surface.name, " Orbit") or string.find(entity.surface.name, " Field") or string.find(entity.surface.name, " Belt")) then
if (entity.surface.platform or string.find(entity.surface.name, " Orbit") or string.find(entity.surface.name, " Field") or string.find(entity.surface.name, " Belt")) then
properties.InSpace = true
end

Expand Down
61 changes: 45 additions & 16 deletions script/event/interact.lua
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ local function interact(event1) -- has .name = event ID number, .tick = tick num
local ElForce = player.force
local ElDirection = ThingHovering.direction
local ElSurface = ThingHovering.surface
local OldRange = storage.MagnetRamps[script.register_on_object_destroyed(ThingHovering)].range-3
ThingHovering.destroy()
local NewKid = ElSurface.create_entity
({
Expand All @@ -158,19 +157,11 @@ local function interact(event1) -- has .name = event ID number, .tick = tick num
position=player.position,
volume_modifier=1
}
local RampDestroyNumber = script.register_on_object_destroyed(NewKid)
local RampProperties = storage.MagnetRamps[RampDestroyNumber]
magnetRamps.setRange(
RampProperties,
OldRange,
player
)
elseif (ThingHovering.name == "RTTrainRampNoSkip") then
local ElPosition = ThingHovering.position
local ElForce = player.force
local ElDirection = ThingHovering.direction
local ElSurface = ThingHovering.surface
local OldRange = storage.MagnetRamps[script.register_on_object_destroyed(ThingHovering)].range-3
ThingHovering.destroy()
local NewKid = ElSurface.create_entity
({
Expand All @@ -187,13 +178,51 @@ local function interact(event1) -- has .name = event ID number, .tick = tick num
position=player.position,
volume_modifier=1
}
local RampDestroyNumber = script.register_on_object_destroyed(NewKid)
local RampProperties = storage.MagnetRamps[RampDestroyNumber]
magnetRamps.setRange(
RampProperties,
OldRange,
player
)

--|| Swap Elevated Ramp Modes
elseif (string.find(ThingHovering.name, "-Elevated") ~= nil and string.find(ThingHovering.name, "NoSkip") == nil) then
local ElPosition = ThingHovering.position
local ElForce = player.force
local ElDirection = ThingHovering.direction
local ElSurface = ThingHovering.surface
local NewKid = ElSurface.create_entity
({
name = ThingHovering.name.."NoSkip",
position = ElPosition,
direction = ElDirection,
force = ElForce,
raise_built = true,
create_build_effect_smoke = false
})
player.play_sound
{
path="utility/rotated_large",
position=player.position,
volume_modifier=1
}
ThingHovering.destroy()
elseif (string.find(ThingHovering.name, "-Elevated") ~= nil and string.find(ThingHovering.name, "NoSkip") ~= nil) then
local ElPosition = ThingHovering.position
local ElForce = player.force
local ElDirection = ThingHovering.direction
local ElSurface = ThingHovering.surface
local NewKid = ElSurface.create_entity
({
name = string.gsub(ThingHovering.name, "NoSkip", ""),
position = ElPosition,
direction = ElDirection,
force = ElForce,
raise_built = true,
create_build_effect_smoke = false
})
player.play_sound
{
path="utility/rotated_large",
position=player.position,
volume_modifier=1
}
ThingHovering.destroy()

--|| Swap Magnet Ramp Modes
elseif (ThingHovering.name == "RTMagnetTrainRamp") then
local ElPosition = ThingHovering.position
Expand Down
10 changes: 7 additions & 3 deletions script/trains/animation.lua
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ function Animation.updateOffsets(properties, height, elapsed)
end

function Animation.updateRotation(properties, elapsed, height)
--y=0.05\cdot\left(\left(2x-1\right)^{23}-\left(2x-1\right)\right)
local SpinMagnitude = properties.SpinMagnitude or 0.05
local SpinSpeed = properties.SpinSpeed or 23
local test = properties.test or 2
Expand All @@ -49,9 +50,6 @@ function Animation.updateRotation(properties, elapsed, height)
local spinPercent = (test * completedPercent) - 1 -- double the rotation arc and center it on 0, aka upright
local spinScale = (spinPercent ^ SpinSpeed) - spinPercent
local spinAmount = SpinMagnitude * spinScale
if (completedPercent > 1) then
spinAmount = -0.042
end

if (properties.RampOrientation == 0.75 or properties.RampOrientation == 0) then
-- Going right or down, reverse spin
Expand All @@ -63,9 +61,15 @@ function Animation.updateRotation(properties, elapsed, height)
-- Spin amount plus 0.5 so the shadows orient north/south
--properties.TrainImageID.orientation = -0.25
--properties.MaskID.orientation = -0.25
if (completedPercent > 0.93) then
spinAmount = properties.ShadowID.orientation
end
properties.ShadowID.orientation = spinAmount
else
-- going left or right, spin the cars
if (completedPercent > 0.93) then
spinAmount = properties.TrainImageID.orientation
end
properties.TrainImageID.orientation = spinAmount
properties.MaskID.orientation = spinAmount
end
Expand Down
4 changes: 2 additions & 2 deletions script/trains/entity_built.lua
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ local util = require('util')
local constants = require('constants')
local magnetRampsStuff = require("__RenaiTransportation__/script/trains/magnet_ramps")

local function handleMagnetRampBuilt(entity)
local function handleMagnetRampBuilt(entity, player)
local OnDestroyNumber = script.register_on_object_destroyed(entity)
storage.MagnetRamps[OnDestroyNumber] = {entity = entity, tiles = {}}
entity.rotatable = false
Expand Down Expand Up @@ -96,7 +96,7 @@ local function on_entity_built(entity, player)
handleTrainRampPlacerBuilt(entity)
return true
elseif (entity.name == "RTMagnetTrainRamp" or entity.name == "RTMagnetTrainRampNoSkip") then
handleMagnetRampBuilt(entity)
handleMagnetRampBuilt(entity, player)
return true
end

Expand Down
2 changes: 1 addition & 1 deletion settings.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ data:extend({
type = "bool-setting",
name = "RTThrowersDynamicRange",
setting_type = "startup",
default_value = false,
default_value = true,
order = "ab"
},
{
Expand Down

0 comments on commit 5a644b1

Please sign in to comment.