Skip to content

Commit

Permalink
Drag-n-drop hotfix (#4468)
Browse files Browse the repository at this point in the history
# About the pull request

Should fix some oversights with the skill nesting system.

# Explain why it's good for the game

Bug bad


# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog

:cl: Morrow
fix: Fixed drag-n-drop nesting opening
/:cl:
  • Loading branch information
morrowwolf committed Sep 23, 2023
1 parent c438e2e commit 808c09d
Showing 1 changed file with 8 additions and 14 deletions.
22 changes: 8 additions & 14 deletions code/game/objects/items/storage/storage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -81,19 +81,7 @@
return ..()

/obj/item/storage/proc/handle_mmb_open(mob/user)
if(!required_skill_for_nest_opening || !required_skill_level_for_nest_opening)
open(user)
return

if(!istype(loc, /obj/item/storage))
open(user)
return

if(user?.skills.get_skill_level(required_skill_for_nest_opening) >= required_skill_level_for_nest_opening)
open(user)
return

to_chat(user, SPAN_NOTICE("You can't seem to open [src] while it is in [loc]."))
open(user)

/obj/item/storage/proc/return_inv()
RETURN_TYPE(/list)
Expand Down Expand Up @@ -171,6 +159,12 @@
/obj/item/storage/proc/open(mob/user)
if(user.s_active == src) //Spam prevention.
return

if(istype(loc, /obj/item/storage) && required_skill_for_nest_opening)
if(!user || user.skills?.get_skill_level(required_skill_for_nest_opening) < required_skill_level_for_nest_opening)
to_chat(user, SPAN_NOTICE("You can't seem to open [src] while it is in [loc]."))
return

if(!opened)
orient2hud()
opened = 1
Expand Down Expand Up @@ -419,7 +413,7 @@ var/list/global/item_storage_box_cache = list()
/obj/item/storage/proc/can_hold_type(type_to_hold, mob/user)
if(length(can_hold_skill))
for(var/can_hold_skill_typepath in can_hold_skill)
if(ispath(type_to_hold, can_hold_skill_typepath) && user?.skills.get_skill_level(can_hold_skill[can_hold_skill_typepath][SKILL_TYPE_INDEX]) >= can_hold_skill[can_hold_skill_typepath][SKILL_LEVEL_INDEX])
if(ispath(type_to_hold, can_hold_skill_typepath) && user.skills?.get_skill_level(can_hold_skill[can_hold_skill_typepath][SKILL_TYPE_INDEX]) >= can_hold_skill[can_hold_skill_typepath][SKILL_LEVEL_INDEX])
return TRUE
if(can_hold_skill_only)
return FALSE
Expand Down

0 comments on commit 808c09d

Please sign in to comment.