General bugfixing

Moved cell charger emag behaviour into the general system. Damn you, dylan.
Fixed #4849, helmet wasn't updating the right icons.
Fixes a runtime (caused by bees) with static_overlays.
Absolute pathed shotgun.dm, also fixed #4499, shotgun now keeps shells loaded.
This commit is contained in:
ComicIronic
2015-06-06 16:01:44 +01:00
parent f31d8eba00
commit 2f9fd5f506
5 changed files with 92 additions and 83 deletions

View File

@@ -55,6 +55,8 @@
usr << "You push the [src] up out of your face."
usr.update_inv_head() //so our mob-overlays update
usr.update_inv_wear_mask()
usr.update_inv_glasses()
usr.update_inv_ears()
/*

View File

@@ -1,7 +1,7 @@
/mob/living/New()
. = ..()
generate_static_overlay()
if(static_overlays.len)
if(static_overlays && static_overlays.len)
for(var/mob/living/silicon/robot/mommi/MoMMI in player_list)
if(MoMMI.can_see_static())
if(MoMMI.static_choice in static_overlays)
@@ -17,7 +17,8 @@
MoMMI.static_overlays.Remove(I) //no checks, since it's either there or its not
MoMMI.client.images.Remove(I)
del(I)
static_overlays.len = 0
if(static_overlays)
static_overlays = null
. = ..()
/mob/living/Life()

View File

@@ -21,43 +21,43 @@
gun_flags = 0
isHandgun()
/obj/item/weapon/gun/projectile/shotgun/pump/isHandgun()
return 0
attack_self(mob/living/user as mob)
if(recentpump) return
pump(user)
recentpump = 1
spawn(10)
recentpump = 0
return
/obj/item/weapon/gun/projectile/shotgun/pump/attack_self(mob/living/user as mob)
if(recentpump) return
pump(user)
recentpump = 1
spawn(10)
recentpump = 0
return
process_chambered()
if(in_chamber)
return 1
else if(current_shell && current_shell.BB)
in_chamber = current_shell.BB //Load projectile into chamber.
current_shell.BB.loc = src //Set projectile loc to gun.
current_shell.BB = null
current_shell.update_icon()
return 1
return 0
proc/pump(mob/M as mob)
playsound(M, 'sound/weapons/shotgunpump.ogg', 60, 1)
pumped = 0
if(current_shell)//We have a shell in the chamber
current_shell.loc = get_turf(src)//Eject casing
current_shell = null
if(in_chamber)
in_chamber = null
if(!getAmmo())
return 0
var/obj/item/ammo_casing/AC = loaded[1] //load next casing.
loaded -= AC //Remove casing from loaded list.
current_shell = AC
update_icon() //I.E. fix the desc
/obj/item/weapon/gun/projectile/shotgun/pump/process_chambered()
if(in_chamber)
return 1
else if(current_shell && current_shell.BB)
in_chamber = current_shell.BB //Load projectile into chamber.
current_shell.BB.loc = src //Set projectile loc to gun.
current_shell.BB = null
current_shell.update_icon()
return 1
return 0
/obj/item/weapon/gun/projectile/shotgun/pump/proc/pump(mob/M as mob)
playsound(M, 'sound/weapons/shotgunpump.ogg', 60, 1)
pumped = 0
if(current_shell)//We have a shell in the chamber
current_shell.loc = get_turf(src)//Eject casing
current_shell = null
if(in_chamber)
in_chamber = null
if(!getAmmo())
return 0
var/obj/item/ammo_casing/AC = loaded[1] //load next casing.
loaded -= AC //Remove casing from loaded list.
current_shell = AC
update_icon() //I.E. fix the desc
return 1
/obj/item/weapon/gun/projectile/shotgun/pump/combat
name = "combat shotgun"
@@ -84,52 +84,53 @@
origin_tech = "combat=3;materials=1"
ammo_type = "/obj/item/ammo_casing/shotgun/beanbag"
process_chambered()
if(in_chamber)
return 1
if(!getAmmo())
return 0
var/obj/item/ammo_casing/AC = loaded[1] //load next casing.
loaded -= AC //Remove casing from loaded list.
if(AC.BB)
in_chamber = AC.BB //Load projectile into chamber.
AC.BB.loc = src //Set projectile loc to gun.
AC.BB = null
AC.update_icon()
return 1
/obj/item/weapon/gun/projectile/shotgun/doublebarrel/process_chambered()
if(in_chamber)
return 1
if(!getAmmo())
return 0
var/obj/item/ammo_casing/AC = loaded[1] //load next casing.
loaded -= AC //Remove casing from loaded list.
loaded += AC //Put it in at the end - because it hasn't been ejected yet
if(AC.BB)
in_chamber = AC.BB //Load projectile into chamber.
AC.BB.loc = src //Set projectile loc to gun.
AC.BB = null
AC.update_icon()
return 1
return 0
attack_self(mob/living/user as mob)
if(!(locate(/obj/item/ammo_casing/shotgun) in src) && !getAmmo())
user << "<span class='notice'>\The [src] is empty.</span>"
/obj/item/weapon/gun/projectile/shotgun/doublebarrel/attack_self(mob/living/user as mob)
if(!(locate(/obj/item/ammo_casing/shotgun) in src) && !getAmmo())
user << "<span class='notice'>\The [src] is empty.</span>"
return
for(var/obj/item/ammo_casing/shotgun/shell in src) //This feels like a hack. //don't code at 3:30am kids!!
if(shell in loaded)
loaded -= shell
shell.loc = get_turf(src.loc)
user << "<span class='notice'>You break \the [src].</span>"
update_icon()
/obj/item/weapon/gun/projectile/shotgun/doublebarrel/attackby(var/obj/item/A as obj, mob/user as mob)
..()
A.update_icon()
update_icon()
if(istype(A, /obj/item/weapon/circular_saw) || istype(A, /obj/item/weapon/melee/energy) || istype(A, /obj/item/weapon/pickaxe/plasmacutter))
user << "<span class='notice'>You begin to shorten the barrel of \the [src].</span>"
if(getAmmo())
afterattack(user, user) //will this work?
afterattack(user, user) //it will. we call it twice, for twice the FUN
playsound(user, fire_sound, 50, 1)
user.visible_message("<span class='danger'>The shotgun goes off!</span>", "<span class='danger'>The shotgun goes off in your face!</span>")
return
for(var/obj/item/ammo_casing/shotgun/shell in src) //This feels like a hack. //don't code at 3:30am kids!!
if(shell in loaded)
loaded -= shell
shell.loc = get_turf(src.loc)
user << "<span class='notice'>You break \the [src].</span>"
update_icon()
attackby(var/obj/item/A as obj, mob/user as mob)
..()
A.update_icon()
update_icon()
if(istype(A, /obj/item/weapon/circular_saw) || istype(A, /obj/item/weapon/melee/energy) || istype(A, /obj/item/weapon/pickaxe/plasmacutter))
user << "<span class='notice'>You begin to shorten the barrel of \the [src].</span>"
if(getAmmo())
afterattack(user, user) //will this work?
afterattack(user, user) //it will. we call it twice, for twice the FUN
playsound(user, fire_sound, 50, 1)
user.visible_message("<span class='danger'>The shotgun goes off!</span>", "<span class='danger'>The shotgun goes off in your face!</span>")
return
if(do_after(user, 30)) //SHIT IS STEALTHY EYYYYY
icon_state = "sawnshotgun"
w_class = 3.0
item_state = "gun"
slot_flags &= ~SLOT_BACK //you can't sling it on your back
slot_flags |= SLOT_BELT //but you can wear it on your belt (poorly concealed under a trenchcoat, ideally)
name = "sawn-off shotgun"
desc = "Omar's coming!"
user << "<span class='warning'>You shorten the barrel of \the [src]!</span>"
if(do_after(user, 30)) //SHIT IS STEALTHY EYYYYY
icon_state = "sawnshotgun"
w_class = 3.0
item_state = "gun"
slot_flags &= ~SLOT_BACK //you can't sling it on your back
slot_flags |= SLOT_BELT //but you can wear it on your belt (poorly concealed under a trenchcoat, ideally)
name = "sawn-off shotgun"
desc = "Omar's coming!"
user << "<span class='warning'>You shorten the barrel of \the [src]!</span>"