Repository navigation
Expand file tree
/
Copy pathdata.lua
More file actions
943 lines (842 loc) · 31.3 KB
/
Copy pathdata.lua
File metadata and controls
943 lines (842 loc) · 31.3 KB
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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
--[[ ============================================================================
Settings and Helper Functions
============================================================================ ]]--
-- Load mod settings
local settings = {
small_chest_capacity = settings.startup["fridge-small-chest-capacity"].value,
large_chest_capacity = settings.startup["fridge-large-chest-capacity"].value,
power_consumption = settings.startup["fridge-power-consumption"].value,
power_capacity = settings.startup["fridge-power-capacity"].value,
platform_bonus_capacity = settings.startup["fridge-space-plantform-capacity"].value
}
-- Determine energy cell type based on available mods.
-- The Tiberium mod's internal name is "Factorio-Tiberium"; the old spelling
-- ("Tirberium") never matched, so this substitution has never happened for
-- anyone. info.json carries a hidden optional dependency on it so its items are
-- defined by the time this runs; the data.raw check keeps us on the vanilla
-- cell rather than referencing an item that is not there, should a version of
-- that mod ever not ship it.
local energy_cell = "uranium-fuel-cell"
if mods["Factorio-Tiberium"] and data.raw.item["tiberium-fuel-cell"] then
energy_cell = "tiberium-fuel-cell"
end
-- Helper function to recursively apply preservation tint to sprite structures
local function apply_preservation_tint(obj)
local tint = {r=0.6, g=0.8, b=1.0, a=1.0}
if type(obj) ~= "table" then return end
-- Handle sprite-like objects (with filename/tint properties)
if obj.filename then
obj.tint = tint
return
end
-- Handle layers property specifically
if obj.layers then
for _, layer in pairs(obj.layers) do
apply_preservation_tint(layer)
end
end
-- Recursively process all table values
for _, value in pairs(obj) do
if type(value) == "table" then
apply_preservation_tint(value)
end
end
end
--[[ ============================================================================
Entity Definitions
============================================================================ ]]--
--[[ ------------------------- Basic Refrigerator ------------------------- ]]--
local refrigerator = table.deepcopy(data.raw.container["steel-chest"])
refrigerator.type = "container"
refrigerator.name = "refrigerater"
refrigerator.icon = "__Fridge__/graphics/icon/refrigerater.png"
refrigerator.icon_size = 64
refrigerator.minable.result = "refrigerater"
refrigerator.order = "a[items]-c[refrigerater]"
refrigerator.picture = {
layers = {
{
filename = "__Fridge__/graphics/hr-refrigerater.png",
priority = "extra-high",
width = 66,
height = 74,
shift = util.by_pixel(0, -2),
scale = 0.5
},
{
filename = "__Fridge__/graphics/hr-refrigerater-shadow.png",
priority = "extra-high",
width = 112,
height = 46,
shift = util.by_pixel(12, 4.5),
draw_as_shadow = true,
scale = 0.5
}
}
}
refrigerator.logistic_mode = nil
refrigerator.inventory_size = settings.small_chest_capacity
refrigerator.trash_inventory_size = nil
--[[ ------------------------- Logistic Fridges ------------------------- ]]--
local logistic_fridge_types = {
{name = "logistic-refrigerater-passive-provider", color = {r=0.8, g=0.2, b=0.2}, logistic_mode = "passive-provider", type = "logistic-container", trash_inventory_size = 0},
{name = "logistic-refrigerater-requester", color = {r=0.2, g=0.2, b=0.8}, logistic_mode = "requester", type = "logistic-container", trash_inventory_size = 10},
{name = "logistic-refrigerater-buffer", color = {r=0.2, g=0.8, b=0.2}, logistic_mode = "buffer", type = "logistic-container", trash_inventory_size = 10}
}
local logistic_fridges = {}
for _, fridge_type in pairs(logistic_fridge_types) do
local logistic_fridge = table.deepcopy(refrigerator)
logistic_fridge.name = fridge_type.name
logistic_fridge.logistic_mode = fridge_type.logistic_mode
logistic_fridge.trash_inventory_size = fridge_type.trash_inventory_size
logistic_fridge.minable.result = fridge_type.name
logistic_fridge.icons = {
{
icon = "__Fridge__/graphics/icon/refrigerater.png",
icon_size = 64,
tint = fridge_type.color
}
}
-- Apply tint to entity sprite
for _, sprite in pairs(logistic_fridge.picture.layers) do
sprite.tint = fridge_type.color
end
logistic_fridge.type = fridge_type.type
table.insert(logistic_fridges, logistic_fridge)
end
--[[ ------------------------- Power Proxy ------------------------- ]]--
-- The warehouse's footprint, shared with the power proxy that lives inside it.
local warehouse_collision_box = {{-2.8, -2.8}, {2.8, 2.8}}
-- Create hidden power entity for warehouse power consumption
local power_proxy = table.deepcopy(data.raw["roboport"]["roboport"])
power_proxy.name = "warehouse-power-proxy"
power_proxy.icon = "__Fridge__/graphics/icon/large-chest.png"
power_proxy.icon_size = 256
-- Configure power settings
power_proxy.energy_source = {
type = "electric",
usage_priority = "secondary-input",
input_flow_limit = (3 * settings.power_consumption).."MW",
buffer_capacity = settings.power_capacity.."MJ"
}
power_proxy.recharge_minimum = (settings.power_capacity * 0.05).."MJ"
power_proxy.energy_usage = settings.power_consumption.."MW"
-- Disable all roboport functionality
power_proxy.charging_energy = "0W"
power_proxy.radar_range = 0
power_proxy.logistics_radius = 0
power_proxy.construction_radius = 0
power_proxy.robot_slots_count = 0
power_proxy.material_slots_count = 0
power_proxy.stationing_offset = {0, 0}
power_proxy.charging_offsets = {}
-- Remove all animations and visual elements
power_proxy.base = {
filename = "__core__/graphics/empty.png",
width = 1,
height = 1
}
power_proxy.base_patch = nil
power_proxy.base_animation = nil
power_proxy.door_animation_up = nil
power_proxy.door_animation_down = nil
power_proxy.recharging_animation = nil
power_proxy.spawn_and_station_height = 0
-- Configure entity placement and interaction.
--
-- The proxy is copied from the roboport, and Space Age gives the roboport
-- heating_energy in its *data* stage - so the copy inherits it and the proxy is
-- a freezable entity. It is created at the warehouse's own position, i.e. dead
-- centre of a 6x6 building, and the engine heats an entity only when a heat
-- source's bounding box, grown by its heating_radius (1 tile for a heat pipe),
-- overlaps the target's *collision* box. A pipe laid against the warehouse
-- reaches 2.2 tiles in from the wall; a 0.6-tile box at the centre is 2.8 away,
-- so no reachable tile could ever heat it. On a freezing planet the warehouse
-- therefore read as "cold" for good - a demand the player had no way to meet,
-- however completely they ringed the building in heat pipes.
--
-- Giving the proxy the warehouse's own footprint makes a heat pipe laid against
-- any side of the building reach it, which is what the building looks like it
-- should need. The box is inert - collision_mask is empty, so it obstructs
-- nothing - and selection still uses selection_box, which stays small, so
-- clicks continue to land on the warehouse.
power_proxy.selection_box = {{-0.3, -0.3}, {0.3, 0.3}}
power_proxy.collision_box = warehouse_collision_box
power_proxy.collision_mask = {layers = {}}
power_proxy.flags = {
"not-blueprintable",
"not-deconstructable",
"placeable-off-grid",
"not-on-map",
"not-repairable",
"not-upgradable"
}
power_proxy.selection_priority = 1
-- Space Age mod compatibility
if mods["space-age"] then
power_proxy.surface_conditions = {}
end
--[[ ------------------------- Preservation Warehouse ------------------------- ]]--
local warehouse = table.deepcopy(data.raw.container["steel-chest"])
warehouse.name = "preservation-warehouse"
warehouse.type = "container"
-- Basic properties
warehouse.flags = {"placeable-neutral", "placeable-player", "player-creation"}
warehouse.icon = "__Fridge__/graphics/icon/large-chest.png"
warehouse.icon_size = 256
warehouse.minable = {mining_time = 6, result = "preservation-warehouse"}
warehouse.inventory_size = settings.large_chest_capacity
warehouse.corpse = "big-remnants"
-- Visual appearance
warehouse.picture = {
layers = {
{
filename = "__Fridge__/graphics/large-chest-front.png",
priority = "extra-high",
width = 1024,
height = 1024,
shift = util.by_pixel(0, -30),
scale = 0.25
},
{
filename = "__Fridge__/graphics/large-chest-shadow.png",
priority = "extra-high",
width = 1024,
height = 600,
shift = util.by_pixel(64, 1.5),
draw_as_shadow = true,
scale = 0.31
}
}
}
-- Collision and selection properties
warehouse.collision_box = table.deepcopy(warehouse_collision_box)
warehouse.selection_box = {{-3, -2.8}, {3, 3}}
warehouse.collision_mask = {
layers = {
item = true,
object = true,
player = true,
water_tile = true
}
}
--[[ ------------------------- Space Platform Warehouse ------------------------- ]]--
-- Create space platform warehouse (Space Age mod compatibility)
local space_warehouse = nil
if mods["space-age"] then
-- Create entity from cargo bay base
space_warehouse = table.deepcopy(data.raw["cargo-bay"]["cargo-bay"])
space_warehouse.type = "cargo-bay"
space_warehouse.name = "preservation-platform-warehouse"
-- Apply preservation tint to all graphics
apply_preservation_tint(space_warehouse.graphics_set.picture)
apply_preservation_tint(space_warehouse.graphics_set.connections)
apply_preservation_tint(space_warehouse.platform_graphics_set.picture)
apply_preservation_tint(space_warehouse.platform_graphics_set.connections)
for _, hatch_def in pairs(space_warehouse.hatch_definitions) do
apply_preservation_tint(hatch_def.hatch_graphics.layers)
end
-- Configure basic properties
space_warehouse.minable = {mining_time = 8, result = "preservation-platform-warehouse"}
space_warehouse.inventory_size_bonus = settings.platform_bonus_capacity
space_warehouse.surface_conditions = {}
end
--[[ ------------------------- Space Platform Warehouse ------------------------- ]]--
-- Create space platform warehouse (Space Age mod compatibility)
local space_warehouse_unloading = nil
-- The Freezing Unloading Bay is built from landing-pad-unloading-bay, which
-- Space Age only ships on Factorio 2.1 and later. Guard on that prototype
-- existing rather than on the mod being present, so the rest of the mod still
-- loads on 2.0 and simply does not offer this one entity.
local has_unloading_bay = mods["space-age"]
and data.raw["cargo-bay"]
and data.raw["cargo-bay"]["landing-pad-unloading-bay"] ~= nil
if has_unloading_bay then
-- Create entity from cargo bay base
space_warehouse_unloading = table.deepcopy(data.raw["cargo-bay"]["landing-pad-unloading-bay"])
space_warehouse_unloading.type = "cargo-bay"
space_warehouse_unloading.name = "preservation-platform-unloading-bay"
-- Apply preservation tint to all graphics
apply_preservation_tint(space_warehouse_unloading.graphics_set.picture)
apply_preservation_tint(space_warehouse_unloading.graphics_set.connections)
--for _, hatch_def in pairs(space_warehouse_unloading.hatch_definitions) do
-- apply_preservation_tint(hatch_def.hatch_graphics.layers)
--end
-- Configure basic properties
space_warehouse_unloading.allow_unloading=true
space_warehouse_unloading.minable = {mining_time = 8, result = "preservation-platform-unloading-bay"}
space_warehouse_unloading.inventory_size_bonus = settings.platform_bonus_capacity
space_warehouse_unloading.surface_conditions = {}
end
--[[ ------------------------- Preservation Wagon ------------------------- ]]--
local preservation_wagon = table.deepcopy(data.raw["cargo-wagon"]["cargo-wagon"])
preservation_wagon.name = "preservation-wagon"
preservation_wagon.minable.result = "preservation-wagon"
preservation_wagon.color = {r=0.6, g=0.8, b=1.0, a=0.8}
preservation_wagon.allow_manual_color = false
--[[ ------------------------- Preservation Inserters ------------------------- ]]--
-- Base preservation inserter (based on fast inserter)
local preservation_inserter = table.deepcopy(data.raw["inserter"]["fast-inserter"])
preservation_inserter.name = "preservation-fast-inserter"
preservation_inserter.minable.result = "preservation-fast-inserter"
-- Configure energy usage
preservation_inserter.energy_per_movement = "10kJ"
preservation_inserter.energy_per_rotation = "10kJ"
preservation_inserter.energy_source = {
type = "electric",
usage_priority = "secondary-input",
drain = "0.5kW"
}
-- Apply preservation tint
apply_preservation_tint(preservation_inserter.platform_picture.sheet)
apply_preservation_tint(preservation_inserter.hand_base_picture)
apply_preservation_tint(preservation_inserter.hand_open_picture)
apply_preservation_tint(preservation_inserter.hand_closed_picture)
preservation_inserter.next_upgrade = "preservation-bulk-inserter"
-- Long-range preservation inserter (based on long-handed inserter)
local preservation_long_inserter = table.deepcopy(data.raw["inserter"]["long-handed-inserter"])
preservation_long_inserter.name = "preservation-long-inserter"
preservation_long_inserter.minable.result = "preservation-long-inserter"
-- Configure energy usage
preservation_long_inserter.energy_per_movement = "15kJ"
preservation_long_inserter.energy_per_rotation = "15kJ"
preservation_long_inserter.energy_source = {
type = "electric",
usage_priority = "secondary-input",
drain = "0.7kW"
}
-- Apply preservation tint
apply_preservation_tint(preservation_long_inserter.platform_picture.sheet)
apply_preservation_tint(preservation_long_inserter.hand_base_picture)
apply_preservation_tint(preservation_long_inserter.hand_open_picture)
apply_preservation_tint(preservation_long_inserter.hand_closed_picture)
-- Stack preservation inserter (based on stack inserter)
local preservation_stack_inserter = table.deepcopy(data.raw["inserter"]["bulk-inserter"])
preservation_stack_inserter.name = "preservation-bulk-inserter"
preservation_stack_inserter.minable.result = "preservation-bulk-inserter"
-- Configure energy usage
preservation_stack_inserter.energy_per_movement = "25kJ"
preservation_stack_inserter.energy_per_rotation = "25kJ"
preservation_stack_inserter.energy_source = {
type = "electric",
usage_priority = "secondary-input",
drain = "1kW"
}
-- Apply preservation tint
apply_preservation_tint(preservation_stack_inserter.platform_picture.sheet)
apply_preservation_tint(preservation_stack_inserter.hand_base_picture)
apply_preservation_tint(preservation_stack_inserter.hand_open_picture)
apply_preservation_tint(preservation_stack_inserter.hand_closed_picture)
if mods["space-age"] then
preservation_stack_inserter.next_upgrade = "preservation-stack-inserter"
end
-- Bulk preservation inserter (based on stack inserter)
local preservation_bulk_inserter = nil
if mods["space-age"] then
preservation_bulk_inserter = table.deepcopy(data.raw["inserter"]["stack-inserter"])
preservation_bulk_inserter.name = "preservation-stack-inserter"
preservation_bulk_inserter.minable.result = "preservation-stack-inserter"
-- Configure energy usage
preservation_bulk_inserter.energy_per_movement = "40kJ"
preservation_bulk_inserter.energy_per_rotation = "40kJ"
preservation_bulk_inserter.energy_source = {
type = "electric",
usage_priority = "secondary-input",
drain = "2kW"
}
-- Apply preservation tint
apply_preservation_tint(preservation_bulk_inserter.platform_picture.sheet)
apply_preservation_tint(preservation_bulk_inserter.hand_base_picture)
apply_preservation_tint(preservation_bulk_inserter.hand_open_picture)
apply_preservation_tint(preservation_bulk_inserter.hand_closed_picture)
end
--[[ ============================================================================
Item Definitions
============================================================================ ]]--
local items = {
-- Basic refrigerator
{
type = "item",
name = "refrigerater",
icon = "__Fridge__/graphics/icon/refrigerater.png",
icon_size = 64,
subgroup = "storage",
order = "a[items]-d[refrigerater]",
place_result = "refrigerater",
stack_size = 50
},
-- Preservation warehouse
{
type = "item",
name = "preservation-warehouse",
icon = "__Fridge__/graphics/icon/large-chest.png",
icon_size = 256,
subgroup = "storage",
order = "a[items]-e[preservation-warehouse]",
place_result = "preservation-warehouse",
stack_size = 10
},
-- Preservation wagon
{
type = "item",
name = "preservation-wagon",
icons = {{
icon = preservation_wagon.icon,
icon_size = preservation_wagon.icon_size,
tint = {r=0.6, g=0.8, b=1.0, a=0.8},
}},
subgroup = "train-transport",
order = "d[items]-d[preservation-wagon]",
place_result = "preservation-wagon",
stack_size = 5
},
-- Basic preservation inserter
{
type = "item",
name = "preservation-fast-inserter",
icons = {{
icon = data.raw["inserter"]["fast-inserter"].icon,
icon_size = data.raw["inserter"]["fast-inserter"].icon_size,
tint = {r=0.6, g=0.8, b=1.0, a=0.8}
}},
subgroup = "inserter",
order = "d[preservation]-a[preservation-fast-inserter]",
place_result = "preservation-fast-inserter",
stack_size = 50
},
-- Long-range preservation inserter
{
type = "item",
name = "preservation-long-inserter",
icons = {{
icon = data.raw["inserter"]["long-handed-inserter"].icon,
icon_size = data.raw["inserter"]["long-handed-inserter"].icon_size,
tint = {r=0.6, g=0.8, b=1.0, a=0.8}
}},
subgroup = "inserter",
order = "d[preservation]-b[preservation-long-inserter]",
place_result = "preservation-long-inserter",
stack_size = 50
},
-- Bulk preservation inserter
{
type = "item",
name = "preservation-bulk-inserter",
icons = {{
icon = data.raw["inserter"]["bulk-inserter"].icon,
icon_size = data.raw["inserter"]["bulk-inserter"].icon_size,
tint = {r=0.6, g=0.8, b=1.0, a=0.8}
}},
subgroup = "inserter",
order = "d[preservation]-c[preservation-bulk-inserter]",
place_result = "preservation-bulk-inserter",
stack_size = 50
},
}
-- Add logistic fridge items
for _, fridge_type in pairs(logistic_fridge_types) do
table.insert(items, {
type = "item",
name = fridge_type.name,
icons = {
{
icon = "__Fridge__/graphics/icon/refrigerater.png",
icon_size = 64,
tint = fridge_type.color
}
},
subgroup = "storage",
order = "a[items]-d[" .. fridge_type.name .. "]",
place_result = fridge_type.name,
stack_size = 50
})
end
-- Add space platform warehouse item if mod is present
if mods["space-age"] then
table.insert(items, {
type = "item",
name = "preservation-platform-warehouse",
icons = {
{
icon = data.raw["cargo-bay"]["cargo-bay"].icon,
icon_size = data.raw["cargo-bay"]["cargo-bay"].icon_size,
tint = {r=0.6, g=0.8, b=1.0, a=0.8},
}
},
group = "space" ,
subgroup = "space-platform",
order = "c[items]-c[preservation-platform-warehouse]",
place_result = "preservation-platform-warehouse",
stack_size = 10
})
table.insert(items, {
type = "item",
name = "preservation-stack-inserter",
icons = {{
icon = data.raw["inserter"]["stack-inserter"].icon,
icon_size = data.raw["inserter"]["stack-inserter"].icon_size,
tint = {r=0.6, g=0.8, b=1.0, a=0.8}
}},
subgroup = "inserter",
order = "d[preservation]-d[preservation-stack-inserter]",
place_result = "preservation-stack-inserter",
stack_size = 50
})
if has_unloading_bay then
table.insert(items, {
type = "item",
name = "preservation-platform-unloading-bay",
icons = {
{
icon = data.raw["cargo-bay"]["landing-pad-unloading-bay"].icon,
icon_size = data.raw["cargo-bay"]["landing-pad-unloading-bay"].icon_size,
tint = {r=0.6, g=0.8, b=1.0, a=0.8},
}
},
group = "space",
subgroup = "space-platform",
order = "d[items]-d[landing-pad-unloading-bay]",
place_result = "preservation-platform-unloading-bay",
stack_size = 10
})
end
end
--[[ ============================================================================
Recipe Definitions
============================================================================ ]]--
local recipes = {
-- Basic refrigerator
{
type = "recipe",
name = "refrigerater",
enabled = false,
ingredients = {
{type = "item", name = "steel-chest", amount = 1},
{type = "item", name = "electric-engine-unit", amount = 1},
{type = "item", name = "processing-unit", amount = 1},
{type = "item", name = energy_cell, amount = 1},
{type = "item", name = "plastic-bar", amount = 10}
},
results = {{type = "item", name = "refrigerater", amount = 1}}
},
-- Preservation warehouse
{
type = "recipe",
name = "preservation-warehouse",
enabled = false,
ingredients = {
{type = "item", name = "concrete", amount = 200},
{type = "item", name = "plastic-bar", amount = 100},
{type = "item", name = "steel-plate", amount = 50},
{type = "item", name = "battery", amount = 50},
{type = "item", name = "processing-unit", amount = 10},
{type = "item", name = "electric-engine-unit", amount = 5}
},
results = {{type = "item", name = "preservation-warehouse", amount = 1}}
},
-- Preservation wagon
{
type = "recipe",
name = "preservation-wagon",
enabled = false,
ingredients = {
{type = "item", name = "cargo-wagon", amount = 1},
{type = "item", name = "refrigerater", amount = 2},
{type = "item", name = "advanced-circuit", amount = 5}
},
results = {{type = "item", name = "preservation-wagon", amount = 1}}
},
-- Basic preservation inserter
{
type = "recipe",
name = "preservation-fast-inserter",
enabled = false,
ingredients = {
{type = "item", name = "fast-inserter", amount = 1},
{type = "item", name = "electronic-circuit", amount = 2},
{type = "item", name = "refrigerater", amount = 1}
},
results = {{type = "item", name = "preservation-fast-inserter", amount = 1}}
},
-- Long-range preservation inserter
{
type = "recipe",
name = "preservation-long-inserter",
enabled = false,
ingredients = {
{type = "item", name = "long-handed-inserter", amount = 1},
{type = "item", name = "electronic-circuit", amount = 3},
{type = "item", name = "refrigerater", amount = 1}
},
results = {{type = "item", name = "preservation-long-inserter", amount = 1}}
},
-- Stack preservation inserter
{
type = "recipe",
name = "preservation-bulk-inserter",
enabled = false,
ingredients = {
{type = "item", name = "bulk-inserter", amount = 1},
{type = "item", name = "advanced-circuit", amount = 2},
{type = "item", name = "refrigerater", amount = 1}
},
results = {{type = "item", name = "preservation-bulk-inserter", amount = 1}}
},
}
-- Add logistic fridge recipes
for _, fridge_type in pairs(logistic_fridge_types) do
table.insert(recipes, {
type = "recipe",
name = fridge_type.name,
enabled = false,
ingredients = {
{type = "item", name = "refrigerater", amount = 1},
{type = "item", name = "processing-unit", amount = 1},
{type = "item", name = "advanced-circuit", amount = 2}
},
results = {{type = "item", name = fridge_type.name, amount = 1}}
})
end
-- Add space platform warehouse recipe if mod is present
if mods["space-age"] then
table.insert(recipes, {
type = "recipe",
name = "preservation-platform-warehouse",
enabled = false,
ingredients = {
{type = "item", name = "preservation-warehouse", amount = 1},
{type = "item", name = "cargo-bay", amount = 1}
},
results = {{type = "item", name = "preservation-platform-warehouse", amount = 1}}
})
table.insert(recipes, {
type = "recipe",
name = "preservation-stack-inserter",
enabled = false,
ingredients = {
{type = "item", name = "stack-inserter", amount = 1},
{type = "item", name = "advanced-circuit", amount = 4},
{type = "item", name = "processing-unit", amount = 1},
{type = "item", name = "refrigerater", amount = 1}
},
results = {{type = "item", name = "preservation-stack-inserter", amount = 1}}
})
if has_unloading_bay then
table.insert(recipes, {
type = "recipe",
name = "preservation-platform-unloading-bay",
enabled = false,
ingredients = {
{type = "item", name = "preservation-warehouse", amount = 1},
{type = "item", name = "landing-pad-unloading-bay", amount = 1}
},
results = {{type = "item", name = "preservation-platform-unloading-bay", amount = 1}}
})
end
end
--[[ ============================================================================
Technology Definitions
============================================================================ ]]--
local ingredLR = mods["space-age"] and {
{"automation-science-pack", 1},
{"logistic-science-pack", 1},
{"chemical-science-pack", 1},
{"production-science-pack", 1},
{"agricultural-science-pack", 1}
} or {
{"automation-science-pack", 1},
{"logistic-science-pack", 1},
{"chemical-science-pack", 1},
{"production-science-pack", 1},
}
local ingredPW = mods["space-age"] and {
{"automation-science-pack", 1},
{"logistic-science-pack", 1},
{"chemical-science-pack", 1},
{"production-science-pack", 1},
{"utility-science-pack", 1},
{"space-science-pack", 1},
{"metallurgic-science-pack", 1},
{"agricultural-science-pack", 1},
{"electromagnetic-science-pack", 1},
{"cryogenic-science-pack", 1}
} or {
{"automation-science-pack", 1},
{"logistic-science-pack", 1},
{"chemical-science-pack", 1},
{"production-science-pack", 1},
{"utility-science-pack", 1},
{"space-science-pack", 1},
}
-- The stack preservation inserter only exists when Space Age provides the
-- stack-inserter it is based on
local inserter_unlocks = {
{type = "unlock-recipe", recipe = "preservation-fast-inserter"},
{type = "unlock-recipe", recipe = "preservation-long-inserter"},
{type = "unlock-recipe", recipe = "preservation-bulk-inserter"}
}
if mods["space-age"] then
table.insert(inserter_unlocks, {type = "unlock-recipe", recipe = "preservation-stack-inserter"})
end
local technologies = {
-- Basic refrigerator
{
type = "technology",
name = "refrigerater",
icons = {{
icon = "__Fridge__/graphics/icon/refrigerater.png",
icon_size = 64
}},
prerequisites = {"electric-engine", "processing-unit", "plastics"},
effects = {
{type = "unlock-recipe", recipe = "refrigerater"}
},
unit = {
count = 50,
ingredients = {
{"automation-science-pack", 1},
{"logistic-science-pack", 1}
},
time = 30
}
},
-- Logistic refrigerator
{
type = "technology",
name = "logistic-refrigerater",
icon = "__Fridge__/graphics/icon/refrigerater.png",
icon_size = 64,
prerequisites = {"refrigerater", "logistic-system"},
effects = {
{type = "unlock-recipe", recipe = "logistic-refrigerater-passive-provider"},
{type = "unlock-recipe", recipe = "logistic-refrigerater-requester"},
{type = "unlock-recipe", recipe = "logistic-refrigerater-buffer"}
},
unit = {
count = 200,
ingredients = ingredLR,
time = 30
}
},
-- Preservation warehouse
{
type = "technology",
name = "preservation-warehouse-tech",
icon = "__Fridge__/graphics/icon/large-chest.png",
icon_size = 256,
prerequisites = {"logistic-refrigerater"},
unit = {
count = 1500,
ingredients = ingredPW,
time = 60
},
effects = {
{type = "unlock-recipe", recipe = "preservation-warehouse"}
}
},
-- Preservation wagon
{
type = "technology",
name = "preservation-wagon",
icons = {{
icon = preservation_wagon.icon,
icon_size = preservation_wagon.icon_size,
tint = {r=0.6, g=0.8, b=1.0, a=0.8},
}},
prerequisites = {"railway", "refrigerater"},
effects = {
{type = "unlock-recipe", recipe = "preservation-wagon"}
},
unit = {
count = 100,
ingredients = {
{"automation-science-pack", 1},
{"logistic-science-pack", 1},
{"chemical-science-pack", 1},
{"production-science-pack", 1}
},
time = 30
}
},
-- Preservation inserters
{
type = "technology",
name = "preservation-fast-inserter",
icon_size = 256,
icon_mipmaps = 4,
icons = {{
icon = data.raw["inserter"]["inserter"].icon,
icon_size = data.raw["inserter"]["inserter"].icon_size,
tint = {r=0.6, g=0.8, b=1.0, a=0.8}
}},
prerequisites = {"logistics", "refrigerater"},
unit = {
count = 50,
ingredients = {
{"automation-science-pack", 1},
{"logistic-science-pack", 1}
},
time = 30
},
effects = inserter_unlocks,
order = "a-d-a"
}
}
-- Preservation platform-cargo-bay
if mods["space-age"] then
local platform_warehouse_unlocks = {
{type = "unlock-recipe", recipe = "preservation-platform-warehouse"}
}
if has_unloading_bay then
table.insert(platform_warehouse_unlocks,
{type = "unlock-recipe", recipe = "preservation-platform-unloading-bay"})
end
table.insert(technologies, {
type = "technology",
name = "preservation-platform-warehouse",
icons = {{
icon = data.raw["cargo-bay"]["cargo-bay"].icon,
icon_size = data.raw["cargo-bay"]["cargo-bay"].icon_size,
tint = {r=0.6, g=0.8, b=1.0, a=0.8},
}},
icon_size = 256,
prerequisites = {"preservation-warehouse-tech"},
unit = {
count = 1500,
ingredients = ingredPW,
time = 60
},
effects = platform_warehouse_unlocks
})
end
--[[ ============================================================================
Register Prototypes
============================================================================ ]]--
-- Register entities
data:extend({
refrigerator,
power_proxy,
warehouse,
preservation_wagon,
preservation_inserter,
preservation_long_inserter,
preservation_stack_inserter,
preservation_bulk_inserter
})
-- Register logistic fridge entities
for _, logistic_fridge in pairs(logistic_fridges) do
data:extend({logistic_fridge})
end
-- Register space platform warehouse if mod is present
if space_warehouse then
data:extend({space_warehouse})
if has_unloading_bay then
data:extend({space_warehouse_unloading})
end
end
-- Register items
data:extend(items)
-- Register recipes
data:extend(recipes)
-- Register technologies
data:extend(technologies)