Adding verb to empty Bags quickly (#7140)

Enabled verb for quick emptying of backpacks.

    Bags have a delay to empty. Which is base 0.5 second per item.

    Captain, Syndicate, Engineering, Wizard Bags have 0.8 second delay per item.

as per suggeestion thread: https://forums.aurorastation.org/topic/12927-allow-people-to-dump-out-bags/
This commit is contained in:
Mykhailo Bykhovtsev
2019-10-22 20:09:27 +03:00
committed by Erki
parent dba3d91bc7
commit 23cb82a5fd
3 changed files with 72 additions and 3 deletions
@@ -24,6 +24,8 @@
max_storage_space = 28
var/species_restricted = list("exclude","Vaurca Breeder","Vaurca Warform")
drop_sound = 'sound/items/drop/backpack.ogg'
allow_quick_empty = TRUE
empty_delay = 0.5 SECOND
/obj/item/weapon/storage/backpack/mob_can_equip(M as mob, slot)
@@ -80,6 +82,7 @@
slot_l_hand_str = "holdingpack",
slot_r_hand_str = "holdingpack"
)
empty_delay = 0.8 SECOND
attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/storage/backpack/holding))
@@ -100,9 +103,9 @@
icon_state = "giftbag0"
item_state = "giftbag"
w_class = 4.0
max_w_class = 3
max_storage_space = 400 // can store a ton of shit!
item_state_slots = null
empty_delay = 1 SECOND
/obj/item/weapon/storage/backpack/cultpack
name = "trophy rack"
@@ -132,12 +135,14 @@
desc = "It's a special backpack made exclusively for officers."
icon_state = "captainpack"
item_state_slots = null
empty_delay = 0.8 SECOND
/obj/item/weapon/storage/backpack/industrial
name = "industrial backpack"
desc = "It's a tough backpack for the daily grind of station life."
icon_state = "engiepack"
item_state_slots = null
empty_delay = 0.8 SECOND
/obj/item/weapon/storage/backpack/toxins
name = "laboratory backpack"
@@ -175,11 +180,13 @@
name = "syndicate rucksack"
desc = "The latest in carbon fiber and red satin combat rucksack technology. Comfortable and tough!"
icon_state = "syndiepack"
empty_delay = 0.8 SECOND
/obj/item/weapon/storage/backpack/wizard
name = "wizard federation sack"
desc = "Perfect for keeping your shining crystal balls inside of."
icon_state = "wizardpack"
empty_delay = 0.8 SECOND
/*
* Satchel Types
@@ -212,6 +219,7 @@
slot_l_hand_str = "engiepack",
slot_r_hand_str = "engiepack"
)
empty_delay = 0.8 SECOND
/obj/item/weapon/storage/backpack/satchel_med
name = "medical satchel"
@@ -264,16 +272,19 @@
slot_l_hand_str = "satchel-cap",
slot_r_hand_str = "satchel-cap"
)
empty_delay = 0.8 SECOND
/obj/item/weapon/storage/backpack/satchel_syndie
name = "syndicate satchel"
desc = "A satchel in the new age style of a multi-corperate terrorist organisation."
icon_state = "satchel-syndie"
empty_delay = 0.8 SECOND
/obj/item/weapon/storage/backpack/satchel_wizard
name = "wizard federation satchel"
desc = "This stylish satchel will put a spell on anyone with some fashion sense to spare."
icon_state = "satchel-wizard"
empty_delay = 0.8 SECOND
//ERT backpacks.
/obj/item/weapon/storage/backpack/ert
@@ -284,6 +295,7 @@
slot_l_hand_str = "securitypack",
slot_r_hand_str = "securitypack"
)
empty_delay = 0.8 SECOND
//Commander
/obj/item/weapon/storage/backpack/ert/commander
@@ -329,6 +341,7 @@
slot_l_hand_str = "duffle_captain",
slot_r_hand_str = "duffle_captain"
)
empty_delay = 0.8 SECOND
/obj/item/weapon/storage/backpack/duffel/hyd
name = "botanist's duffel bag"
@@ -361,6 +374,7 @@
slot_l_hand_str = "duffle_eng",
slot_r_hand_str = "duffle_eng"
)
empty_delay = 0.8 SECOND
/obj/item/weapon/storage/backpack/duffel/tox
name = "scientist's duffel bag"
@@ -395,12 +409,14 @@
slot_r_hand_str = "duffle_syndie"
)
slowdown = 0
empty_delay = 0.8 SECOND
/obj/item/weapon/storage/backpack/duffel/wizard
name = "wizardly duffel bag"
desc = "A fancy blue wizard bag, duffel edition."
icon_state = "duffel-wizard"
slowdown = 0
empty_delay = 0.8 SECOND
/*
* Messenger Bags
@@ -440,11 +456,13 @@
name = "captain's messenger bag"
desc = "A special backpack worn over one shoulder. This one is made specifically for command officers."
icon_state = "courierbagcom"
empty_delay = 0.8 SECOND
/obj/item/weapon/storage/backpack/messenger/engi
name = "engineering messenger bag"
desc = "A strong backpack worn over one shoulder. This one is designed for industrial work."
icon_state = "courierbagengi"
empty_delay = 0.8 SECOND
/obj/item/weapon/storage/backpack/messenger/hyd
name = "hydroponics messenger bag"
@@ -470,6 +488,7 @@
name = "military rucksack"
desc = "A sturdy backpack with the emblems and markings of the Tau Ceti Foreign Legion."
icon_state = "legion_bag"
empty_delay = 0.8 SECOND
/obj/item/weapon/storage/backpack/typec
icon = 'icons/mob/species/breeder/inventory.dmi'
@@ -479,8 +498,7 @@
item_state = "wings"
w_class = 5.0
slot_flags = SLOT_BACK
max_w_class = 3
max_storage_space = 12
canremove = 0
species_restricted = list("Vaurca Breeder")
sprite_sheets = list("Vaurca Breeder" = 'icons/mob/species/breeder/back.dmi')
sprite_sheets = list("Vaurca Breeder" = 'icons/mob/species/breeder/back.dmi')
@@ -37,6 +37,7 @@
var/collection_mode = 1 //0 = pick one at a time, 1 = pick all on tile
var/use_sound = "rustle" //sound played when used. null for no sound.
var/list/starts_with // for pre-filled items
var/empty_delay = 0 SECOND // time it takes to empty bag. this is multiplies by number of objects stored
/obj/item/weapon/storage/Destroy()
close_all()
@@ -564,6 +565,12 @@
if((!ishuman(usr) && (src.loc != usr)) || usr.stat || usr.restrained())
return
if(empty_delay)
visible_message("\The [usr] starts to empty the contents of \the [src].")
if(!do_after(usr, contents.len * empty_delay, act_target=usr))
return
var/turf/T = get_turf(src)
hide_from(usr)
for(var/obj/item/I in contents)
@@ -573,6 +580,9 @@
post_remove_from_storage_deferred(loc, usr)
if(empty_delay)
visible_message("\The [usr] empties the contents of \the [src].")
// Override this to fill the storage object with stuff.
/obj/item/weapon/storage/proc/fill()
if(LAZYLEN(starts_with))