mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-01-08 00:21:43 +00:00
There were a bunch of boxes that had their own special code when they all do the same thing. So I've merged them into proper storage items.
Boxes affected: - Donut boxes - Egg cartons - Candle packs - Match boxes - Snap pop boxes - Monkey cube boxes Items I didn't merge: - Pizza boxes - Cigarette packs Pizza boxes are a whole new kind of 'special snowflake code' that is best left the way it is. Cigarette packs involve some stuff I'm unfamiliar with so that can wait until I learn what I need to learn. git-svn-id: http://tgstation13.googlecode.com/svn/trunk@4452 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
@@ -55,7 +55,7 @@
|
||||
for(var/i = 0, i < 5, i++)
|
||||
new /obj/item/weapon/reagent_containers/food/drinks/soymilk(src)
|
||||
for(var/i = 0, i < 2, i++)
|
||||
new /obj/item/kitchen/egg_box(src)
|
||||
new /obj/item/weapon/storage/fancy/egg_box(src)
|
||||
return
|
||||
|
||||
|
||||
|
||||
@@ -44,7 +44,6 @@
|
||||
return
|
||||
|
||||
/obj/structure/closet/wardrobe/chaplain_black/New()
|
||||
//new /obj/item/clothing/suit/imperium_monk(src) //No. -- Urist
|
||||
new /obj/item/clothing/under/rank/chaplain(src)
|
||||
new /obj/item/clothing/shoes/black(src)
|
||||
new /obj/item/clothing/suit/nun(src)
|
||||
@@ -52,11 +51,9 @@
|
||||
new /obj/item/clothing/suit/chaplain_hoodie(src)
|
||||
new /obj/item/clothing/head/chaplain_hood(src)
|
||||
new /obj/item/clothing/suit/holidaypriest(src)
|
||||
//new /obj/item/clothing/suit/hastur (src) //No. -- Urist
|
||||
//new /obj/item/clothing/head/hasturhood (src) //No. -- Urist
|
||||
new /obj/item/weapon/storage/backpack/cultpack (src)
|
||||
new /obj/item/weapon/candlepack(src)
|
||||
new /obj/item/weapon/candlepack(src)
|
||||
new /obj/item/weapon/storage/fancy/candle_box(src)
|
||||
new /obj/item/weapon/storage/fancy/candle_box(src)
|
||||
return
|
||||
|
||||
/obj/structure/closet/wardrobe/green/New()
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
icon = 'icons/obj/candle.dmi'
|
||||
icon_state = "candle1"
|
||||
item_state = "candle1"
|
||||
w_class = 1
|
||||
|
||||
var/wax = 200
|
||||
var/lit = 0
|
||||
@@ -88,39 +89,3 @@
|
||||
if(lit)
|
||||
user.total_luminosity -= CANDLE_LUM
|
||||
src.sd_SetLuminosity(CANDLE_LUM)
|
||||
|
||||
|
||||
|
||||
///////////////
|
||||
//CANDLE PACK//
|
||||
///////////////
|
||||
/obj/item/weapon/candlepack
|
||||
name = "Candle pack"
|
||||
//desc = "The most popular brand of Space Cigarettes, sponsors of the Space Olympics."
|
||||
icon = 'icons/obj/candle.dmi'
|
||||
icon_state = "pack5"
|
||||
item_state = "pack5"
|
||||
w_class = 1
|
||||
throwforce = 2
|
||||
var/candlecount = 5
|
||||
flags = TABLEPASS
|
||||
slot_flags = SLOT_BELT
|
||||
|
||||
|
||||
/obj/item/weapon/candlepack/update_icon()
|
||||
src.icon_state = text("pack[]", src.candlecount)
|
||||
src.desc = text("There are [] candles left!", src.candlecount)
|
||||
return
|
||||
|
||||
/obj/item/weapon/candlepack/attack_hand(mob/user as mob)
|
||||
if(user.r_hand == src || user.l_hand == src)
|
||||
if(src.candlecount == 0)
|
||||
//user << "\red You're out of cigs, shit! How you gonna get through the rest of the day..."
|
||||
return
|
||||
else
|
||||
src.candlecount--
|
||||
user.put_in_hands(new /obj/item/candle(user))
|
||||
else
|
||||
return ..()
|
||||
src.update_icon()
|
||||
return
|
||||
|
||||
@@ -1,157 +0,0 @@
|
||||
/*
|
||||
CONTAINS:
|
||||
DONUT BOX
|
||||
EGG BOX
|
||||
MONKEY CUBE BOX
|
||||
|
||||
*/
|
||||
|
||||
|
||||
/mob/living/carbon/var/last_eating = 0
|
||||
|
||||
/obj/item/kitchen/donut_box
|
||||
var/const/max_amount = 6
|
||||
var/list/obj/item/weapon/reagent_containers/food/snacks/donut/donuts = list()
|
||||
icon = 'icons/obj/food.dmi'
|
||||
icon_state = "donutbox6"
|
||||
name = "donut box"
|
||||
|
||||
/obj/item/kitchen/egg_box
|
||||
var/amount = 12
|
||||
icon = 'icons/obj/food.dmi'
|
||||
icon_state = "eggbox"
|
||||
name = "egg box"
|
||||
|
||||
/obj/item/kitchen/donut_box/New()
|
||||
for(var/i = 0; i < max_amount; i++)
|
||||
donuts += new /obj/item/weapon/reagent_containers/food/snacks/donut/normal(src)
|
||||
update()
|
||||
..()
|
||||
|
||||
/obj/item/kitchen/donut_box/proc/update()
|
||||
src.icon_state = text("donutbox[]", src.donuts.len)
|
||||
return
|
||||
|
||||
/obj/item/kitchen/donut_box/attackby(obj/item/weapon/W as obj, mob/living/user as mob)
|
||||
if (istype(W, /obj/item/weapon/reagent_containers/food/snacks/donut) && (donuts.len < max_amount))
|
||||
user.drop_item()
|
||||
W.loc = src
|
||||
donuts += W
|
||||
usr << "You place a donut back into the box."
|
||||
src.update()
|
||||
return
|
||||
|
||||
/obj/item/kitchen/donut_box/MouseDrop(mob/living/user as mob)
|
||||
if ((user == usr && (!( usr.restrained() ) && (!( usr.stat ) && (usr.contents.Find(src) || in_range(src, usr))))))
|
||||
if(!istype(user, /mob/living/carbon/metroid) && !istype(user, /mob/living/simple_animal))
|
||||
if( !usr.get_active_hand() )
|
||||
src.attack_hand(usr, usr.hand, 1)
|
||||
return
|
||||
|
||||
/obj/item/kitchen/donut_box/attack_paw(mob/living/user as mob)
|
||||
return src.attack_hand(user)
|
||||
|
||||
/obj/item/kitchen/donut_box/attack_hand(mob/living/user as mob, unused, flag)
|
||||
if (flag)
|
||||
return ..()
|
||||
src.add_fingerprint(user)
|
||||
|
||||
var/last = donuts.len
|
||||
if(last <= 0)
|
||||
user << "Oh no! No donuts left!"
|
||||
return
|
||||
//world.log << last
|
||||
var/obj/item/weapon/reagent_containers/food/snacks/donut/P = donuts[last] // Get the last donut.
|
||||
if(P)
|
||||
P.loc = user.loc
|
||||
user.put_in_hands(P)
|
||||
donuts -= P
|
||||
user << "You take a donut out of the box."
|
||||
src.update()
|
||||
return
|
||||
|
||||
/obj/item/kitchen/donut_box/examine()
|
||||
set src in oview(1)
|
||||
|
||||
var/n = src.donuts.len
|
||||
if (n <= 0)
|
||||
n = 0
|
||||
usr << "There are no donuts left in the box."
|
||||
else
|
||||
if (n == 1)
|
||||
usr << "There is one donut left in the box."
|
||||
else
|
||||
usr << text("There are [] donuts in the box.", n)
|
||||
return
|
||||
|
||||
/obj/item/kitchen/egg_box/proc/update()
|
||||
src.icon_state = text("eggbox[]", src.amount)
|
||||
return
|
||||
|
||||
|
||||
/obj/item/kitchen/egg_box/MouseDrop(mob/user as mob)
|
||||
if ((user == usr && (!( usr.restrained() ) && (!( usr.stat ) && (usr.contents.Find(src) || in_range(src, usr))))))
|
||||
if( !usr.get_active_hand() )
|
||||
attack_hand(usr, usr.hand, 1)
|
||||
return
|
||||
return
|
||||
|
||||
/obj/item/kitchen/egg_box/attack_paw(mob/user as mob)
|
||||
return src.attack_hand(user)
|
||||
|
||||
/obj/item/kitchen/egg_box/attack_hand(mob/user as mob, unused, flag)
|
||||
if (flag)
|
||||
return ..()
|
||||
src.add_fingerprint(user)
|
||||
var/obj/item/weapon/reagent_containers/food/snacks/egg/P = locate() in src
|
||||
if(!P && (amount >= 1))
|
||||
P = new /obj/item/weapon/reagent_containers/food/snacks/egg( src )
|
||||
if(P)
|
||||
usr.put_in_hands(P)
|
||||
usr << "You take an egg out of the box."
|
||||
src.amount--
|
||||
src.update()
|
||||
return
|
||||
|
||||
|
||||
/obj/item/kitchen/egg_box/examine()
|
||||
set src in oview(1)
|
||||
|
||||
src.amount = round(src.amount)
|
||||
var/n = src.amount
|
||||
for(var/obj/item/weapon/reagent_containers/food/snacks/egg/P in src)
|
||||
n++
|
||||
if (n <= 0)
|
||||
n = 0
|
||||
usr << "There are no eggs left in the box."
|
||||
else
|
||||
if (n == 1)
|
||||
usr << "There is one egg left in the box."
|
||||
else
|
||||
usr << text("There are [] eggs in the box.", n)
|
||||
return
|
||||
|
||||
/obj/item/weapon/monkeycube_box
|
||||
name = "monkey cube box"
|
||||
desc = "Drymate brand monkey cubes. Just add water!"
|
||||
icon = 'icons/obj/food.dmi'
|
||||
icon_state = "monkeycubebox"
|
||||
var/amount = 2
|
||||
|
||||
attack_hand(mob/user as mob, unused, flag)
|
||||
add_fingerprint(user)
|
||||
|
||||
if(user.r_hand == src || user.l_hand == src)
|
||||
if(amount)
|
||||
user.put_in_hands(new /obj/item/weapon/reagent_containers/food/snacks/monkeycube/wrapped(user))
|
||||
user << "You take a monkey cube out of the box."
|
||||
amount--
|
||||
else
|
||||
user << "There are no monkey cubes left in the box."
|
||||
else
|
||||
..()
|
||||
|
||||
return
|
||||
|
||||
attack_paw(mob/user as mob)
|
||||
return attack_hand(user)
|
||||
@@ -3,7 +3,6 @@
|
||||
/*
|
||||
CONTAINS:
|
||||
MATCHES
|
||||
MATCHBOXES
|
||||
CIGARETTES
|
||||
CIGARS
|
||||
SMOKING PIPES
|
||||
@@ -50,55 +49,6 @@ ZIPPO
|
||||
return ..()
|
||||
|
||||
|
||||
|
||||
//////////////
|
||||
//MATCHBOXES//
|
||||
//////////////
|
||||
/obj/item/weapon/matchbox
|
||||
name = "Matchbox"
|
||||
desc = "A small box of Almost But Not Quite Plasma Premium Matches."
|
||||
icon = 'icons/obj/cigarettes.dmi'
|
||||
icon_state = "matchbox"
|
||||
item_state = "zippo"
|
||||
w_class = 1
|
||||
flags = TABLEPASS
|
||||
slot_flags = SLOT_BELT
|
||||
var/matchcount = 10
|
||||
w_class = 1.0
|
||||
|
||||
|
||||
attack_hand(mob/user as mob)
|
||||
if(user.r_hand == src || user.l_hand == src)
|
||||
if(src.matchcount <= 0)
|
||||
user << "\red You're out of matches. Shouldn't have wasted so many..."
|
||||
return
|
||||
else
|
||||
src.matchcount--
|
||||
user.put_in_active_hand(new /obj/item/weapon/match(user))
|
||||
else
|
||||
return ..()
|
||||
if(src.matchcount <= 0)
|
||||
src.icon_state = "matchbox_empty"
|
||||
else if(src.matchcount <= 3)
|
||||
src.icon_state = "matchbox_almostempty"
|
||||
else if(src.matchcount <= 6)
|
||||
src.icon_state = "matchbox_almostfull"
|
||||
else
|
||||
src.icon_state = "matchbox"
|
||||
src.update_icon()
|
||||
return
|
||||
|
||||
|
||||
attackby(obj/item/weapon/match/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/weapon/match) && W.lit == 0)
|
||||
W.lit = 1
|
||||
W.icon_state = "match_lit"
|
||||
processing_objects.Add(W)
|
||||
W.update_icon()
|
||||
return
|
||||
|
||||
|
||||
|
||||
///////////////////////
|
||||
//CIGARETTES + CIGARS//
|
||||
///////////////////////
|
||||
|
||||
106
code/game/objects/storage/fancy.dm
Normal file
106
code/game/objects/storage/fancy.dm
Normal file
@@ -0,0 +1,106 @@
|
||||
/*
|
||||
* 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
|
||||
*
|
||||
* Contains:
|
||||
* Donut Box
|
||||
* Egg Box
|
||||
* Candle 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/attack_hand(mob/user as mob)
|
||||
..()
|
||||
update_icon()
|
||||
return
|
||||
|
||||
/obj/item/weapon/storage/fancy/attackby(obj/item/W as obj, mob/user as mob)
|
||||
..()
|
||||
update_icon()
|
||||
return
|
||||
|
||||
/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()
|
||||
set src in oview(1)
|
||||
|
||||
if(contents.len <= 0)
|
||||
usr << "There are no [src.icon_type]s left in the box."
|
||||
else if(contents.len == 1)
|
||||
usr << "There is one [src.icon_type] left in the box."
|
||||
else
|
||||
usr << "There are [src.contents.len] [src.icon_type]s in the box."
|
||||
|
||||
return
|
||||
|
||||
|
||||
|
||||
/*
|
||||
* Donut Box
|
||||
*/
|
||||
|
||||
/obj/item/weapon/storage/fancy/donut_box
|
||||
icon = 'icons/obj/food.dmi'
|
||||
icon_state = "donutbox6"
|
||||
icon_type = "donut"
|
||||
name = "donut box"
|
||||
storage_slots = 6
|
||||
can_hold = list("/obj/item/weapon/reagent_containers/food/snacks/donut")
|
||||
|
||||
|
||||
/obj/item/weapon/storage/fancy/donut_box/New()
|
||||
..()
|
||||
for(var/i=1; i <= storage_slots; i++)
|
||||
new /obj/item/weapon/reagent_containers/food/snacks/donut/normal(src)
|
||||
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/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"
|
||||
storage_slots = 5
|
||||
throwforce = 2
|
||||
flags = TABLEPASS
|
||||
slot_flags = SLOT_BELT
|
||||
|
||||
|
||||
/obj/item/weapon/storage/fancy/candle_box/New()
|
||||
..()
|
||||
for(var/i=1; i <= storage_slots; i++)
|
||||
new /obj/item/candle(src)
|
||||
return
|
||||
72
code/game/objects/storage/misc.dm
Normal file
72
code/game/objects/storage/misc.dm
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Contains:
|
||||
* Monkey Cube Box
|
||||
* Candle Packs
|
||||
* Snap Pop Box
|
||||
*/
|
||||
|
||||
/*
|
||||
* Monkey Cube Box
|
||||
*/
|
||||
|
||||
/obj/item/weapon/storage/monkeycube_box
|
||||
name = "monkey cube box"
|
||||
desc = "Drymate brand monkey cubes. Just add water!"
|
||||
icon = 'icons/obj/food.dmi'
|
||||
icon_state = "monkeycubebox"
|
||||
storage_slots = 7
|
||||
can_hold = list("/obj/item/weapon/reagent_containers/food/snacks/monkeycube")
|
||||
|
||||
|
||||
/obj/item/weapon/storage/monkeycube_box/New()
|
||||
..()
|
||||
new /obj/item/weapon/reagent_containers/food/snacks/monkeycube/wrapped(src)
|
||||
new /obj/item/weapon/reagent_containers/food/snacks/monkeycube/wrapped(src)
|
||||
return
|
||||
|
||||
/*
|
||||
* Snap Pop Box
|
||||
*/
|
||||
|
||||
/obj/item/weapon/storage/snappopbox
|
||||
name = "snap pop box"
|
||||
desc = "Eight wrappers of fun! Ages 8 and up. Not suitable for children."
|
||||
icon = 'icons/obj/toy.dmi'
|
||||
icon_state = "spbox"
|
||||
storage_slots = 8
|
||||
can_hold = list("/obj/item/toy/snappop")
|
||||
|
||||
/obj/item/weapon/storage/snappopbox/New()
|
||||
..()
|
||||
for(var/i=1; i <= storage_slots; i++)
|
||||
new /obj/item/toy/snappop(src)
|
||||
|
||||
/*
|
||||
* Match Box
|
||||
*/
|
||||
|
||||
/obj/item/weapon/storage/matchbox
|
||||
name = "Matchbox"
|
||||
desc = "A small box of Almost But Not Quite Plasma Premium Matches."
|
||||
icon = 'icons/obj/cigarettes.dmi'
|
||||
icon_state = "matchbox"
|
||||
item_state = "zippo"
|
||||
storage_slots = 10
|
||||
w_class = 1
|
||||
flags = TABLEPASS
|
||||
slot_flags = SLOT_BELT
|
||||
|
||||
|
||||
/obj/item/weapon/storage/matchbox/New()
|
||||
..()
|
||||
for(var/i=1; i <= storage_slots; i++)
|
||||
new /obj/item/weapon/match(src)
|
||||
return
|
||||
|
||||
/obj/item/weapon/storage/matchbox/attackby(obj/item/weapon/match/W as obj, mob/user as mob)
|
||||
if(istype(W, /obj/item/weapon/match) && W.lit == 0)
|
||||
W.lit = 1
|
||||
W.icon_state = "match_lit"
|
||||
processing_objects.Add(W)
|
||||
W.update_icon()
|
||||
return
|
||||
@@ -230,6 +230,11 @@
|
||||
//Call this proc to handle the removal of an item from the storage item. The item will be moved to the atom sent as new_target
|
||||
/obj/item/weapon/storage/proc/remove_from_storage(obj/item/W as obj, atom/new_location)
|
||||
if(!istype(W)) return
|
||||
|
||||
if(istype(src, /obj/item/weapon/storage/fancy))
|
||||
var/obj/item/weapon/storage/fancy/F = src
|
||||
F.update_icon(1)
|
||||
|
||||
for(var/mob/M in range(1, src.loc))
|
||||
if (M.s_active == src.loc)
|
||||
if (M.client)
|
||||
|
||||
Reference in New Issue
Block a user