Skip to content

Commit

Permalink
1.5.0: API update (#10)
Browse files Browse the repository at this point in the history
* Use 64x64 as default icon size

* API update 1.5.0

* Delete DCM API readme 1.5.0.pdf

* 1.5.0 API update

* Delete public.lua

* Delete entities.lua

* Delete shared.lua

* Update API 1.5.0 + mipmaps

* 1.5.0: mipmaps

* Create README.md

* Update README.md

* Update changelog.txt

* API update 1.5.0

* Update README.md

* Fix broken changelog

* Fix changelog
  • Loading branch information
Deadlock989 authored and shanemadden committed Jun 9, 2019
1 parent d667f5c commit 9982c86
Show file tree
Hide file tree
Showing 29 changed files with 997 additions and 489 deletions.
226 changes: 226 additions & 0 deletions README.md

Large diffs are not rendered by default.

18 changes: 18 additions & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
---------------------------------------------------------------------------------------------------
Version: 1.5.0
Date: 08. 06. 2019
Changes:
- Default icon size for machines and crates is now 64, and crate item icons can now support custom mipmaps.
- It now takes the same time to craft any tier of crating machine (3 seconds).
- Crating machine recipe selection GUI no longer refers to "assembling".
API:
- The DCM API was updated. See README.md or public.lua for details, but briefly:
- NEW: deadlock_crating.add_tier(). This adds (or replaces) a tier of machines and tech.
- NEW: deadlock_crating.add_crate(). This is the same as the former create() call, but icon size is no longer required.
- NEW: deadlock_crating.destroy_crate(). This deletes the crated version of an item and all recipe/tech references to it.
- NEW: deadlock_crating.destroy_vanilla_crates(). This deletes all the default vanilla item crates and all references to them.
- DEPRECATED: deadlock_crating.create(). Consider using deadlock_crating.add_crate() instead.
- DEPRECATED: deadlock_crating.remove(). Consider using deadlock_crating.destroy_crate() instead.
- DEPRECATED: deadlock_crating.reset(). Consider using deadlock_crating.destroy_vanilla_crates() instead.
- Crate creation now accepts a nil technology reference, but you will need to handle the recipe unlocks yourself.
- Removed references to crafting tab subgroups which haven't been used for more than a year.
---------------------------------------------------------------------------------------------------
Version: 1.4.10
Date: 02. 06. 2019
Changes:
Expand Down
Binary file added graphics/icons/mipmaps/crate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added graphics/icons/mipmaps/crating-icon-base.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added graphics/icons/mipmaps/crating-icon-mask.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
4 changes: 2 additions & 2 deletions info.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "DeadlockCrating",
"version": "1.4.10",
"version": "1.5.0",
"title": "Deadlock's Crating Machine",
"author": "Deadlock989",
"contact": "",
"homepage": "https://forums.factorio.com/viewtopic.php?f=94&t=57070",
"dependencies": ["base >= 0.17.35", "?ReStack", "?Regroup"],
"description": "Adds well-balanced packing and unpacking facilities to hugely boost belt throughput using crates.",
"description": "Pack resources into crates and unpack them where needed. Hugely boosts belt throughput, at a cost.",
"factorio_version": "0.17"
}
27 changes: 12 additions & 15 deletions locale/en/config.cfg
Original file line number Diff line number Diff line change
@@ -1,18 +1,18 @@
[entity-name]
deadlock-machine-packer-entity-1=Crating machine 1
deadlock-machine-packer-entity-2=Crating machine 2
deadlock-machine-packer-entity-3=Crating machine 3
deadlock-crating-machine-1=Standard crating machine
deadlock-crating-machine-2=Fast crating machine
deadlock-crating-machine-3=Express crating machine

[item-name]
deadlock-machine-packer-item-1=Crating machine 1
deadlock-machine-packer-item-2=Crating machine 2
deadlock-machine-packer-item-3=Crating machine 3
deadlock-crating-machine-1=Standard crating machine
deadlock-crating-machine-2=Fast crating machine
deadlock-crating-machine-3=Express crating machine
deadlock-crate-item=Crate: __2__ x __1__

[item-description]
deadlock-machine-packer-item-1=A heavy assembler that packs and unpacks crates. Can handle a full yellow belt of input/output.
deadlock-machine-packer-item-2=A heavy assembler that packs and unpacks crates. Can handle a full red belt of input/output.
deadlock-machine-packer-item-3=A heavy assembler that packs and unpacks crates. Can handle a full blue belt of input/output.
deadlock-crating-machine-1=A heavy assembler that packs and unpacks crates. Can handle a full yellow belt of input.
deadlock-crating-machine-2=A heavy assembler that packs and unpacks crates. Can handle a full red belt of input.
deadlock-crating-machine-3=A heavy assembler that packs and unpacks crates. Can handle a full blue belt of input.

[recipe-name]
deadlock-packing-recipe=__1__: pack crate
Expand All @@ -22,16 +22,13 @@ deadlock-unpacking-recipe=__1__: unpack crate
deadlock-crating=Crates

[technology-description]
deadlock-crating=Boosts belt throughput by packing resources into crates.
deadlock-crating=Boosts belt throughput by packing resources into crates and unpacking them at the other end.

[item-group-name]
deadlock-crates=Deadlock's Crating Machine
[info-message]
dcm-tech-migration=DCM: __1__ migrated.
[mod-setting-name]
deadlock-crating-logging=Logging
[mod-setting-description]
deadlock-crating-logging=For modders: prints non-errors to the game log.
[gui-title]
crating=Choose a crating recipe
23 changes: 23 additions & 0 deletions migrations/deadlock-crating-1.5.0.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
{
"item": [
["deadlock-machine-packer-item-1", "deadlock-crating-machine-1"],
["deadlock-machine-packer-item-2", "deadlock-crating-machine-2"],
["deadlock-machine-packer-item-3", "deadlock-crating-machine-3"],
["deadlock-machine-packer-item-4", "deadlock-crating-machine-4"],
["deadlock-machine-packer-item-5", "deadlock-crating-machine-5"]
],
"recipe": [
["deadlock-machine-packer-recipe-1", "deadlock-crating-machine-1"],
["deadlock-machine-packer-recipe-2", "deadlock-crating-machine-2"],
["deadlock-machine-packer-recipe-3", "deadlock-crating-machine-3"],
["deadlock-machine-packer-recipe-4", "deadlock-crating-machine-4"],
["deadlock-machine-packer-recipe-5", "deadlock-crating-machine-5"]
],
"entity": [
["deadlock-machine-packer-entity-1", "deadlock-crating-machine-1"],
["deadlock-machine-packer-entity-2", "deadlock-crating-machine-2"],
["deadlock-machine-packer-entity-3", "deadlock-crating-machine-3"],
["deadlock-machine-packer-entity-4", "deadlock-crating-machine-4"],
["deadlock-machine-packer-entity-5", "deadlock-crating-machine-5"]
]
}
191 changes: 2 additions & 189 deletions prototypes/entities.lua
Original file line number Diff line number Diff line change
@@ -1,192 +1,5 @@
local DCM = require "prototypes.shared"

-- brighter version of tier colour for working vis glow & lights
local function brighter_colour(c)
local w = 240
return { r = math.floor((c.r + w)/2), g = math.floor((c.g + w)/2), b = math.floor((c.b + w)/2) }
end

-- for calculating scales of energy, health etc.
local function get_scale(this_tier, tiers, lowest, highest)
return lowest + ((highest - lowest) * ((this_tier - 1) / (tiers - 1)))
end

-- Energy and pollution. They just couldn't make it easy, could they
local function get_energy_table(this_tier, tiers, lowest, highest, passive_multiplier)
local total = get_scale(this_tier, tiers, lowest, highest)
local passive_energy_usage = total * passive_multiplier
local active_energy_usage = total * (1 - passive_multiplier)
return {
passive = passive_energy_usage .. "KW", -- passive energy drain as a string
active = active_energy_usage .. "KW", -- active energy usage as a string
}
end

-- iterate through tiers
for i=1,DCM.TIERS do
local energy_table = get_energy_table(i, DCM.TIERS, 500, 1000, 0.1)
local machine = {
name = "deadlock-machine-packer-entity-"..i,
type = "assembling-machine",
next_upgrade = (i < DCM.TIERS) and "deadlock-machine-packer-entity-"..(i+1) or nil,
fast_replaceable_group = "packer",
icons = {
{ icon = "__DeadlockCrating__/graphics/icons/crating-icon-base-"..DCM.ITEM_ICON_SIZE..".png", icon_size = DCM.ITEM_ICON_SIZE },
{ icon = "__DeadlockCrating__/graphics/icons/crating-icon-mask-"..DCM.ITEM_ICON_SIZE..".png", icon_size = DCM.ITEM_ICON_SIZE, tint = DCM.TIER_COLOURS[1] },
},
minable = {
mining_time = 0.2,
result = "deadlock-machine-packer-item-"..i,
},
crafting_speed = i,
module_specification = {
module_info_icon_shift = { 0, 0.8 },
module_slots = 1
},
allowed_effects = {"consumption"},
crafting_categories = {"packing"},
max_health = get_scale(i, DCM.TIERS, 300, 400),
energy_usage = energy_table.active,
energy_source = {
type = "electric",
usage_priority = "secondary-input",
drain = energy_table.passive,
emissions_per_minute = 5-i,
},
dying_explosion = "medium-explosion",
resistances = {
{
type = "fire",
percent = 90
},
},
corpse = "big-remnants",
flags = {
"placeable-neutral",
"placeable-player",
"player-creation"
},
collision_box = { {-1.3,-1.3}, {1.3,1.3} },
selection_box = { {-1.5,-1.5}, {1.5,1.5} },
tile_width = 3,
tile_height = 3,
animation = {
layers = {
{
hr_version = {
filename = "__DeadlockCrating__/graphics/entities/high/crating-base.png",
animation_speed = 1 / i,
priority = "high",
frame_count = 60,
line_length = 10,
height = 192,
scale = 0.5,
shift = {0, 0},
width = 192
},
filename = "__DeadlockCrating__/graphics/entities/low/crating-base.png",
animation_speed = 1 / i,
priority = "high",
frame_count = 60,
line_length = 10,
height = 96,
scale = 1,
shift = {0, 0},
width = 96
},
{
hr_version = {
filename = "__DeadlockCrating__/graphics/entities/high/crating-mask.png",
animation_speed = 1 / i,
priority = "high",
repeat_count = 60,
height = 192,
scale = 0.5,
shift = {0, 0},
width = 192,
tint = DCM.TIER_COLOURS[i],
},
filename = "__DeadlockCrating__/graphics/entities/low/crating-mask.png",
animation_speed = 1 / i,
priority = "high",
repeat_count = 60,
height = 96,
scale = 1,
shift = {0, 0},
width = 96,
tint = DCM.TIER_COLOURS[i],
},
{
hr_version = {
draw_as_shadow = true,
filename = "__DeadlockCrating__/graphics/entities/high/crating-shadow.png",
animation_speed = 1 / i,
repeat_count = 60,
height = 192,
scale = 0.5,
shift = {1.5, 0},
width = 384
},
draw_as_shadow = true,
filename = "__DeadlockCrating__/graphics/entities/low/crating-shadow.png",
animation_speed = 1 / i,
repeat_count = 60,
height = 96,
scale = 1,
shift = {1.5, 0},
width = 192
}
}
},
working_visualisations = {
{
animation = {
hr_version = {
animation_speed = 1 / i,
blend_mode = "additive",
filename = "__DeadlockCrating__/graphics/entities/high/crating-working.png",
frame_count = 30,
line_length = 10,
height = 192,
priority = "high",
scale = 0.5,
tint = brighter_colour(DCM.TIER_COLOURS[i]),
width = 192
},
animation_speed = 1 / i,
blend_mode = "additive",
filename = "__DeadlockCrating__/graphics/entities/low/crating-working.png",
frame_count = 30,
line_length = 10,
height = 96,
priority = "high",
tint = brighter_colour(DCM.TIER_COLOURS[i]),
width = 96
},
light = {
color = brighter_colour(DCM.TIER_COLOURS[i]),
intensity = 0.4,
size = 9,
shift = {0, 0},
},
},
},
working_sound = { filename = "__DeadlockCrating__/sounds/deadlock-crate-machine.ogg", volume = 0.7 },
open_sound = {
filename = "__base__/sound/machine-open.ogg",
volume = 0.75
},
close_sound = {
filename = "__base__/sound/machine-close.ogg",
volume = 0.75
},
mined_sound = {
filename = "__base__/sound/deconstruct-bricks.ogg"
},
vehicle_impact_sound = {
filename = "__base__/sound/car-metal-impact.ogg",
volume = 0.65
},
}
data:extend({machine})
for tier = 1,DCM.TIERS do
DCM.create_machine_entity(tier, nil, nil, nil, nil, nil, (tier < DCM.TIERS) and (DCM.MACHINE_PREFIX..(tier+1)) or nil, nil)
end
19 changes: 2 additions & 17 deletions prototypes/items.lua
Original file line number Diff line number Diff line change
@@ -1,21 +1,6 @@
local DCM = require "prototypes.shared"

-- crating machines
for i=1,DCM.TIERS do
data:extend {
{
type = "item",
name = "deadlock-machine-packer-item-"..i,
subgroup = "production-machine",
stack_size = 50,
icons = {
{ icon = "__DeadlockCrating__/graphics/icons/crating-icon-base-"..DCM.ITEM_ICON_SIZE..".png" },
{ icon = "__DeadlockCrating__/graphics/icons/crating-icon-mask-"..DCM.ITEM_ICON_SIZE..".png", tint = DCM.TIER_COLOURS[i] },
},
icon_size = DCM.ITEM_ICON_SIZE,
order = "z"..i,
place_result = "deadlock-machine-packer-entity-"..i,
flags = {},
}
}
for tier = 1,DCM.TIERS do
DCM.create_machine_item(tier)
end
Loading

0 comments on commit 9982c86

Please sign in to comment.