Merge pull request #2926 from Anewbe/custodial_tweaks

Ports Bay's custodial bag tweaks
This commit is contained in:
Anewbe
2017-01-15 18:54:02 -05:00
committed by GitHub
5 changed files with 72 additions and 24 deletions

View File

@@ -206,38 +206,18 @@
R.activate_module(src)
R.hud_used.update_robot_modules_display()
// Due to storage type consolidation this should get used more now.
// I have cleaned it up a little, but it could probably use more. -Sayu
/obj/item/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W,/obj/item/weapon/storage))
if(istype(W, /obj/item/weapon/storage))
var/obj/item/weapon/storage/S = W
if(S.use_to_pickup)
if(S.collection_mode) //Mode is set to collect all items on a tile and we clicked on a valid one.
if(S.collection_mode) //Mode is set to collect all items
if(isturf(src.loc))
var/list/rejections = list()
var/success = 0
var/failure = 0
for(var/obj/item/I in src.loc)
if(I.type in rejections) // To limit bag spamming: any given type only complains once
continue
if(!S.can_be_inserted(I)) // Note can_be_inserted still makes noise when the answer is no
rejections += I.type // therefore full bags are still a little spammy
failure = 1
continue
success = 1
S.handle_item_insertion(I, 1) //The 1 stops the "You put the [src] into [S]" insertion message from being displayed.
if(success && !failure)
user << "<span class='notice'>You put everything in [S].</span>"
else if(success)
user << "<span class='notice'>You put some things in [S].</span>"
else
user << "<span class='notice'>You fail to pick anything up with \the [S].</span>"
S.gather_all(src.loc, user)
else if(S.can_be_inserted(src))
S.handle_item_insertion(src)
return
return ..()
/obj/item/proc/talk_into(mob/M as mob, text)
return

View File

@@ -478,6 +478,27 @@
src.add_fingerprint(user)
return
/obj/item/weapon/storage/proc/gather_all(turf/T as turf, mob/user as mob)
var/list/rejections = list()
var/success = 0
var/failure = 0
for(var/obj/item/I in T)
if(I.type in rejections) // To limit bag spamming: any given type only complains once
continue
if(!can_be_inserted(I, user)) // Note can_be_inserted still makes noise when the answer is no
rejections += I.type // therefore full bags are still a little spammy
failure = 1
continue
success = 1
handle_item_insertion(I, 1) //The 1 stops the "You put the [src] into [S]" insertion message from being displayed.
if(success && !failure)
to_chat(user, "<span class='notice'>You put everything in [src].</span>")
else if(success)
to_chat(user, "<span class='notice'>You put some things in [src].</span>")
else
to_chat(user, "<span class='notice'>You fail to pick anything up with \the [src].</span>")
/obj/item/weapon/storage/verb/toggle_gathering_mode()
set name = "Switch Gathering Method"
set category = "Object"

View File

@@ -78,6 +78,9 @@
else
user << "<span class='notice'>[src] can't hold any more signs.</span>"
else if(istype(I, /obj/item/weapon/reagent_containers/glass))
return // So we do not put them in the trash bag as we mean to fill the mop bucket
else if(mybag)
mybag.attackby(I, user)

View File

@@ -68,6 +68,13 @@
step(user.pulling, get_dir(user.pulling.loc, src))
return 1
turf/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/storage))
var/obj/item/weapon/storage/S = W
if(S.use_to_pickup && S.collection_mode)
S.gather_all(src, user)
return ..()
/turf/Enter(atom/movable/mover as mob|obj, atom/forget as mob|obj|turf|area)
if(movement_disabled && usr.ckey != movement_disabled_exception)
usr << "<span class='warning'>Movement is admin-disabled.</span>" //This is to identify lag problems