mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 02:34:00 +00:00
Does more work on circuits.
This commit is contained in:
@@ -254,6 +254,76 @@
|
||||
if(muzzle_flash)
|
||||
set_light(0)
|
||||
|
||||
// Similar to the above proc, but does not require a user, which is ideal for things like turrets.
|
||||
/obj/item/weapon/gun/proc/Fire_userless(atom/target)
|
||||
if(!target)
|
||||
return
|
||||
|
||||
if(world.time < next_fire_time)
|
||||
return
|
||||
|
||||
var/shoot_time = (burst - 1)* burst_delay
|
||||
next_fire_time = world.time + shoot_time
|
||||
|
||||
var/turf/targloc = get_turf(target) //cache this in case target gets deleted during shooting, e.g. if it was a securitron that got destroyed.
|
||||
for(var/i in 1 to burst)
|
||||
var/obj/projectile = consume_next_projectile()
|
||||
if(!projectile)
|
||||
handle_click_empty()
|
||||
break
|
||||
|
||||
if(istype(projectile, /obj/item/projectile))
|
||||
var/obj/item/projectile/P = projectile
|
||||
|
||||
var/acc = burst_accuracy[min(i, burst_accuracy.len)]
|
||||
var/disp = dispersion[min(i, dispersion.len)]
|
||||
|
||||
P.accuracy = accuracy + acc
|
||||
P.dispersion = disp
|
||||
|
||||
P.shot_from = src.name
|
||||
P.silenced = silenced
|
||||
|
||||
P.launch(target)
|
||||
|
||||
if(silenced)
|
||||
playsound(src, fire_sound, 10, 1)
|
||||
else
|
||||
playsound(src, fire_sound, 50, 1)
|
||||
|
||||
if(muzzle_flash)
|
||||
set_light(muzzle_flash)
|
||||
update_icon()
|
||||
|
||||
//process_accuracy(projectile, user, target, acc, disp)
|
||||
|
||||
// if(pointblank)
|
||||
// process_point_blank(projectile, user, target)
|
||||
|
||||
// if(process_projectile(projectile, null, target, user.zone_sel.selecting, clickparams))
|
||||
// handle_post_fire(null, target, pointblank, reflex)
|
||||
|
||||
// update_icon()
|
||||
|
||||
if(i < burst)
|
||||
sleep(burst_delay)
|
||||
|
||||
if(!(target && target.loc))
|
||||
target = targloc
|
||||
//pointblank = 0
|
||||
|
||||
log_and_message_admins("Fired [src].")
|
||||
|
||||
//admin_attack_log(usr, attacker_message="Fired [src]", admin_message="fired a gun ([src]) (MODE: [src.mode_name]) [reflex ? "by reflex" : "manually"].")
|
||||
|
||||
//update timing
|
||||
next_fire_time = world.time + fire_delay
|
||||
|
||||
if(muzzle_flash)
|
||||
set_light(0)
|
||||
|
||||
|
||||
|
||||
//obtains the next projectile to fire
|
||||
/obj/item/weapon/gun/proc/consume_next_projectile()
|
||||
return null
|
||||
|
||||
Reference in New Issue
Block a user