Merge pull request #21810 from MrPerson/his_coconut_gun_fires_in_spurts_if_he_shoots_ya_its_gonna_hurt

Snack trash generation rework
This commit is contained in:
Cheridan
2016-11-29 13:32:05 -06:00
committed by GitHub
3 changed files with 25 additions and 25 deletions
@@ -48,8 +48,7 @@
if(!user.unEquip(I))
return
if(S.trash)
new S.trash(get_turf(user))
S.trash = null //we remove the plate before adding the ingredient
S.generate_trash(get_turf(user))
ingredients += S
S.loc = src
mix_filling_color(S)
+15 -12
View File
@@ -25,19 +25,9 @@
return
if(!reagents.total_volume)
usr.unEquip(src) //so icons update :[
if(trash)
if(ispath(trash, /obj/item/weapon/grown) && istype(src, /obj/item/weapon/reagent_containers/food/snacks/grown))
var/obj/item/weapon/reagent_containers/food/snacks/grown/G = src
var/obj/item/TrashItem = new trash(usr, G.seed)
usr.put_in_hands(TrashItem)
else if(ispath(trash,/obj/item))
var/obj/item/TrashItem = new trash(usr)
usr.put_in_hands(TrashItem)
else if(istype(trash,/obj/item))
usr.put_in_hands(trash)
var/obj/item/trash_item = generate_trash(usr)
usr.put_in_hands(trash_item)
qdel(src)
return
/obj/item/weapon/reagent_containers/food/snacks/attack_self(mob/user)
@@ -209,6 +199,19 @@
reagents.trans_to(slice,reagents_per_slice)
return
/obj/item/weapon/reagent_containers/food/snacks/proc/generate_trash(atom/location)
if(trash)
if(ispath(trash, /obj/item))
. = new trash(location)
trash = null
return
else if(istype(trash, /obj/item))
var/obj/item/trash_item = trash
trash_item.forceMove(location)
. = trash
trash = null
return
/obj/item/weapon/reagent_containers/food/snacks/proc/update_overlays(obj/item/weapon/reagent_containers/food/snacks/S)
cut_overlays()
var/image/I = new(src.icon, "[initial(icon_state)]_filling")
+9 -11
View File
@@ -106,10 +106,7 @@
new splat_type(T)
if(trash)
if(ispath(trash, /obj/item/weapon/grown) || ispath(trash, /obj/item/weapon/reagent_containers/food/snacks/grown))
new trash(T, seed)
else
new trash(T)
generate_trash(T)
visible_message("<span class='warning'>[src] has been squashed.</span>","<span class='italics'>You hear a smack.</span>")
if(seed)
@@ -159,17 +156,18 @@
user.AddLuminosity(-G.get_lum(seed))
SetLuminosity(G.get_lum(seed))
/obj/item/weapon/reagent_containers/food/snacks/grown/generate_trash(atom/location)
if(trash && ispath(trash, /obj/item/weapon/grown))
. = new trash(location, seed)
trash = null
return
return ..()
// For item-containing growns such as eggy or gatfruit
/obj/item/weapon/reagent_containers/food/snacks/grown/shell/attack_self(mob/user as mob)
/obj/item/weapon/reagent_containers/food/snacks/grown/shell/attack_self(mob/user)
user.unEquip(src)
if(trash)
var/obj/item/weapon/T
if(ispath(trash, /obj/item/weapon/grown) || ispath(trash, /obj/item/weapon/reagent_containers/food/snacks/grown))
T = new trash(user.loc, seed)
else
T = new trash(user.loc)
var/obj/item/T = generate_trash()
user.put_in_hands(T)
user << "<span class='notice'>You open [src]\'s shell, revealing \a [T].</span>"
qdel(src)