Daemonion

rain on clothes

Feb 18th, 2013
557
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. ---------------------------------------------------------------------------
  2. -- Rain on Clothes by Daemonion
  3. -- Thanks to EvanTheUseless, Decane and NatVac
  4.  
  5. function rain_on_clothes()
  6.     local actor = db.actor
  7.     local rain_fps_l = xr_sound.get_safe_sound_object ("daemonion\\misc\\rain_test_l")
  8.     local rain_fps_r = xr_sound.get_safe_sound_object ("daemonion\\misc\\rain_test_r")
  9.    
  10.     if not has_alife_info("interior_whitenoise_playing") and  level.rain_factor() > 0.03 then
  11.         -- c_print("it is raining; player is outside restrictor")
  12.         if rain_fps_l:playing() == false and rain_fps_r:playing() == false then
  13.             -- c_print("playing sounds")
  14.             rain_fps_l:play_at_pos (actor, vector():set(-5, 0, 1), 0, sound_object.s2d)
  15.             rain_fps_r:play_at_pos (actor, vector():set(5, 0, 1), 0, sound_object.s2d)
  16.         end
  17.     elseif level.rain_factor == 0 then
  18.         -- c_print("not raining; stopping")
  19.         rain_fps_l:stop()
  20.         rain_fps_r:stop()
  21.        
  22.     elseif has_alife_info("interior_whitenoise_playing") then
  23.         -- c_print("player indoors; audio stopped")
  24.         rain_fps_l:stop()
  25.         rain_fps_r:stop()      
  26.     end
  27. end
RAW Paste Data