Skip to content

Commit 5a2ed79

Browse files
authored
1.6.0 (#4)
- updated to Factorio 0.16
1 parent 114040f commit 5a2ed79

File tree

7 files changed

+70
-169
lines changed

7 files changed

+70
-169
lines changed

changelog.txt

+3
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
1.6.0
2+
- updated to Factorio 0.16
3+
14
1.5.4
25
- fixed inventory contents not showing in 1.5.3
36

control.lua

+5-5
Original file line numberDiff line numberDiff line change
@@ -76,15 +76,15 @@ function OnEntityCreated(event)
7676

7777
if #global.ItemSensors == 1 then
7878
script.on_event(defines.events.on_tick, OnTick)
79-
script.on_event({defines.events.on_preplayer_mined_item, defines.events.on_robot_pre_mined, defines.events.on_entity_died}, OnEntityRemoved)
79+
script.on_event({defines.events.on_pre_player_mined_item, defines.events.on_robot_pre_mined, defines.events.on_entity_died}, OnEntityRemoved)
8080
end
8181

8282
ResetStride()
8383
end
8484
end
8585

8686
function OnEntityRemoved(event)
87-
-- script.on_event({defines.events.on_preplayer_mined_item, defines.events.on_robot_pre_mined, defines.events.on_entity_died}, function(event)
87+
-- script.on_event({defines.events.on_pre_player_mined_item, defines.events.on_robot_pre_mined, defines.events.on_entity_died}, function(event)
8888
if event.entity.name == SENSOR then
8989
for i=#global.ItemSensors, 1, -1 do
9090
if event.entity.unit_number == global.ItemSensors[i].ID then
@@ -94,7 +94,7 @@ function OnEntityRemoved(event)
9494

9595
if #global.ItemSensors == 0 then
9696
script.on_event(defines.events.on_tick, nil)
97-
script.on_event({defines.events.on_preplayer_mined_item, defines.events.on_robot_pre_mined, defines.events.on_entity_died}, nil)
97+
script.on_event({defines.events.on_pre_player_mined_item, defines.events.on_robot_pre_mined, defines.events.on_entity_died}, nil)
9898
end
9999

100100
ResetStride()
@@ -326,7 +326,7 @@ function UpdateSensor(itemSensor)
326326
for i=1, #connectedEntity.fluidbox, 1 do
327327
local fluid = connectedEntity.fluidbox[i]
328328
if fluid then
329-
signals[signalIndex] = {index = signalIndex, signal = {type = "fluid",name = fluid.type},count = ceil(fluid.amount) }
329+
signals[signalIndex] = {index = signalIndex, signal = {type = "fluid",name = fluid.name},count = ceil(fluid.amount) }
330330
signalIndex = signalIndex+1
331331
end
332332
end
@@ -350,7 +350,7 @@ local function init_events()
350350
script.on_event({defines.events.on_built_entity, defines.events.on_robot_built_entity}, OnEntityCreated)
351351
if global.ItemSensors and #global.ItemSensors > 0 then
352352
script.on_event(defines.events.on_tick, OnTick)
353-
script.on_event({defines.events.on_preplayer_mined_item, defines.events.on_robot_pre_mined, defines.events.on_entity_died}, OnEntityRemoved)
353+
script.on_event({defines.events.on_pre_player_mined_item, defines.events.on_robot_pre_mined, defines.events.on_entity_died}, OnEntityRemoved)
354354
end
355355
end
356356

info.json

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
{
22
"name": "Inventory Sensor",
3-
"version": "1.5.4",
3+
"version": "1.6.0",
44
"title": "Inventory Sensor",
55
"author": "Optera",
66
"contact": "https://forums.factorio.com/memberlist.php?mode=viewprofile&u=21729",
77
"homepage": "https://forums.factorio.com/viewtopic.php?f=97&t=30454",
88
"description": "Adds a combinator that reads inventories of locomotives, wagons, cars, furnaces, assemblers, roboports, rocket silos and reactors.",
9-
"factorio_version": "0.15",
10-
"dependencies": ["base >= 0.15.37"]
9+
"factorio_version": "0.16",
10+
"dependencies": ["base >= 0.16.0"]
1111
}

prototypes/entity.lua

+51-161
Original file line numberDiff line numberDiff line change
@@ -1,163 +1,53 @@
1-
data:extend({
1+
local inv_sensor = table.deepcopy(data.raw["constant-combinator"]["constant-combinator"])
2+
inv_sensor.name = "item-sensor"
3+
inv_sensor.icon = "__Inventory Sensor__/graphics/icons/inventory-sensor.png"
4+
inv_sensor.icon_size = 32
5+
inv_sensor.minable.result = "item-sensor"
6+
7+
inv_sensor.sprites =
8+
{
9+
north =
210
{
3-
type = "constant-combinator",
4-
name = "item-sensor",
5-
icon = "__Inventory Sensor__/graphics/icons/inventory-sensor.png",
6-
flags = {"placeable-neutral", "player-creation"},
7-
minable = {hardness = 0.2, mining_time = 0.5, result = "item-sensor"},
8-
max_health = 50,
9-
corpse = "small-remnants",
10-
11-
collision_box = {{-0.35, -0.35}, {0.35, 0.35}},
12-
selection_box = {{-0.5, -0.5}, {0.5, 0.5}},
13-
14-
item_slot_count = 1000,
15-
16-
sprites =
17-
{
18-
north =
19-
{
20-
filename = "__Inventory Sensor__/graphics/entity/inventory-sensor.png",
21-
x = 158,
22-
y = 5,
23-
width = 79,
24-
height = 63,
25-
frame_count = 1,
26-
shift = {0.140625, 0.140625},
27-
},
28-
east =
29-
{
30-
filename = "__Inventory Sensor__/graphics/entity/inventory-sensor.png",
31-
y = 5,
32-
width = 79,
33-
height = 63,
34-
frame_count = 1,
35-
shift = {0.140625, 0.140625},
36-
},
37-
south =
38-
{
39-
filename = "__Inventory Sensor__/graphics/entity/inventory-sensor.png",
40-
x = 237,
41-
y = 5,
42-
width = 79,
43-
height = 63,
44-
frame_count = 1,
45-
shift = {0.140625, 0.140625},
46-
},
47-
west =
48-
{
49-
filename = "__Inventory Sensor__/graphics/entity/inventory-sensor.png",
50-
x = 79,
51-
y = 5,
52-
width = 79,
53-
height = 63,
54-
frame_count = 1,
55-
shift = {0.140625, 0.140625},
56-
}
57-
},
58-
59-
activity_led_sprites =
60-
{
61-
north =
62-
{
63-
filename = "__base__/graphics/entity/combinator/activity-leds/combinator-led-constant-north.png",
64-
width = 11,
65-
height = 10,
66-
frame_count = 1,
67-
shift = {0.296875, -0.40625},
68-
},
69-
east =
70-
{
71-
filename = "__base__/graphics/entity/combinator/activity-leds/combinator-led-constant-east.png",
72-
width = 14,
73-
height = 12,
74-
frame_count = 1,
75-
shift = {0.25, -0.03125},
76-
},
77-
south =
78-
{
79-
filename = "__base__/graphics/entity/combinator/activity-leds/combinator-led-constant-south.png",
80-
width = 11,
81-
height = 11,
82-
frame_count = 1,
83-
shift = {-0.296875, -0.078125},
84-
},
85-
west =
86-
{
87-
filename = "__base__/graphics/entity/combinator/activity-leds/combinator-led-constant-west.png",
88-
width = 12,
89-
height = 12,
90-
frame_count = 1,
91-
shift = {-0.21875, -0.46875},
92-
}
93-
},
94-
95-
activity_led_light =
96-
{
97-
intensity = 0.8,
98-
size = 1,
99-
},
100-
101-
activity_led_light_offsets =
102-
{
103-
{0.296875, -0.40625},
104-
{0.25, -0.03125},
105-
{-0.296875, -0.078125},
106-
{-0.21875, -0.46875}
107-
},
108-
109-
circuit_wire_connection_points =
110-
{
111-
{
112-
shadow =
113-
{
114-
red = {0.15625, -0.28125},
115-
green = {0.65625, -0.25}
116-
},
117-
wire =
118-
{
119-
red = {-0.28125, -0.5625},
120-
green = {0.21875, -0.5625},
121-
}
122-
},
123-
{
124-
shadow =
125-
{
126-
red = {0.75, -0.15625},
127-
green = {0.75, 0.25},
128-
},
129-
wire =
130-
{
131-
red = {0.46875, -0.5},
132-
green = {0.46875, -0.09375},
133-
}
134-
},
135-
{
136-
shadow =
137-
{
138-
red = {0.75, 0.5625},
139-
green = {0.21875, 0.5625}
140-
},
141-
wire =
142-
{
143-
red = {0.28125, 0.15625},
144-
green = {-0.21875, 0.15625}
145-
}
146-
},
147-
{
148-
shadow =
149-
{
150-
red = {-0.03125, 0.28125},
151-
green = {-0.03125, -0.125},
152-
},
153-
wire =
154-
{
155-
red = {-0.46875, 0},
156-
green = {-0.46875, -0.40625},
157-
}
158-
}
159-
},
160-
161-
circuit_wire_max_distance = 7.5
11+
filename = "__Inventory Sensor__/graphics/entity/inventory-sensor.png",
12+
x = 158,
13+
y = 5,
14+
width = 79,
15+
height = 63,
16+
frame_count = 1,
17+
shift = {0.140625, 0.140625},
18+
},
19+
east =
20+
{
21+
filename = "__Inventory Sensor__/graphics/entity/inventory-sensor.png",
22+
y = 5,
23+
width = 79,
24+
height = 63,
25+
frame_count = 1,
26+
shift = {0.140625, 0.140625},
27+
},
28+
south =
29+
{
30+
filename = "__Inventory Sensor__/graphics/entity/inventory-sensor.png",
31+
x = 237,
32+
y = 5,
33+
width = 79,
34+
height = 63,
35+
frame_count = 1,
36+
shift = {0.140625, 0.140625},
37+
},
38+
west =
39+
{
40+
filename = "__Inventory Sensor__/graphics/entity/inventory-sensor.png",
41+
x = 79,
42+
y = 5,
43+
width = 79,
44+
height = 63,
45+
frame_count = 1,
46+
shift = {0.140625, 0.140625},
16247
}
163-
})
48+
}
49+
50+
inv_sensor.item_slot_count = 1000
51+
52+
53+
data:extend({ inv_sensor })

prototypes/item.lua

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ data:extend({
33
type = "item",
44
name = "item-sensor",
55
icon = "__Inventory Sensor__/graphics/icons/inventory-sensor.png",
6+
icon_size = 32,
67
flags = { "goes-to-quickbar" },
78
subgroup = "circuit-network",
89
place_result="item-sensor",

prototypes/recipe.lua

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ data:extend({
33
type = "recipe",
44
name = "item-sensor",
55
icon = "__Inventory Sensor__/graphics/icons/inventory-sensor.png",
6+
icon_size = 32,
67
enabled = "false",
78
ingredients =
89
{

prototypes/signal.lua

+6
Original file line numberDiff line numberDiff line change
@@ -10,41 +10,47 @@ data:extend({
1010
type = "virtual-signal",
1111
name = "inv-sensor-progress",
1212
icon = "__Inventory Sensor__/graphics/icons/progress.png",
13+
icon_size = 32,
1314
subgroup = "sensor-signals",
1415
order = "x[sensor-signals]-ba"
1516
},
1617
{
1718
type = "virtual-signal",
1819
name = "inv-sensor-temperature",
1920
icon = "__Inventory Sensor__/graphics/icons/temperature.png",
21+
icon_size = 32,
2022
subgroup = "sensor-signals",
2123
order = "x[sensor-signals]-bb"
2224
},
2325
{
2426
type = "virtual-signal",
2527
name = "inv-sensor-detected-car",
2628
icon = "__Inventory Sensor__/graphics/icons/car.png",
29+
icon_size = 32,
2730
subgroup = "sensor-signals",
2831
order = "x[sensor-signals]-da"
2932
},
3033
{
3134
type = "virtual-signal",
3235
name = "inv-sensor-detected-tank",
3336
icon = "__Inventory Sensor__/graphics/icons/tank.png",
37+
icon_size = 32,
3438
subgroup = "sensor-signals",
3539
order = "x[sensor-signals]-db"
3640
},
3741
{
3842
type = "virtual-signal",
3943
name = "inv-sensor-detected-wagon",
4044
icon = "__base__/graphics/icons/cargo-wagon.png",
45+
icon_size = 32,
4146
subgroup = "sensor-signals",
4247
order = "x[sensor-signals]-dd"
4348
},
4449
{
4550
type = "virtual-signal",
4651
name = "inv-sensor-detected-locomotive",
4752
icon = "__base__/graphics/icons/diesel-locomotive.png",
53+
icon_size = 32,
4854
subgroup = "sensor-signals",
4955
order = "x[sensor-signals]-dc"
5056
}

0 commit comments

Comments
 (0)