Adds the ability to pick up all ammo from a turf using a magazine

This commit is contained in:
Mieszko Jędrzejczak
2016-04-22 23:35:56 +02:00
parent 5cf3f25892
commit c96712cbf7
2 changed files with 25 additions and 6 deletions
+24 -5
View File
@@ -38,19 +38,38 @@
var/tmp_label = ""
var/label_text = sanitize(input(user, "Inscribe some text into \the [initial(BB.name)]","Inscription",tmp_label))
if(length(label_text) > 20)
to_chat(user, "\red The inscription can be at most 20 characters long.")
to_chat(user, "<span class='warning''>The inscription can be at most 20 characters long.</span>")
else
if(label_text == "")
to_chat(user, "\blue You scratch the inscription off of [initial(BB)].")
to_chat(user, "<span class='notice'>You scratch the inscription off of [initial(BB)].</span>")
BB.name = initial(BB.name)
else
to_chat(user, "\blue You inscribe \"[label_text]\" into \the [initial(BB.name)].")
to_chat(user, "<span class='notice'>You inscribe \"[label_text]\" into \the [initial(BB.name)].</span>")
BB.name = "[initial(BB.name)] \"[label_text]\""
else
to_chat(user, "\blue You can only inscribe a metal bullet.")//because inscribing beanbags is silly
to_chat(user, "<span class='notice'>You can only inscribe a metal bullet.</span>")//because inscribing beanbags is silly
else
to_chat(user, "\blue There is no bullet in the casing to inscribe anything into.")
to_chat(user, "<span class='notice'>There is no bullet in the casing to inscribe anything into.</span>")
/obj/item/ammo_casing/attackby(obj/item/ammo_box/box as obj, mob/user as mob, params)
if(!istype(box, /obj/item/ammo_box))
return
if(isturf(src.loc))
var/boolets = 0
for(var/obj/item/ammo_casing/pew in src.loc)
if (box.stored_ammo.len >= box.max_ammo)
break
if (pew.BB)
if (box.give_round(pew))
boolets++
else
continue
if (boolets > 0)
box.update_icon()
user << "<span class='notice'>You collect [boolets] shell\s. [box] now contains [box.stored_ammo.len] shell\s.</span>"
else
user << "<span class='notice'>You fail to collect anything.</span>"
/obj/item/ammo_casing/proc/newshot() //For energy weapons, shotgun shells and wands (!).
if (!BB)
@@ -273,7 +273,7 @@
icon_state = "foamdart_empty"
desc = "Its nerf or nothing! ...Although, this one doesn't look too safe."
/obj/item/ammo_casing/caseless/foam_dart/attackby(var/obj/item/A as obj, mob/user as mob, params)
/obj/item/ammo_casing/caseless/foam_dart/attackby(var/obj/item/weapon/A as obj, mob/user as mob, params)
..()
if (istype(A, /obj/item/weapon/screwdriver) && !modified)
modified = 1