mirror of
https://github.com/Aurorastation/Aurora.3.git
synced 2026-08-26 22:42:26 +01:00
Baymerge changed the attack proc, i think by removing a default value, and a lot of things broke because they weren't using the function correctly. This proc does three main things. Adds a default to /obj/item/proc/attack to target the chest when no target zone is supplied. Fixes the lack of a target zone in many attack procs, properly defining it so it'll get passed to the parent, and ensure that bodypart-specific targeting works. Removes most instances of code to retrieve the user's selected zone, and instead to use the zone passed into the attack function. saves duplication of effort.
283 lines
8.8 KiB
Plaintext
283 lines
8.8 KiB
Plaintext
/*
|
|
* The 'fancy' path is for objects like donut boxes that show how many items are in the storage item on the sprite itself
|
|
* .. Sorry for the shitty path name, I couldnt think of a better one.
|
|
*
|
|
* WARNING: var/icon_type is used for both examine text and sprite name. Please look at the procs below and adjust your sprite names accordingly
|
|
* TODO: Cigarette boxes should be ported to this standard
|
|
*
|
|
* Contains:
|
|
* Donut Box
|
|
* Egg Box
|
|
* Candle Box
|
|
* Crayon Box
|
|
* Cigarette Box
|
|
*/
|
|
|
|
/obj/item/weapon/storage/fancy/
|
|
icon = 'icons/obj/food.dmi'
|
|
icon_state = "donutbox6"
|
|
name = "donut box"
|
|
var/icon_type = "donut"
|
|
|
|
/obj/item/weapon/storage/fancy/update_icon(var/itemremoved = 0)
|
|
var/total_contents = src.contents.len - itemremoved
|
|
src.icon_state = "[src.icon_type]box[total_contents]"
|
|
return
|
|
|
|
/obj/item/weapon/storage/fancy/examine(mob/user)
|
|
if(!..(user, 1))
|
|
return
|
|
|
|
if(contents.len <= 0)
|
|
user << "There are no [src.icon_type]s left in the box."
|
|
else if(contents.len == 1)
|
|
user << "There is one [src.icon_type] left in the box."
|
|
else
|
|
user << "There are [src.contents.len] [src.icon_type]s in the box."
|
|
|
|
return
|
|
|
|
/*
|
|
* Egg Box
|
|
*/
|
|
|
|
/obj/item/weapon/storage/fancy/egg_box
|
|
icon = 'icons/obj/food.dmi'
|
|
icon_state = "eggbox"
|
|
icon_type = "egg"
|
|
name = "egg box"
|
|
storage_slots = 12
|
|
can_hold = list(
|
|
/obj/item/weapon/reagent_containers/food/snacks/egg,
|
|
/obj/item/weapon/reagent_containers/food/snacks/boiledegg
|
|
)
|
|
|
|
/obj/item/weapon/storage/fancy/egg_box/New()
|
|
..()
|
|
for(var/i=1; i <= storage_slots; i++)
|
|
new /obj/item/weapon/reagent_containers/food/snacks/egg(src)
|
|
return
|
|
|
|
/*
|
|
* Candle Box
|
|
*/
|
|
|
|
/obj/item/weapon/storage/fancy/candle_box
|
|
name = "candle pack"
|
|
desc = "A pack of red candles."
|
|
icon = 'icons/obj/candle.dmi'
|
|
icon_state = "candlebox5"
|
|
icon_type = "candle"
|
|
item_state = "candlebox5"
|
|
throwforce = 2
|
|
slot_flags = SLOT_BELT
|
|
|
|
|
|
/obj/item/weapon/storage/fancy/candle_box/New()
|
|
..()
|
|
for(var/i=1; i <= 5; i++)
|
|
new /obj/item/weapon/flame/candle(src)
|
|
return
|
|
|
|
/*
|
|
* Crayon Box
|
|
*/
|
|
|
|
/obj/item/weapon/storage/fancy/crayons
|
|
name = "box of crayons"
|
|
desc = "A box of crayons for all your rune drawing needs."
|
|
icon = 'icons/obj/crayons.dmi'
|
|
icon_state = "crayonbox"
|
|
w_class = 2.0
|
|
icon_type = "crayon"
|
|
can_hold = list(
|
|
/obj/item/weapon/pen/crayon
|
|
)
|
|
|
|
/obj/item/weapon/storage/fancy/crayons/New()
|
|
..()
|
|
new /obj/item/weapon/pen/crayon/red(src)
|
|
new /obj/item/weapon/pen/crayon/orange(src)
|
|
new /obj/item/weapon/pen/crayon/yellow(src)
|
|
new /obj/item/weapon/pen/crayon/green(src)
|
|
new /obj/item/weapon/pen/crayon/blue(src)
|
|
new /obj/item/weapon/pen/crayon/purple(src)
|
|
update_icon()
|
|
|
|
/obj/item/weapon/storage/fancy/crayons/update_icon()
|
|
overlays = list() //resets list
|
|
overlays += image('icons/obj/crayons.dmi',"crayonbox")
|
|
for(var/obj/item/weapon/pen/crayon/crayon in contents)
|
|
overlays += image('icons/obj/crayons.dmi',crayon.colourName)
|
|
|
|
/obj/item/weapon/storage/fancy/crayons/attackby(obj/item/W as obj, mob/user as mob)
|
|
if(istype(W,/obj/item/weapon/pen/crayon))
|
|
switch(W:colourName)
|
|
if("mime")
|
|
usr << "This crayon is too sad to be contained in this box."
|
|
return
|
|
if("rainbow")
|
|
usr << "This crayon is too powerful to be contained in this box."
|
|
return
|
|
..()
|
|
|
|
////////////
|
|
//CIG PACK//
|
|
////////////
|
|
/obj/item/weapon/storage/fancy/cigarettes
|
|
name = "cigarette packet"
|
|
desc = "The most popular brand of Space Cigarettes, sponsors of the Space Olympics."
|
|
icon = 'icons/obj/cigarettes.dmi'
|
|
icon_state = "cigpacket"
|
|
item_state = "cigpacket"
|
|
w_class = 1
|
|
throwforce = 2
|
|
slot_flags = SLOT_BELT
|
|
storage_slots = 6
|
|
can_hold = list(/obj/item/clothing/mask/smokable/cigarette, /obj/item/weapon/flame/lighter)
|
|
icon_type = "cigarette"
|
|
|
|
/obj/item/weapon/storage/fancy/cigarettes/New()
|
|
..()
|
|
flags |= NOREACT
|
|
for(var/i = 1 to storage_slots)
|
|
new /obj/item/clothing/mask/smokable/cigarette(src)
|
|
create_reagents(15 * storage_slots)//so people can inject cigarettes without opening a packet, now with being able to inject the whole one
|
|
|
|
/obj/item/weapon/storage/fancy/cigarettes/update_icon()
|
|
icon_state = "[initial(icon_state)][contents.len]"
|
|
return
|
|
|
|
/obj/item/weapon/storage/fancy/cigarettes/remove_from_storage(obj/item/W as obj, atom/new_location)
|
|
var/obj/item/clothing/mask/smokable/cigarette/C = W
|
|
if(!istype(C)) return // what
|
|
reagents.trans_to_obj(C, (reagents.total_volume/contents.len))
|
|
..()
|
|
|
|
/obj/item/weapon/storage/fancy/cigarettes/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob,var/target_zone)
|
|
if(!istype(M, /mob))
|
|
return
|
|
|
|
if(M == user && target_zone == "mouth" && contents.len > 0 && !user.wear_mask)
|
|
var/obj/item/clothing/mask/smokable/cigarette/W = new /obj/item/clothing/mask/smokable/cigarette(user)
|
|
reagents.trans_to_obj(W, (reagents.total_volume/contents.len))
|
|
user.equip_to_slot_if_possible(W, slot_wear_mask)
|
|
reagents.maximum_volume = 15 * contents.len
|
|
contents.len--
|
|
user << "<span class='notice'>You take a cigarette out of the pack.</span>"
|
|
update_icon()
|
|
else
|
|
..()
|
|
|
|
/obj/item/weapon/storage/fancy/cigarettes/dromedaryco
|
|
name = "\improper DromedaryCo packet"
|
|
desc = "A packet of six imported DromedaryCo cancer sticks. A label on the packaging reads, \"Wouldn't a slow death make a change?\""
|
|
icon_state = "Dpacket"
|
|
item_state = "Dpacket"
|
|
|
|
/obj/item/weapon/storage/fancy/cigarettes/killthroat
|
|
name = "\improper AcmeCo packet"
|
|
desc = "A packet of six AcmeCo cigarettes. For those who somehow want to obtain the record for the most amount of cancerous tumors."
|
|
icon_state = "Bpacket"
|
|
item_state = "Bpacket" //Doesn't have an inhand state, but neither does dromedary, so, ya know..
|
|
|
|
New()
|
|
..()
|
|
fill_cigarre_package(src,list("fuel" = 15))
|
|
|
|
/obj/item/weapon/storage/fancy/cigar
|
|
name = "cigar case"
|
|
desc = "A case for holding your cigars when you are not smoking them."
|
|
icon_state = "cigarcase"
|
|
item_state = "cigarcase"
|
|
icon = 'icons/obj/cigarettes.dmi'
|
|
w_class = 1
|
|
throwforce = 2
|
|
slot_flags = SLOT_BELT
|
|
storage_slots = 7
|
|
can_hold = list(/obj/item/clothing/mask/smokable/cigarette/cigar)
|
|
icon_type = "cigar"
|
|
|
|
/obj/item/weapon/storage/fancy/cigar/New()
|
|
..()
|
|
flags |= NOREACT
|
|
for(var/i = 1 to storage_slots)
|
|
new /obj/item/clothing/mask/smokable/cigarette/cigar(src)
|
|
create_reagents(15 * storage_slots)
|
|
|
|
/obj/item/weapon/storage/fancy/cigar/update_icon()
|
|
icon_state = "[initial(icon_state)][contents.len]"
|
|
return
|
|
|
|
/obj/item/weapon/storage/fancy/cigar/remove_from_storage(obj/item/W as obj, atom/new_location)
|
|
var/obj/item/clothing/mask/smokable/cigarette/cigar/C = W
|
|
if(!istype(C)) return
|
|
reagents.trans_to_obj(C, (reagents.total_volume/contents.len))
|
|
..()
|
|
|
|
/obj/item/weapon/storage/fancy/cigar/attack(mob/living/carbon/M as mob, mob/living/carbon/user as mob, var/target_zone)
|
|
if(!istype(M, /mob))
|
|
return
|
|
|
|
if(M == user && target_zone == "mouth" && contents.len > 0 && !user.wear_mask)
|
|
var/obj/item/clothing/mask/smokable/cigarette/cigar/W = new /obj/item/clothing/mask/smokable/cigarette/cigar(user)
|
|
reagents.trans_to_obj(W, (reagents.total_volume/contents.len))
|
|
user.equip_to_slot_if_possible(W, slot_wear_mask)
|
|
reagents.maximum_volume = 15 * contents.len
|
|
contents.len--
|
|
user << "<span class='notice'>You take a cigar out of the case.</span>"
|
|
update_icon()
|
|
else
|
|
..()
|
|
|
|
/*
|
|
* Vial Box
|
|
*/
|
|
|
|
/obj/item/weapon/storage/fancy/vials
|
|
icon = 'icons/obj/vialbox.dmi'
|
|
icon_state = "vialbox6"
|
|
icon_type = "vial"
|
|
name = "vial storage box"
|
|
storage_slots = 6
|
|
can_hold = list(/obj/item/weapon/reagent_containers/glass/beaker/vial)
|
|
|
|
|
|
/obj/item/weapon/storage/fancy/vials/New()
|
|
..()
|
|
for(var/i=1; i <= storage_slots; i++)
|
|
new /obj/item/weapon/reagent_containers/glass/beaker/vial(src)
|
|
return
|
|
|
|
/obj/item/weapon/storage/lockbox/vials
|
|
name = "secure vial storage box"
|
|
desc = "A locked box for keeping things away from children."
|
|
icon = 'icons/obj/vialbox.dmi'
|
|
icon_state = "vialbox0"
|
|
item_state = "syringe_kit"
|
|
max_w_class = 2
|
|
can_hold = list(/obj/item/weapon/reagent_containers/glass/beaker/vial)
|
|
max_storage_space = 12 //The sum of the w_classes of all the items in this storage item.
|
|
storage_slots = 6
|
|
req_access = list(access_virology)
|
|
|
|
/obj/item/weapon/storage/lockbox/vials/New()
|
|
..()
|
|
update_icon()
|
|
|
|
/obj/item/weapon/storage/lockbox/vials/update_icon(var/itemremoved = 0)
|
|
var/total_contents = src.contents.len - itemremoved
|
|
src.icon_state = "vialbox[total_contents]"
|
|
src.overlays.Cut()
|
|
if (!broken)
|
|
overlays += image(icon, src, "led[locked]")
|
|
if(locked)
|
|
overlays += image(icon, src, "cover")
|
|
else
|
|
overlays += image(icon, src, "ledb")
|
|
return
|
|
|
|
/obj/item/weapon/storage/lockbox/vials/attackby(obj/item/weapon/W as obj, mob/user as mob)
|
|
..()
|
|
update_icon()
|