From 56aa735a882e64f9717ebfe975ba5fe0757a8802 Mon Sep 17 00:00:00 2001 From: James Panther <4462786+jpanther@users.noreply.github.com> Date: Tue, 19 Mar 2019 11:20:25 +1100 Subject: [PATCH] Add custom speed modifier to Painted concrete - Fixes #91 --- changelog.txt | 1 + config.lua | 1 + locale/en/dectorio.cfg | 2 ++ prototypes/tile/tiles.lua | 20 ++++++++++++++++---- settings.lua | 9 +++++++++ 5 files changed, 29 insertions(+), 4 deletions(-) diff --git a/changelog.txt b/changelog.txt index d47bb30..63ab0ba 100644 --- a/changelog.txt +++ b/changelog.txt @@ -3,6 +3,7 @@ Version: 0.9.8 Date: 19. 03. 2019 Added: - Lawnmower can now be used to remove corpses by invoking alternate selection mode (by default, by holding down SHIFT key when selecting an area) + - New setting to adjust walking and vehicle speeds of Painted concrete by a custom amount, allowing concrete to be used as a safety barrier around hazards (by default, this option is off) --------------------------------------------------------------------------------------------------- Version: 0.9.7 Date: 14. 03. 2019 diff --git a/config.lua b/config.lua index 6d2d1df..c9b9638 100644 --- a/config.lua +++ b/config.lua @@ -111,6 +111,7 @@ DECT.ITEM_GROUP = DECT.ENABLED["item-group"] and "dectorio" or "logistics" DECT.CONFIG.SETTINGS = { ["decorative_removal_probability"] = settings.startup["dectorio-decorative-removal-probability"].value, ["vanilla_hazard_concrete"] = settings.startup["dectorio-vanilla-hazard-concrete-style"].value, + ["painted_concrete_speed_modifier"] = settings.startup["dectorio-painted-concrete-speed-modifier"].value, ["landscaping_blueprintable"] = settings.startup["dectorio-landscaping-blueprintable"].value, ["flooring_stack_size"] = settings.startup["dectorio-flooring-stack-size"].value, ["landscaping_stack_size"] = settings.startup["dectorio-landscaping-stack-size"].value, diff --git a/locale/en/dectorio.cfg b/locale/en/dectorio.cfg index 7cbbfb7..1050beb 100644 --- a/locale/en/dectorio.cfg +++ b/locale/en/dectorio.cfg @@ -17,6 +17,7 @@ dectorio-decoratives=Enable Decoratives dectorio-item-group=Separate Crafting Tab dectorio-vanilla-hazard-concrete-style=Use default Factorio Hazard concrete style dectorio-landscaping-blueprintable=Landscaping items are blueprintable +dectorio-painted-concrete-speed-modifier=Painted concrete speed modifier dectorio-decorative-removal-probability=Decoration removal probability dectorio-flooring-stack-size=Flooring items stack size dectorio-landscaping-stack-size=Landscaping items stack size @@ -35,6 +36,7 @@ dectorio-decoratives=Enables the ability to craft decorative items for your fact dectorio-item-group=Moves all decorative items into a dedicated crafting tab in the inventory dectorio-vanilla-hazard-concrete-style=When enabled, Painted Hazard concrete will look like the default Factorio Hazard concrete when placed (requires Painted Concrete to be enabled) dectorio-landscaping-blueprintable=When enabled, blueprints will include landscaping features as tiles +dectorio-painted-concrete-speed-modifier=Modifies the default walking and vehicle speed for Painted concrete by this amount (1 = no change to speed (default), 0.75 = 75% of default speed, 0.5 = 50% of default speed) dectorio-decorative-removal-probability=The probability that decorations, such as bushes and grasses, are removed when flooring tiles are placed (1 = 100% are removed (default), 0.5 = 50%, 0 = none are removed) dectorio-flooring-stack-size=The number of flooring items that can be stacked in one inventory slot (default = 500) dectorio-landscaping-stack-size=The number of landscaping items that can be stacked in one inventory slot (default = 500) diff --git a/prototypes/tile/tiles.lua b/prototypes/tile/tiles.lua index 13fd92f..47c8ce1 100644 --- a/prototypes/tile/tiles.lua +++ b/prototypes/tile/tiles.lua @@ -198,6 +198,8 @@ end if DECT.ENABLED["painted-concrete"] then + local set_modifier = DECT.CONFIG.SETTINGS["painted_concrete_speed_modifier"] + local directions = { {this="left", next="right"}, {this="right", next="left"} @@ -215,14 +217,14 @@ if DECT.ENABLED["painted-concrete"] then minable = { hardness = 0.2, mining_time = 0.5, result = "dect-paint-"..variant.name }, mined_sound = base_concrete.mined_sound, collision_mask = { "ground-tile" }, - walking_speed_modifier = base_concrete.walking_speed_modifier, + walking_speed_modifier = base_concrete.walking_speed_modifier * set_modifier, layer = tile_layer.paint, decorative_removal_probability = decorative_removal_probability, variants = tile_variants_material("concrete", variant.name.."-"..direction.this), walking_sound = base_concrete.walking_sound, map_color = variant.color, ageing = 0, - vehicle_friction_modifier = base_concrete.vehicle_friction_modifier + vehicle_friction_modifier = base_concrete.vehicle_friction_modifier * set_modifier } }) @@ -237,19 +239,29 @@ if DECT.ENABLED["painted-concrete"] then minable = { hardness = 0.2, mining_time = 0.5, result = "dect-paint-refined-"..variant.name }, mined_sound = base_refined_concrete.mined_sound, collision_mask = { "ground-tile" }, - walking_speed_modifier = base_refined_concrete.walking_speed_modifier, + walking_speed_modifier = base_refined_concrete.walking_speed_modifier * set_modifier, layer = tile_layer.refined_paint, decorative_removal_probability = decorative_removal_probability, variants = tile_variants_material("refined-concrete", variant.name.."-"..direction.this), walking_sound = base_refined_concrete.walking_sound, map_color = variant.color, ageing = 0, - vehicle_friction_modifier = base_refined_concrete.vehicle_friction_modifier + vehicle_friction_modifier = base_refined_concrete.vehicle_friction_modifier * set_modifier } }) end end + -- Adjust walking speeds on base hazard tiles + base_hazard_left.walking_speed_modifier = base_concrete.walking_speed_modifier * set_modifier + base_hazard_left.vehicle_friction_modifier = base_concrete.vehicle_friction_modifier * set_modifier + base_hazard_right.walking_speed_modifier = base_concrete.walking_speed_modifier * set_modifier + base_hazard_right.vehicle_friction_modifier = base_concrete.vehicle_friction_modifier * set_modifier + base_refined_hazard_left.walking_speed_modifier = base_refined_concrete.walking_speed_modifier * set_modifier + base_refined_hazard_left.vehicle_friction_modifier = base_refined_concrete.vehicle_friction_modifier * set_modifier + base_refined_hazard_right.walking_speed_modifier = base_refined_concrete.walking_speed_modifier * set_modifier + base_refined_hazard_right.vehicle_friction_modifier = base_refined_concrete.vehicle_friction_modifier * set_modifier + -- Move all the base concretes up a layer so it sits atop stone path base_concrete.layer = tile_layer.concrete base_hazard_left.layer = tile_layer.paint diff --git a/settings.lua b/settings.lua index 251f435..043f81e 100644 --- a/settings.lua +++ b/settings.lua @@ -85,6 +85,15 @@ data:extend({ default_value = false, order = "c-b" }, + { + type = "double-setting", + name = "dectorio-painted-concrete-speed-modifier", + setting_type = "startup", + default_value = 1, + minimum_value = 0.1, + maximum_value = 1, + order = "c-c" + }, { type = "double-setting", name = "dectorio-decorative-removal-probability",