Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local stored_ammo_num = nil
- local stored_it_id = nil
- function rigged_wpn_update()
- local aitem = db.actor:active_item()
- local aslot = db.actor:active_slot()
- if aitem and isWeapon(aitem) then
- local it_id = aitem:id()
- local ammo_num = aitem:get_ammo_in_magazine()
- if stored_it_id ~= nil and stored_ammo_num ~= nil then
- if stored_it_id == it_id and ammo_num < stored_ammo_num and string.find(aitem:section(), "rigged") then
- local explode_vec = vector():set(db.actor:position()):sub(aitem:position())
- local explode = hit()
- explode.direction = explode_vec
- explode.draftsman = db.actor
- explode.impulse = real_rand(0.1,0.7)
- explode.power = real_rand(0.2,0.6)
- explode.type = hit.explosion
- db.actor:hit(explode)
- remove_item(aitem)
- play_sound([[weapons\\wpn_explode]])
- particles_object("amik\\explosion\\explosion_f1"):play_at_pos(aitem:position())
- end
- end
- stored_ammo_num = ammo_num
- stored_it_id = it_id
- else
- stored_it_id = nil
- end
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement