File tree Expand file tree Collapse file tree 4 files changed +36
-2
lines changed
mods/se-interstellar-construction-requests-fulfillment Expand file tree Collapse file tree 4 files changed +36
-2
lines changed Original file line number Diff line number Diff line change @@ -37,6 +37,7 @@ script.on_nth_tick(600, function(event)
37
37
38
38
for surface_index , surface_alerts in pairs (alerts ) do
39
39
for _ , surface_alert in ipairs (surface_alerts [defines .alert_type .no_material_for_construction ]) do
40
+ Handler .handle_construction_alert (surface_alert )
40
41
-- {
41
42
-- {
42
43
-- count = 1,
@@ -50,7 +51,6 @@ script.on_nth_tick(600, function(event)
50
51
-- name = "storage-tank"
51
52
-- }
52
53
-- }
53
- log (serpent .block (surface_alert .target .ghost_prototype .items_to_place_this ))
54
54
end
55
55
end
56
56
end
Original file line number Diff line number Diff line change @@ -73,6 +73,7 @@ local item = {
73
73
order = ' k-a' , -- weapon delivery cannon is `j-`
74
74
subgroup = ' surface-defense' ,
75
75
stack_size = 50 ,
76
+ flags = {' draw-logistic-overlay' },
76
77
}
77
78
78
79
item .place_result = turret .name
Original file line number Diff line number Diff line change 2
2
"name" : " se-interstellar-construction-requests-fulfillment" ,
3
3
"title" : " Space Exploration - interstellar construction requests fulfillment" ,
4
4
"description" : " Keeping building equipment stocked at every planet is tedious, just shoot it there from nauvis." ,
5
- "version" : " 0.0.14 " ,
5
+ "version" : " 0.0.15 " ,
6
6
"author" : " Quezler" ,
7
7
"factorio_version" : " 1.1" ,
8
8
"dependencies" : [
Original file line number Diff line number Diff line change @@ -41,4 +41,37 @@ function Handler.tick(event)
41
41
end
42
42
end
43
43
44
+ function Handler .handle_construction_alert (alert )
45
+ if alert .target .name ~= " entity-ghost" then return end -- can be "item-request-proxy"
46
+ log (alert .target .unit_number )
47
+
48
+ -- game.print(serpent.block(alert.target.ghost_prototype.items_to_place_this))
49
+ for _ , item_to_place_this in ipairs (alert .target .ghost_prototype .items_to_place_this ) do
50
+ if item_to_place_this .count == 1 then
51
+ game .print (item_to_place_this .name )
52
+
53
+ for unit_number , struct in pairs (global .structs ) do
54
+ if not struct .entity .valid then
55
+ global .structs [unit_number ] = nil
56
+ else
57
+ if alert .target .force == struct .entity .force then
58
+ -- we're gonna check for orange coverage for now, instead of green venn diagrams and filtering out personal roboports
59
+ local network = struct .entity .surface .find_logistic_network_by_position (struct .entity .position , struct .entity .force )
60
+ if network then
61
+ struct .entity .surface .create_entity {
62
+ name = ' item-request-proxy' ,
63
+ force = struct .entity .force ,
64
+ target = struct .entity ,
65
+ position = {0 ,0 },
66
+ modules = {[item_to_place_this .name ] = item_to_place_this .count }
67
+ }
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
74
+
75
+ end
76
+
44
77
return Handler
You can’t perform that action at this time.
0 commit comments