1-- RST 2-- .. _lua_world_resources: 3-- 4-- Resources 5-- --------- 6-- 7-- Resources are mineable map resources. 8-- All resources are defined in ``data/world/resources/init.lua``. 9-- 10-- * **Fish** can be placed in water terrain only and be fished by a fisher. 11-- * **Water** can be placed on any non-mountain terrain and be pulled up by a well. 12-- * **Stones**, **Coal**, **Iron** and **Gold** are placed on mountain terrain 13-- and can be dug up by mines. 14-- 15-- Which resource can be placed where on the map is defined in each terrain's 16-- ``valid_resources`` table. 17 18pics_dir = path.dirname(__file__) .. "pics/" 19 20-- RST 21-- .. function:: new_resource_type{table} 22-- 23-- This function adds the definition of a resource to the engine. 24-- 25-- :arg table: This table contains all the data that the game engine will add 26-- to this resource. It contains the following entries: 27-- 28-- **name** 29-- *Mandatory*. A string containing the internal name of this resource, e.g.:: 30-- 31-- name = "coal", 32-- 33-- **descname** 34-- *Mandatory*. The translatable display name, e.g.:: 35-- 36-- descname = _"Coal", 37-- 38-- **max_amount** 39-- *Mandatory*. The maximum possible amount of this map resource that can 40-- be placed on a map tile, e.g.:: 41-- 42-- max_amount = 20, 43-- 44-- **detectable** 45-- *Mandatory*. Set this to ``true`` if a geologist can find it (water or 46-- mountain resources), and to ``false`` otherwise (fish), e.g.:: 47-- 48-- detectable = true, 49-- 50-- **timeout_ms** 51-- *Mandatory*. Defines the time for which geologists messages for this 52-- resource will be muted within this area after a find, e.g.:: 53-- 54-- timeout_ms = 300000, 55-- 56-- **timeout_radius** 57-- *Mandatory*. Defines the radius within which geologists messages for this 58-- resource will be muted after a find, e.g.:: 59-- 60-- timeout_radius = 8, 61-- 62-- **representative_image** 63-- *Mandatory*. Path to an image file that will represent the resource in menus 64-- etc., e.g.:: 65-- 66-- representative_image = pics_dir .. "coal4.png", 67-- 68-- **editor_pictures** 69-- *Mandatory*. A table of pictures that will indicate the resource amount 70-- on the map, for use in the editor, e.g.:: 71-- 72-- editor_pictures = { 73-- [5] = pics_dir .. "coal1.png", -- Use this image for amount 0-5; 74-- [10] = pics_dir .. "coal2.png", -- Use this image for amount 6-10; 75-- [15] = pics_dir .. "coal3.png", -- Use this image for amount 11-15; 76-- [1000] = pics_dir .. "coal4.png", -- Use this image for amount > 15; 77-- } 78-- 79world:new_resource_type{ 80 name = "coal", 81 descname = _ "Coal", 82 max_amount = 20, 83 detectable = true, 84 timeout_ms = 300000, 85 timeout_radius = 8, 86 representative_image = pics_dir .. "coal4.png", 87 editor_pictures = { 88 [5] = pics_dir .. "coal1.png", 89 [10] = pics_dir .. "coal2.png", 90 [15] = pics_dir .. "coal3.png", 91 [1000] = pics_dir .. "coal4.png", 92 } 93} 94 95world:new_resource_type{ 96 name = "gold", 97 descname = _ "Gold", 98 max_amount = 20, 99 detectable = true, 100 timeout_ms = 300000, 101 timeout_radius = 8, 102 representative_image = pics_dir .. "gold4.png", 103 editor_pictures = { 104 [5] = pics_dir .. "gold1.png", 105 [10] = pics_dir .. "gold2.png", 106 [15] = pics_dir .. "gold3.png", 107 [1000] = pics_dir .. "gold4.png", 108 } 109} 110 111world:new_resource_type{ 112 name = "iron", 113 descname = _ "Iron", 114 max_amount = 20, 115 detectable = true, 116 timeout_ms = 300000, 117 timeout_radius = 8, 118 representative_image = pics_dir .. "iron4.png", 119 editor_pictures = { 120 [5] = pics_dir .. "iron1.png", 121 [10] = pics_dir .. "iron2.png", 122 [15] = pics_dir .. "iron3.png", 123 [1000] = pics_dir .. "iron4.png", 124 } 125} 126 127world:new_resource_type{ 128 name = "stones", 129 descname = _ "Stones", 130 max_amount = 20, 131 detectable = true, 132 timeout_ms = 300000, 133 timeout_radius = 8, 134 representative_image = pics_dir .. "stones4.png", 135 editor_pictures = { 136 [5] = pics_dir .. "stones1.png", 137 [10] = pics_dir .. "stones2.png", 138 [15] = pics_dir .. "stones3.png", 139 [1000] = pics_dir .. "stones4.png", 140 } 141} 142 143world:new_resource_type{ 144 name = "water", 145 descname = _ "Water", 146 max_amount = 50, 147 detectable = true, 148 timeout_ms = 300000, 149 timeout_radius = 8, 150 representative_image = pics_dir .. "water4.png", 151 editor_pictures = { 152 [10] = pics_dir .."water1.png", 153 [20] = pics_dir .."water2.png", 154 [30] = pics_dir .."water3.png", 155 [1000] = pics_dir .. "water4.png", 156 } 157} 158 159world:new_resource_type{ 160 name = "fish", 161 descname = _ "Fish", 162 max_amount = 20, 163 detectable = false, 164 timeout_ms = 0, 165 timeout_radius = 0, 166 representative_image = pics_dir .. "fish.png", 167 editor_pictures = { 168 [5] = pics_dir .. "fish1.png", 169 [10] = pics_dir .. "fish2.png", 170 [15] = pics_dir .. "fish3.png", 171 [1000] = pics_dir .. "fish4.png", 172 } 173} 174