Commit 715b02983c01acf6a0d4b95a43a4209e5446a399
1 parent
00ce6baf
Fix for Rocket Pod in Embers of Rage
Showing
1 changed file
with
28 additions
and
23 deletions
... | ... | @@ -95,44 +95,49 @@ function _M:archeryAcquireTargets(tg, params, force) |
95 | 95 | |
96 | 96 | local weaponC, offweaponC, pf_weaponC |
97 | 97 | local use_resources |
98 | - if weapon and not params.ignore_ressources then | |
98 | + if weapon then | |
99 | 99 | weaponC = weapon.combat |
100 | 100 | max_range = math.max(max_range, weaponC.range or 6) |
101 | 101 | warn_range = math.min(warn_range, weaponC.range or 6) |
102 | - -- check resources | |
103 | - use_resources = (weaponC.use_resources or ammo.combat.use_resources) and table.mergeAdd(table.clone(weaponC.use_resources) or {}, ammo.combat.use_resources or {}) or nil | |
104 | - if use_resources then | |
105 | - local ok, kind = self:useResources(use_resources, true) | |
106 | - if not ok then | |
107 | - print("== no ressource", kind) | |
108 | - game.logPlayer(self, "#ORCHID#Your %s CANNOT SHOOT (Resource: %s%s#LAST#).", weapon:getName({do_color=true, no_add_name=true}), table.get(self.resources_def[kind], "color") or "#SALMON#", table.get(self.resources_def[kind], "name") or kind:capitalize()) | |
109 | - weaponC = nil | |
102 | + if not params.ignore_ressources then | |
103 | + -- check resources | |
104 | + use_resources = (weaponC.use_resources or ammo.combat.use_resources) and table.mergeAdd(table.clone(weaponC.use_resources) or {}, ammo.combat.use_resources or {}) or nil | |
105 | + if use_resources then | |
106 | + local ok, kind = self:useResources(use_resources, true) | |
107 | + if not ok then | |
108 | + game.logPlayer(self, "#ORCHID#Your %s CANNOT SHOOT (Resource: %s%s#LAST#).", weapon:getName({do_color=true, no_add_name=true}), table.get(self.resources_def[kind], "color") or "#SALMON#", table.get(self.resources_def[kind], "name") or kind:capitalize()) | |
109 | + weaponC = nil | |
110 | + end | |
110 | 111 | end |
111 | 112 | end |
112 | 113 | end |
113 | - if offweapon and not params.ignore_ressources then | |
114 | + if offweapon then | |
114 | 115 | offweaponC = offweapon.combat |
115 | 116 | max_range = math.max(max_range, offweaponC.range or 6) |
116 | 117 | warn_range = math.min(warn_range, offweaponC.range or 6) |
117 | - use_resources = (offweaponC.use_resources or ammo.combat.use_resources) and table.mergeAdd(table.clone(offweaponC.use_resources) or {}, ammo.combat.use_resources or {}) or nil | |
118 | - if use_resources then | |
119 | - local ok, kind = self:useResources(use_resources, true) | |
120 | - if not ok then | |
121 | - game.logPlayer(self, "#ORCHID#Your %s CANNOT SHOOT (Resource: %s%s#LAST#).", offweapon:getName({do_color=true, no_add_name=true}), table.get(self.resources_def[kind], "color") or "#SALMON#", table.get(self.resources_def[kind], "name") or kind:capitalize()) | |
122 | - offweaponC = nil | |
118 | + if not params.ignore_ressources then | |
119 | + use_resources = (offweaponC.use_resources or ammo.combat.use_resources) and table.mergeAdd(table.clone(offweaponC.use_resources) or {}, ammo.combat.use_resources or {}) or nil | |
120 | + if use_resources then | |
121 | + local ok, kind = self:useResources(use_resources, true) | |
122 | + if not ok then | |
123 | + game.logPlayer(self, "#ORCHID#Your %s CANNOT SHOOT (Resource: %s%s#LAST#).", offweapon:getName({do_color=true, no_add_name=true}), table.get(self.resources_def[kind], "color") or "#SALMON#", table.get(self.resources_def[kind], "name") or kind:capitalize()) | |
124 | + offweaponC = nil | |
125 | + end | |
123 | 126 | end |
124 | 127 | end |
125 | 128 | end |
126 | - if pf_weapon and not params.ignore_ressources then | |
129 | + if pf_weapon then | |
127 | 130 | pf_weaponC = pf_weapon.combat |
128 | 131 | max_range = math.max(max_range, pf_weaponC.range or 6) |
129 | 132 | warn_range = math.min(warn_range, pf_weaponC.range or 6) |
130 | - use_resources = (pf_weaponC.use_resources or ammo.combat.use_resources) and table.mergeAdd(table.clone(pf_weaponC.use_resources) or {}, ammo.combat.use_resources or {}) or nil | |
131 | - if use_resources then | |
132 | - local ok, kind = self:useResources(use_resources, true) | |
133 | - if not ok then | |
134 | - game.logPlayer(self, "#ORCHID#Your %s CANNOT SHOOT (Resource: %s%s#LAST#).", pf_weapon:getName({do_color=true, no_add_name=true}), table.get(self.resources_def[kind], "color") or "#SALMON#", table.get(self.resources_def[kind], "name") or kind:capitalize()) | |
135 | - pf_weaponC = nil | |
133 | + if not params.ignore_ressources then | |
134 | + use_resources = (pf_weaponC.use_resources or ammo.combat.use_resources) and table.mergeAdd(table.clone(pf_weaponC.use_resources) or {}, ammo.combat.use_resources or {}) or nil | |
135 | + if use_resources then | |
136 | + local ok, kind = self:useResources(use_resources, true) | |
137 | + if not ok then | |
138 | + game.logPlayer(self, "#ORCHID#Your %s CANNOT SHOOT (Resource: %s%s#LAST#).", pf_weapon:getName({do_color=true, no_add_name=true}), table.get(self.resources_def[kind], "color") or "#SALMON#", table.get(self.resources_def[kind], "name") or kind:capitalize()) | |
139 | + pf_weaponC = nil | |
140 | + end | |
136 | 141 | end |
137 | 142 | end |
138 | 143 | end | ... | ... |
-
Please register or login to post a comment