Commit 0360b756c8d9b211105b588b22d8f7e1324ccd24

Authored by DarkGod
1 parent e3a437fd

New hook "Actor:updateModdableTile:weapon"

... ... @@ -4084,8 +4084,7 @@ function _M:getObjectModdableTile(slot)
4084 4084 return o
4085 4085 end
4086 4086
4087   ---- Update tile for races that can handle it
4088   -function _M:updateModdableTile()
  4087 +function _M:updateModdableTilePrepare()
4089 4088 local selfbase = self.replace_display or self
4090 4089 if not selfbase.moddable_tile or Map.tiles.no_moddable_tiles then
4091 4090 local add = selfbase.add_mos or {}
... ... @@ -4120,9 +4119,15 @@ function _M:updateModdableTile()
4120 4119 self:removeAllMOs()
4121 4120 if self.x and game.level then game.level.map:updateMap(self.x, self.y) end
4122 4121 end
4123   - return
  4122 + return false
4124 4123 end
4125 4124 self:removeAllMOs()
  4125 + return true
  4126 +end
  4127 +
  4128 +--- Update tile for races that can handle it
  4129 +function _M:updateModdableTile()
  4130 + if not self:updateModdableTilePrepare() then return end
4126 4131
4127 4132 local base = "player/"..self.moddable_tile:gsub("#sex#", self.female and "female" or "male").."/"
4128 4133
... ... @@ -4148,11 +4153,15 @@ function _M:updateModdableTile()
4148 4153 if self.moddable_tile_tatoo then add[#add+1] = {image = base..self.moddable_tile_tatoo..".png", auto_tall=1} end
4149 4154
4150 4155 if not self:attr("disarmed") then
4151   - i = self:getObjectModdableTile(self.INVEN_MAINHAND); if i and i.moddable_tile_back then
4152   - add[#add+1] = {image = base..(i.moddable_tile_back):format("right")..".png", auto_tall=1}
4153   - end
4154   - i = self:getObjectModdableTile(self.INVEN_OFFHAND); if i and i.moddable_tile_back then
4155   - add[#add+1] = {image = base..(i.moddable_tile_back):format("left")..".png", auto_tall=1}
  4156 + local hd = {"Actor:updateModdableTile:weapon", base=base, add=add, back=true, replace=false}
  4157 + self:triggerHook(hd)
  4158 + if not hd.replace then
  4159 + i = self:getObjectModdableTile(self.INVEN_MAINHAND); if i and i.moddable_tile_back then
  4160 + add[#add+1] = {image = base..(i.moddable_tile_back):format("right")..".png", auto_tall=1}
  4161 + end
  4162 + i = self:getObjectModdableTile(self.INVEN_OFFHAND); if i and i.moddable_tile_back then
  4163 + add[#add+1] = {image = base..(i.moddable_tile_back):format("left")..".png", auto_tall=1}
  4164 + end
4156 4165 end
4157 4166 end
4158 4167
... ... @@ -4176,18 +4185,23 @@ function _M:updateModdableTile()
4176 4185
4177 4186 i = self:getObjectModdableTile(self.INVEN_HANDS); if i and i.moddable_tile then add[#add+1] = {image = base..(i.moddable_tile)..".png", auto_tall=1} end
4178 4187 i = self:getObjectModdableTile(self.INVEN_QUIVER); if i and i.moddable_tile then add[#add+1] = {image = base..(i.moddable_tile)..".png", auto_tall=1} end
  4188 +
4179 4189 if not self:attr("disarmed") then
4180   - i = self:getObjectModdableTile(self.INVEN_MAINHAND); if i and i.moddable_tile then
4181   - add[#add+1] = {image = base..(i.moddable_tile):format("right")..".png", auto_tall=1}
4182   - if i.moddable_tile_particle then
4183   - add[#add].particle = i.moddable_tile_particle[1]
4184   - add[#add].particle_args = i.moddable_tile_particle[2]
  4190 + local hd = {"Actor:updateModdableTile:weapon", base=base, add=add, front=true, replace=false}
  4191 + self:triggerHook(hd)
  4192 + if not hd.replace then
  4193 + i = self:getObjectModdableTile(self.INVEN_MAINHAND); if i and i.moddable_tile then
  4194 + add[#add+1] = {image = base..(i.moddable_tile):format("right")..".png", auto_tall=1}
  4195 + if i.moddable_tile_particle then
  4196 + add[#add].particle = i.moddable_tile_particle[1]
  4197 + add[#add].particle_args = i.moddable_tile_particle[2]
  4198 + end
  4199 + if i.moddable_tile_ornament then add[#add+1] = {image = base..(i.moddable_tile_ornament):format("right")..".png", auto_tall=1} end
  4200 + end
  4201 + i = self:getObjectModdableTile(self.INVEN_OFFHAND); if i and i.moddable_tile then
  4202 + add[#add+1] = {image = base..(i.moddable_tile):format("left")..".png", auto_tall=1}
  4203 + if i.moddable_tile_ornament then add[#add+1] = {image = base..(i.moddable_tile_ornament):format("left")..".png", auto_tall=1} end
4185 4204 end
4186   - if i.moddable_tile_ornament then add[#add+1] = {image = base..(i.moddable_tile_ornament):format("right")..".png", auto_tall=1} end
4187   - end
4188   - i = self:getObjectModdableTile(self.INVEN_OFFHAND); if i and i.moddable_tile then
4189   - add[#add+1] = {image = base..(i.moddable_tile):format("left")..".png", auto_tall=1}
4190   - if i.moddable_tile_ornament then add[#add+1] = {image = base..(i.moddable_tile_ornament):format("left")..".png", auto_tall=1} end
4191 4205 end
4192 4206 end
4193 4207
... ...