Removes a bunch of sleeps/spawns and makes a few booleans defines

This commit is contained in:
kevinz000
2017-10-14 16:53:17 -07:00
committed by CitadelStationBot
parent b200389630
commit b20e5916ea
24 changed files with 272 additions and 236 deletions
+41 -32
View File
@@ -207,7 +207,38 @@
/obj/item/gun/proc/recharge_newshot()
return
/obj/item/gun/proc/process_fire(atom/target as mob|obj|turf, mob/living/user as mob|obj, message = 1, params, zone_override, bonus_spread = 0)
/obj/item/gun/proc/process_burst(mob/living/user, atom/target, message = TRUE, params, zone_override, sprd = 0, randomized_gun_spread = 0, randomized_bonus_spread = 0, rand_spr = 0, iteration = 0)
if(!user || !firing_burst)
firing_burst = FALSE
return FALSE
if(!issilicon(user))
if( iteration > 1 && !(user.is_holding(src))) //for burst firing
firing_burst = FALSE
return FALSE
if(chambered && chambered.BB)
if(randomspread)
sprd = round((rand() - 0.5) * DUALWIELD_PENALTY_EXTRA_MULTIPLIER * (randomized_gun_spread + randomized_bonus_spread))
else //Smart spread
sprd = round((((rand_spr/burst_size) * iteration) - (0.5 + (rand_spr * 0.25))) * (randomized_gun_spread + randomized_bonus_spread))
if(!chambered.fire_casing(target, user, params, ,suppressed, zone_override, sprd))
shoot_with_empty_chamber(user)
firing_burst = FALSE
return FALSE
else
if(get_dist(user, target) <= 1) //Making sure whether the target is in vicinity for the pointblank shot
shoot_live_shot(user, 1, target, message)
else
shoot_live_shot(user, 0, target, message)
else
shoot_with_empty_chamber(user)
firing_burst = FALSE
return FALSE
process_chamber()
update_icon()
return TRUE
/obj/item/gun/proc/process_fire(atom/target as mob|obj|turf, mob/living/user as mob|obj, message = TRUE, params, zone_override, bonus_spread = 0)
add_fingerprint(user)
if(semicd)
@@ -221,34 +252,10 @@
var/randomized_bonus_spread = rand(0, bonus_spread)
if(burst_size > 1)
firing_burst = 1
firing_burst = TRUE
for(var/i = 1 to burst_size)
if(!user)
break
if(!issilicon(user))
if( i>1 && !(user.is_holding(src))) //for burst firing
break
if(chambered && chambered.BB)
if(randomspread)
sprd = round((rand() - 0.5) * DUALWIELD_PENALTY_EXTRA_MULTIPLIER * (randomized_gun_spread + randomized_bonus_spread))
else //Smart spread
sprd = round((((rand_spr/burst_size) * i) - (0.5 + (rand_spr * 0.25))) * (randomized_gun_spread + randomized_bonus_spread))
if(!chambered.fire_casing(target, user, params, ,suppressed, zone_override, sprd))
shoot_with_empty_chamber(user)
break
else
if(get_dist(user, target) <= 1) //Making sure whether the target is in vicinity for the pointblank shot
shoot_live_shot(user, 1, target, message)
else
shoot_live_shot(user, 0, target, message)
else
shoot_with_empty_chamber(user)
break
process_chamber()
update_icon()
sleep(fire_delay)
firing_burst = 0
addtimer(CALLBACK(src, .proc/process_burst, user, target, message, params, zone_override, sprd, randomized_gun_spread, randomized_bonus_spread, rand_spr, i), min(fire_delay * (i - 1), 0))
firing_burst = FALSE
else
if(chambered)
sprd = round((rand() - 0.5) * DUALWIELD_PENALTY_EXTRA_MULTIPLIER * (randomized_gun_spread + randomized_bonus_spread))
@@ -265,14 +272,16 @@
return
process_chamber()
update_icon()
semicd = 1
spawn(fire_delay)
semicd = 0
semicd = TRUE
addtimer(CALLBACK(src, .proc/reset_semicd), fire_delay)
if(user)
user.update_inv_hands()
SSblackbox.add_details("gun_fired","[src.type]")
return 1
return TRUE
/obj/item/gun/proc/reset_semicd()
semicd = FALSE
/obj/item/gun/update_icon()
..()
+1 -1
View File
@@ -150,7 +150,7 @@
toggle_gunlight()
/obj/item/gun/energy/suicide_act(mob/user)
if (src.can_shoot() && can_trigger_gun(user))
if (can_shoot() && can_trigger_gun(user))
user.visible_message("<span class='suicide'>[user] is putting the barrel of [src] in [user.p_their()] mouth. It looks like [user.p_theyre()] trying to commit suicide!</span>")
sleep(25)
if(user.is_holding(src))
@@ -469,7 +469,9 @@
layer = ABOVE_MOB_LAYER
hal_target.client.images += blood
animate(blood, pixel_x = target_pixel_x, pixel_y = target_pixel_y, alpha = 0, time = 5)
sleep(5)
addtimer(CALLBACK(src, .proc/cleanup_blood), 5)
/obj/item/projectile/hallucination/proc/cleanup_blood(image/blood)
hal_target.client.images -= blood
qdel(blood)