Does more work on circuits.

This commit is contained in:
Neerti
2016-08-06 09:56:16 -04:00
parent 94e3e688cc
commit 4efd5c4af6
12 changed files with 756 additions and 16 deletions

View File

@@ -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