diff --git a/game/modules/tome/class/Player.lua b/game/modules/tome/class/Player.lua index 64e9341d34bdf31e11ad3d24ad9b77a495379a64..e4a67081e0cb5182ad6860b49f2b9b97caa091a8 100644 --- a/game/modules/tome/class/Player.lua +++ b/game/modules/tome/class/Player.lua @@ -79,6 +79,7 @@ function _M:init(t, no_default) t.rank = t.rank or 3 t.old_life = 0 + t.old_air = 0 t.money_value_multiplier = t.money_value_multiplier or 1 -- changes amounts in gold piles and such @@ -248,6 +249,7 @@ function _M:act() self:updateMainShader() self.old_life = self.life + self.old_air = self.air -- Clean log flasher -- game.flash:empty() @@ -277,6 +279,11 @@ function _M:updateMainShader() if self.life < self.max_life / 2 then game.fbo_shader:setUniform("hp_warning", 1 - (self.life / self.max_life)) else game.fbo_shader:setUniform("hp_warning", 0) end end + -- Set shader air warning + if self.air ~= self.old_air then + if self.air < self.max_air / 2 then game.fbo_shader:setUniform("air_warning", 1 - (self.air / self.max_air)) + else game.fbo_shader:setUniform("air_warning", 0) end + end -- Colorize shader if self:attr("stealth") then game.fbo_shader:setUniform("colorize", {0.9,0.9,0.9,0.6}) @@ -953,7 +960,7 @@ function _M:playerUseItem(object, item, inven) self:breakStepUp() self:breakStealth() self:breakLightningSpeed() - self:breakGatherTheThreads() + self:breakReloading() self.changed = true end) local ok, ret = coroutine.resume(co) diff --git a/game/modules/tome/data/gfx/shaders/main_fbo.frag b/game/modules/tome/data/gfx/shaders/main_fbo.frag index b83593f799f35de17295f44c00b1f323c9eec3b1..d72f7c363eba4e476fa92ff04866910f09ce879f 100644 --- a/game/modules/tome/data/gfx/shaders/main_fbo.frag +++ b/game/modules/tome/data/gfx/shaders/main_fbo.frag @@ -1,4 +1,5 @@ uniform float hp_warning; +uniform float air_warning; uniform float motionblur; uniform float blur; uniform float tick; @@ -113,6 +114,13 @@ void main(void) float dist = length(gl_TexCoord[0].xy - vec2(0.5)) / 2.0; gl_FragColor = mix(gl_FragColor, hp_warning_color, dist); } + + if (air_warning > 0.0) + { + vec4 air_warning_color = vec4(0.0, air_warning / 3.0, air_warning / 1.0, air_warning / 1.3); + float dist = length(gl_TexCoord[0].xy - vec2(0.5)) / 2.0; + gl_FragColor = mix(gl_FragColor, air_warning_color, dist); + } } /*uniform sampler2D tex;