1dirname = path.dirname(__file__)
2
3tribes:new_productionsite_type {
4   msgctxt = "empire_building",
5   name = "empire_smelting_works",
6   -- TRANSLATORS: This is a building name used in lists of buildings
7   descname = pgettext("empire_building", "Smelting Works"),
8   helptext_script = dirname .. "helptexts.lua",
9   icon = dirname .. "menu.png",
10   size = "medium",
11
12   buildcost = {
13      log = 1,
14      granite = 4,
15      marble = 2
16   },
17   return_on_dismantle = {
18      granite = 3,
19      marble = 1
20   },
21
22   animations = {
23      idle = {
24         pictures = path.list_files(dirname .. "idle_??.png"),
25         hotspot = { 39, 53 },
26      },
27      build = {
28         pictures = path.list_files(dirname .. "build_??.png"),
29         hotspot = { 39, 53 },
30      },
31      working = {
32         pictures = path.list_files(dirname .. "working_??.png"),
33         hotspot = { 39, 53 },
34         fps = 5
35      },
36   },
37
38   aihints = {
39      prohibited_till = 700,
40      very_weak_ai_limit = 1,
41      weak_ai_limit = 2
42   },
43
44   working_positions = {
45      empire_smelter = 1
46   },
47
48   inputs = {
49      { name = "coal", amount = 8 },
50      { name = "iron_ore", amount = 8 },
51      { name = "gold_ore", amount = 8 }
52   },
53   outputs = {
54      "iron",
55      "gold"
56   },
57
58   programs = {
59      work = {
60         -- TRANSLATORS: Completed/Skipped/Did not start working because ...
61         descname = _"working",
62         actions = {
63            "call=smelt_iron",
64            "call=smelt_gold",
65            "call=smelt_iron_2",
66         }
67      },
68      -- 2 identical programs for iron to prevent unnecessary skipping penalty
69      smelt_iron = {
70         -- TRANSLATORS: Completed/Skipped/Did not start smelting iron because ...
71         descname = _"smelting iron",
72         actions = {
73            "return=skipped unless economy needs iron",
74            "consume=iron_ore coal",
75            "sleep=25000",
76            "playsound=sound/metal/fizzle 150",
77            "animate=working 35000",
78            "playsound=sound/metal/ironping 80",
79            "produce=iron"
80         }
81      },
82      smelt_iron_2 = {
83         -- TRANSLATORS: Completed/Skipped/Did not start smelting iron because ...
84         descname = _"smelting iron",
85         actions = {
86            "return=skipped unless economy needs iron",
87            "consume=iron_ore coal",
88            "sleep=25000",
89            "playsound=sound/metal/fizzle 150",
90            "animate=working 35000",
91            "playsound=sound/metal/ironping 80",
92            "produce=iron"
93         }
94      },
95      smelt_gold = {
96         -- TRANSLATORS: Completed/Skipped/Did not start smelting gold because ...
97         descname = _"smelting gold",
98         actions = {
99            "return=skipped unless economy needs gold",
100            "consume=gold_ore coal",
101            "sleep=25000",
102            "playsound=sound/metal/fizzle 150",
103            "animate=working 35000",
104            "playsound=sound/metal/goldping 80",
105            "produce=gold"
106         }
107      },
108   },
109}
110