Skip to content

Commit

Permalink
Merge pull request #115 from SynthTwo/Satchel
Browse files Browse the repository at this point in the history
Makes satchel wearable on belt slot
  • Loading branch information
SynthTwo authored Nov 11, 2024
2 parents 90d1abd + 6218cbf commit dc9cf6a
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 0 deletions.
4 changes: 4 additions & 0 deletions code/__DEFINES/traits/declarations.dm
Original file line number Diff line number Diff line change
Expand Up @@ -1346,4 +1346,8 @@ Remember to update _globalvars/traits.dm if you're adding/removing/renaming trai
///A "fake" effect that should not be subject to normal effect removal methods (like the effect remover component)
#define TRAIT_ILLUSORY_EFFECT "illusory_effect"

// /obj/item
/// Applied to a satchel that is being worn on the belt. Iris addition.
#define TRAIT_BELT_SATCHEL "belt_satchel"

// END TRAIT DEFINES
1 change: 1 addition & 0 deletions code/_globalvars/traits/_traits.dm
Original file line number Diff line number Diff line change
Expand Up @@ -576,6 +576,7 @@ GLOBAL_LIST_INIT(traits_by_type, list(
"TRAIT_BAIT_UNCONSUMABLE" = TRAIT_BAIT_UNCONSUMABLE,
"TRAIT_BAKEABLE" = TRAIT_BAKEABLE,
"TRAIT_BASIC_QUALITY_BAIT" = TRAIT_BASIC_QUALITY_BAIT,
"TRAIT_BELT_SATCHEL" = TRAIT_BELT_SATCHEL, //iris edit
"TRAIT_BLIND_TOOL" = TRAIT_BLIND_TOOL,
"TRAIT_BYPASS_RANGED_ARMOR" = TRAIT_BYPASS_RANGED_ARMOR,
"TRAIT_CONTRABAND_BLOCKER" = TRAIT_CONTRABAND_BLOCKER,
Expand Down
33 changes: 33 additions & 0 deletions code/game/objects/items/storage/backpack.dm
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,19 @@
. = ..()
AddElement(/datum/element/attack_equip)

/obj/item/storage/backpack/equipped(mob/user, slot, initial) //iris edit start
. = ..()
if(slot == ITEM_SLOT_BACK)
var/obj/item/storage/backpack/satchel/worn_satchel = user.get_item_by_slot(ITEM_SLOT_BELT)
if(istype(worn_satchel) && HAS_TRAIT(user, TRAIT_BELT_SATCHEL))
slowdown = 1.5
user.update_equipment_speed_mods()

/obj/item/storage/backpack/dropped(mob/user, silent)
. = ..()
slowdown = initial(slowdown) //iris edit end
/*
* Backpack Types
*/

Expand Down Expand Up @@ -295,6 +307,27 @@
desc = "A trendy looking satchel."
icon_state = "satchel-norm"
inhand_icon_state = "satchel-norm"
slot_flags = ITEM_SLOT_BACK | ITEM_SLOT_BELT //iris edit

/obj/item/storage/backpack/satchel/Initialize(mapload)
. = ..()
atom_storage.max_total_storage = 18

/obj/item/storage/backpack/satchel/equipped(mob/user, slot, initial) //iris edit start
. = ..()
if(slot == ITEM_SLOT_BELT)
ADD_TRAIT(user, TRAIT_BELT_SATCHEL, CLOTHING_TRAIT)
var/obj/item/storage/backpack/worn_backpack = user.get_item_by_slot(ITEM_SLOT_BACK)
if(istype(worn_backpack))
worn_backpack.slowdown = 1.5
user.update_equipment_speed_mods()

/obj/item/storage/backpack/satchel/dropped(mob/user, silent)
. = ..()
REMOVE_TRAIT(user, TRAIT_BELT_SATCHEL, CLOTHING_TRAIT)
var/obj/item/storage/backpack/worn_backpack = user.get_item_by_slot(ITEM_SLOT_BACK)
if(istype(worn_backpack))
worn_backpack.slowdown = initial(worn_backpack.slowdown) //iris edit end

/obj/item/storage/backpack/satchel/leather
name = "leather satchel"
Expand Down

0 comments on commit dc9cf6a

Please sign in to comment.