-
Notifications
You must be signed in to change notification settings - Fork 1
/
common-properties.lua
158 lines (151 loc) · 5 KB
/
common-properties.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
-- Note: None of these properties are meant for use in a normal mod,
-- because they mostly produce empty images and have no function in-game beyond being loadable.
-- All properties are based on the formats documented on the wiki: https://wiki.factorio.com/Prototype_overview
local properties = {}
properties.sound_filename = "__core__/sound/achievement-unlocked.ogg"
properties.sprite_filename = "__core__/graphics/empty.png"
properties.sprite_filename_32px = "__core__/graphics/icons/unknown.png"
properties.render_layer = "object"
-- This function is applied directly to the prototype table and adds the icon to it
properties.add_icon = function(prototype)
prototype.icon = properties.sprite_filename
prototype.icon_size = 1
return prototype
end
-- Any property that is a table is returned via a function.
-- This means that everything gets a copy of the table, not a reference to the table.
properties.color = function() return {1, 1, 1, 1} end -- white
properties.bounding_box = function() return {{0, 0}, {0, 0}} end
-- splitter: bounding box width must be > 0.5, height must be > 1
properties.nonzero_bounding_box = function() return {{-0.95, -1.0}, {0.1, 0.1}} end
properties.vector = function() return {0, 0} end
properties.sound = function()
return {filename = properties.sound_filename}
end
properties.sprite = function()
return
{
filename = properties.sprite_filename,
size = 1
}
end
-- properties.sprite() is also used as SpriteVariations and Sprite4Way
properties.rotated_sprite = function()
local sprite = properties.sprite()
sprite.direction_count = 1
return sprite
end
properties.rotated_sprite_custom_direction_count = function(direction_count)
local sprite = properties.sprite()
sprite.filename = properties.sprite_filename_32px
sprite.direction_count = direction_count
return sprite
end
properties.sprite_8_way = function()
return
{
north = properties.sprite(),
north_east = properties.sprite(),
east = properties.sprite(),
south_east = properties.sprite(),
south = properties.sprite(),
south_west = properties.sprite(),
west = properties.sprite(),
north_west = properties.sprite()
}
end
properties.animation = function()
return properties.sprite()
end
-- properties.animation() is also used as AnimationVariations and Animation4Way
properties.rotated_animation = function()
local animation = properties.animation()
animation.direction_count = 1
return animation
end
properties.attack_parameters = function()
return
{
type = "stream", -- required by fluid turret
ammo_type = {category = "dummy-ammo-category"},
range = 1,
cooldown = 1,
animation = properties.rotated_animation() -- required by unit
}
end
properties.rail_piece_layers = function()
return
{
metals = properties.sprite(),
backplates = properties.sprite(),
ties = properties.sprite(),
stone_path = properties.sprite()
}
end
properties.rail_pictures = function()
return
{
straight_rail_horizontal = properties.rail_piece_layers(),
straight_rail_vertical = properties.rail_piece_layers(),
straight_rail_diagonal_left_top = properties.rail_piece_layers(),
straight_rail_diagonal_right_top = properties.rail_piece_layers(),
straight_rail_diagonal_right_bottom = properties.rail_piece_layers(),
straight_rail_diagonal_left_bottom = properties.rail_piece_layers(),
curved_rail_vertical_left_top = properties.rail_piece_layers(),
curved_rail_vertical_right_top = properties.rail_piece_layers(),
curved_rail_vertical_right_bottom = properties.rail_piece_layers(),
curved_rail_vertical_left_bottom = properties.rail_piece_layers(),
curved_rail_horizontal_left_top = properties.rail_piece_layers(),
curved_rail_horizontal_right_top = properties.rail_piece_layers(),
curved_rail_horizontal_right_bottom = properties.rail_piece_layers(),
curved_rail_horizontal_left_bottom = properties.rail_piece_layers(),
rail_endings = properties.sprite_8_way()
}
end
properties.oriented_cliff_prototype = function()
return
{
collision_bounding_box = properties.bounding_box(),
pictures = {properties.sprite()},
fill_volume = 1
}
end
properties.electric_energy_source = function()
return
{
type = "electric",
buffer_capacity = "1J",
input_flow_limit = "1W",
-- this works even for entities that technically *output* energy
usage_priority = "primary-input"
}
end
properties.void_energy_source = function()
return {type = "void"}
end
properties.burner_energy_source = function()
return {type = "burner", fuel_inventory_size = 1}
end
properties.wire_connection_point = function()
return
{
wire = {},
shadow = {}
}
end
properties.damage_prototype = function()
return {amount = 1, type = "physical"}
end
properties.fluid_box = function()
return {pipe_connections = {}}
end
properties.heat_buffer = function()
return
{
-- because min temp defaults to 15 and this must be >= min temp
max_temperature = 15,
specific_heat = "1J",
max_transfer = "1J"
}
end
return properties