Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- used for LURK 1.2
- -- Checks on item condition
- -- When condition changes (ie, when fired), a script can be injected
- -- In this case, we use it to play audio
- local activeItem = nil --last recorded active item
- local oldCondition = 0 --condition of activeItem
- -- TODO(AndrewD) These are for playing around... hard coded.
- local random_sub = 1
- local random_reflection = 1
- local hc_reflection_outdoors_left = xr_sound.get_safe_sound_object("daemonion\\weapons\\reflection_outdoors_" ..random_reflection.. "_l")
- local hc_reflection_outdoors_right = xr_sound.get_safe_sound_object("daemonion\\weapons\\reflection_outdoors_" ..random_reflection.. "_r")
- local hc_sub = xr_sound.get_safe_sound_object("daemonion\\weapons\\sub_9x18_" ..random_sub..)
- function update()
- if (db.actor:active_item() ~= nil) then --if any item is active
- local newItem = db.actor:active_item()
- local newCondition = newItem:condition()
- if activeItem == nil then --if this is the first time running
- activeItem = newItem
- end
- if (newItem:id() ~= activeItem:id()) then --if actor switches items, record the new information
- activeItem = newItem
- oldCondition = newCondition
- end
- if (oldCondition > newCondition) then --if condition of the active item decreases
- oldCondition = newCondition
- -- TODO(AndrewD) Just playing around. Assume this is THE place to initiate firearms sounds...
- -- Assumes we are always using the makarov since i don't know how to get metadata
- if not has_alife_info("interior_whitenoise_playing") then
- random_sub = math.random(1,3)
- random_reflection = math.random(1,3)
- hc_reflection_outdoors_left:play_at_pos(db.actor, vector():set(-5, 0, 1), 0, sound_object.s2d)
- hc_reflection_outdoors_right:play_at_pos(db.actor, vector():set(5, 0, 1), 0, sound_object.s2d)
- hc_sub:play_at_pos(db.actor, db.actor:position())
- end
- end
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement