Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Zoom in and out for Daemonion
- -- by Alundaio
- -- [section] = { sound, fov }
- local sections_zoom_in = {
- ["wpn_pm"] = {[[weapons\nv_start]],54},
- }
- local sections_zoom_out = {
- ["wpn_pm"] = [[weapons\nv_off]],
- }
- -------------------
- -- goes in stalker_binder:update()
- -------------------
- function actor_on_update()
- local wpn = db.actor:active_item()
- if (wpn) then
- if (sections_zoom_in[wpn:section()]) then
- if (sections_zoom_in[wpn:section()][2] and device().fov < sections_zoom_in[wpn:section()][2]) then
- if not (actor_scope) then
- actor_scope = true
- actor_on_weapon_zoom_in(wpn)
- end
- else
- if (actor_scope) then
- actor_scope = nil
- actor_on_weapon_zoom_out(wpn)
- end
- end
- else
- if (actor_scope) then
- actor_scope = nil
- actor_on_weapon_zoom_out(wpn)
- end
- end
- end
- end
- -------------------
- -- actor_on_weapon_zoom_in(wpn)
- -------------------
- function actor_on_weapon_zoom_in(wpn)
- local snd = sections_zoom_in[wpn:section()] and sections_zoom_in[wpn:section()][1] and get_sound(sections_zoom_in[wpn:section()][1])
- if (snd) then
- snd:play_at_pos(db.actor,db.actor:position(),0)
- end
- end
- -------------------
- -- actor_on_weapon_zoom_out(wpn)
- -------------------
- function actor_on_weapon_zoom_out(wpn)
- local snd = sections_zoom_out[wpn:section()] and get_sound(sections_zoom_out[wpn:section()])
- if (snd) then
- snd:play_at_pos(db.actor,db.actor:position(),0)
- end
- end
- function get_sound(snd)
- if snd then
- return sound_object(snd)
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement