Allow different shapes in equipment armor
- lovely_santa
- Filter Inserter
- Posts: 502
- Joined: Sat Feb 18, 2017 9:41 pm
- Contact:
Allow different shapes in equipment armor
As of now, equipment requires to have a shape defined, but the type must be "full". I want to make different shape equipments, for example an "L" shape would be nice to have a 2x2 mk1 equipment, the mk2 could be an addon 3x3 "L" shaped armor that wraps around the 2x2 and together form a square 3x3 equipment.
With that in mind I am actualy looking for a hollow square look, where for example a 2x2 equipment could sit inside a 4x4 hollow equipment.
Kind regards
lovely_santa
With that in mind I am actualy looking for a hollow square look, where for example a 2x2 equipment could sit inside a 4x4 hollow equipment.
Kind regards
lovely_santa
Re: Allow different shapes in equipment armor
Ok, I added support to define a shape as "manual" (a set of points) for the next version of 0.17.
If you want to get ahold of me I'm almost always on Discord.
Re: Allow different shapes in equipment armor
It's a tetris time!
Re: Allow different shapes in equipment armor
Note you'll have to manually make the background color on your sprite when using the manual shape since the automatic shape can't tell where borders would go unless I wrote some non-trivial amount of rendering logic which I don't currently want to do.
If you want to get ahold of me I'm almost always on Discord.
Re: Allow different shapes in equipment armor
You guys are so amazing! <Insert celebratory fireworks emoji here>
My own personal Factorio super-power - running out of power.
- lovely_santa
- Filter Inserter
- Posts: 502
- Joined: Sat Feb 18, 2017 9:41 pm
- Contact:
Re: Allow different shapes in equipment armor
Thanks for the implementation! <3
-
- Fast Inserter
- Posts: 162
- Joined: Sun Oct 28, 2018 7:57 am
- Contact:
Re: Allow different shapes in equipment armor
May I ask about some sample code or syntax for this exciting new feature?
Especially on the expected range of "points", is it some relative coordinates to upper-left point?...
Is it like the equipment will span the whole width and height graphically, but only the points in the table actually occupy the grid point?
I found the description under Lua API - LuaEquipmentPrototype, but still don't know how to use it.
Especially on the expected range of "points", is it some relative coordinates to upper-left point?...
Is it like the equipment will span the whole width and height graphically, but only the points in the table actually occupy the grid point?
I found the description under Lua API - LuaEquipmentPrototype, but still don't know how to use it.
Wiki - Types/EquipmentShape is not updated yet, still showing:shape :: table [Read-only]
Shape of this equipment prototype. It is a table:
width :: uint
height :: uint
points :: array of point (optional): A point is a table with x and y values. Only set when the shape is "manual"
type
Type: Types/string
The shape. Must be "full".
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Allow different shapes in equipment armor
Looks like positive offsets from the upper left corner {0,0} of the equiment. And width/height as a box that defines image scale = 1.0.
Code: Select all
data.raw["generator-equipment"]["fusion-reactor-equipment"]
.shape = {
width = 2,
height = 3,
type = "manual",
points = {
{0,0},
{0,1},
{1,1},
{0,2},
}
}
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
-
- Fast Inserter
- Posts: 162
- Joined: Sun Oct 28, 2018 7:57 am
- Contact:
Re: Allow different shapes in equipment armor
Thanks! This is exactly the answer I wanted!eradicator wrote: ↑Tue Jul 02, 2019 8:43 amLooks like positive offsets from the upper left corner {0,0} of the equiment. And width/height as a box that defines image scale = 1.0.gridpoints.pngCode: Select all
data.raw["generator-equipment"]["fusion-reactor-equipment"] .shape = { width = 2, height = 3, type = "manual", points = { {0,0}, {0,1}, {1,1}, {0,2}, } }
Re: Allow different shapes in equipment armor
It's also on the fusion-reactor-equipment lua definition commented out:
Code: Select all
shape =
{
width = 4,
height = 4,
type = "full"
--[[ Can also be defined as manual (a set of points which fall within the width/height - can't be empty)
Note: the automatic background does not work when using 'manual'.
type = "manual",
points = {{0, 0}, {1, 0}, {2, 0}, {3, 0},
{0, 1}, {3, 1},
{0, 2}, {3, 2},
{0, 3}, {1, 3}, {2, 3}, {3, 3},}
]]--
},
If you want to get ahold of me I'm almost always on Discord.
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Allow different shapes in equipment armor
@Rsed:
Btw, the error message for too small width/height could use some better wording. "point value is too big: 1 >= 1" isn't the best way to say "all points need to be within the box size defined by widht/height".
Btw, the error message for too small width/height could use some better wording. "point value is too big: 1 >= 1" isn't the best way to say "all points need to be within the box size defined by widht/height".
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Re: Allow different shapes in equipment armor
Heh, errors mostly just exist to prevent bad data from being used. If I change it, some time later someone else will complain about something else until eventual it's 3 paragraphs long and nobody has any idea what it means when it happens.
I'm going to leave the error as it is. You figured out what was wrong so it's good enough.
I'm going to leave the error as it is. You figured out what was wrong so it's good enough.
If you want to get ahold of me I'm almost always on Discord.
- eradicator
- Smart Inserter
- Posts: 5207
- Joined: Tue Jul 12, 2016 9:03 am
- Contact:
Re: Allow different shapes in equipment armor
I'll take that as a compliment.
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.