Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Weird Inventories #5525

Merged
merged 3 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 7 additions & 3 deletions code/game/objects/items/stacks/stack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -277,11 +277,15 @@ Also change the icon to reflect the amount of sheets, if possible.*/
if(used > amount) //If it's larger than what we have, no go.
return FALSE
amount -= used
update_icon()
if(amount <= 0)
if(usr && loc == usr)
usr.temp_drop_inv_item(src)
if(loc == usr)
usr?.temp_drop_inv_item(src)
else if(isstorage(loc))
var/obj/item/storage/storage = loc
storage.remove_from_storage(src)
qdel(src)
else
update_icon()
return TRUE

/obj/item/stack/proc/add(extra)
Expand Down
7 changes: 7 additions & 0 deletions code/game/objects/items/toys/cards.dm
Original file line number Diff line number Diff line change
Expand Up @@ -352,6 +352,9 @@
user.visible_message(SPAN_NOTICE("\The [user] adds [cards_length > 1 ? "their hand" : "<b>[cards[length(cards)].name]</b>"] to \the [src]."), SPAN_NOTICE("You add [cards_length > 1 ? "your hand" : "<b>[cards[length(cards)].name]</b>"] to \the [src]."))
else
if(loc != user)
if(isstorage(loc))
var/obj/item/storage/storage = loc
storage.remove_from_storage(src)
user.put_in_hands(src)
update_icon()
return
Expand Down Expand Up @@ -405,6 +408,10 @@
return
if(ismob(loc))
return

if(isstorage(loc))
var/obj/item/storage/storage = loc
storage.remove_from_storage(src)
usr.put_in_hands(src)

/obj/item/toy/handcard/get_examine_text(mob/user)
Expand Down
6 changes: 4 additions & 2 deletions code/modules/mob/inventory.dm
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,9 @@
if(!previously_held_object)
remembered_dropped_objects -= weak_ref
break
if(previously_held_object.in_contents_of(check_turf))
if(previously_held_object in check_turf)
if(previously_held_object.throwing)
return FALSE
if(previously_held_object.anchored)
return FALSE
put_in_hands(previously_held_object, drop_on_fail = FALSE)
Expand Down Expand Up @@ -226,7 +228,7 @@
//Remove an item on a mob's inventory. It does not change the item's loc, just unequips it from the mob.
//Used just before you want to delete the item, or moving it afterwards.
/mob/proc/temp_drop_inv_item(obj/item/I, force)
return u_equip(I, null, force)
return u_equip(I, null, TRUE, force)


//Outdated but still in use apparently. This should at least be a human proc.
Expand Down
Loading