Skip to content

Commit

Permalink
Adds amount restriction for vending. Increases plushies cargo price. …
Browse files Browse the repository at this point in the history
…Squeak component improvements. Items now properly remove from storages on being cryoed. (#849)

* Update vending.dm

* Update squeak.dm

* Update supplies.dm

* Update vending.dm

* roomba spam

* Update cryopod.dm
  • Loading branch information
Helg2 authored Dec 21, 2024
1 parent ff79898 commit 6e09cc2
Show file tree
Hide file tree
Showing 11 changed files with 47 additions and 33 deletions.
2 changes: 2 additions & 0 deletions code/__DEFINES/equipment.dm
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,8 @@
//flags_storage
///If a storage container can be restocked into a vendor
#define BYPASS_VENDOR_CHECK (1<<0)
///Upon being put into cryo, this storage won't store it's contents into the cryo
#define BYPASS_CRYO_CHECK (1<<1)

//flags_id
///If you can get buy a loadout
Expand Down
1 change: 1 addition & 0 deletions code/_globalvars/bitfields.dm
Original file line number Diff line number Diff line change
Expand Up @@ -480,6 +480,7 @@ GLOBAL_LIST_INIT(bitfields, list(
),
"flags_storage" = list(
"BYPASS_VENDOR_CHECK" = BYPASS_VENDOR_CHECK,
"BYPASS_CRYO_CHECK" = BYPASS_CRYO_CHECK,
),
"flags_id" = list(
"CAN_BUY_LOADOUT" = CAN_BUY_LOADOUT,
Expand Down
38 changes: 18 additions & 20 deletions code/datums/components/squeak.dm
Original file line number Diff line number Diff line change
@@ -1,15 +1,20 @@
/datum/component/squeak
var/squeak_sound
/// What sound will we play on squeak
var/squeak_sound = 'sound/items/dollsqueak.ogg'
/// With what probability will we play sound?
var/squeak_chance = 100
/// How loud will we play our sound?
var/volume = 30

// This is so shoes don't squeak every step
/// This is so shoes don't squeak every step
var/steps = 0
/// How long do we have to wait before being able to squeak on step
var/step_delay = 1

// This is to stop squeak spam from inhand usage
/// This is to stop squeak spam from inhand usage
var/last_use = 0
var/use_delay = 20
/// How long do we have to wait before being able to squeak in hand
var/use_delay = 2 SECONDS

///what we set connect_loc to if parent is a movable
var/static/list/item_connections = list(
Expand All @@ -35,8 +40,8 @@
else if(isstructure(parent))
RegisterSignal(parent, COMSIG_ATOM_ATTACK_HAND, PROC_REF(use_squeak))

squeak_sound = sound_to_play

if(sound_to_play)
squeak_sound = sound_to_play
if(chance_override)
squeak_chance = chance_override
if(volume_override)
Expand All @@ -54,15 +59,12 @@
SIGNAL_HANDLER
if(!prob(squeak_chance))
return
if(!squeak_sound)
CRASH("Squeak component attempted to play invalid sound.")

if(islist(squeak_sound))
playsound(parent, sound(pick(squeak_sound)), volume, TRUE, 10)
else
playsound(parent, sound(squeak_sound), volume, TRUE, 10)


/datum/component/squeak/proc/step_squeak()
SIGNAL_HANDLER
if(steps > step_delay)
Expand All @@ -71,7 +73,6 @@
else
steps++


/datum/component/squeak/proc/play_squeak_crossed(datum/source, atom/movable/AM, oldloc, oldlocs)
SIGNAL_HANDLER
if(isitem(AM))
Expand All @@ -90,32 +91,29 @@
if(CHECK_MULTIPLE_BITFIELDS(AM.pass_flags, HOVERING))
return
var/atom/current_parent = parent
if(isturf(current_parent.loc))
play_squeak()

if(!isturf(current_parent.loc))
return
play_squeak()

/datum/component/squeak/proc/use_squeak()
if(last_use + use_delay < world.time)
last_use = world.time
play_squeak()

if(last_use + use_delay > world.time)
return
last_use = world.time
play_squeak()

/datum/component/squeak/proc/on_equip(datum/source, mob/equipper, slot)
SIGNAL_HANDLER
RegisterSignal(equipper, COMSIG_MOVABLE_DISPOSING, PROC_REF(disposing_react), TRUE)


/datum/component/squeak/proc/on_drop(datum/source, mob/user)
SIGNAL_HANDLER
UnregisterSignal(user, COMSIG_MOVABLE_DISPOSING)


/datum/component/squeak/proc/disposing_react(datum/source, obj/structure/disposalholder/holder, obj/machinery/disposal/disposal_unit)
SIGNAL_HANDLER
//We don't need to worry about unregistering this signal as it will happen for us automaticaly when the holder is qdeleted
RegisterSignal(holder, COMSIG_ATOM_DIR_CHANGE, PROC_REF(holder_dir_change))


/datum/component/squeak/proc/holder_dir_change(datum/source, old_dir, new_dir)
SIGNAL_HANDLER
//If the dir changes it means we're going through a bend in the pipes, let's pretend we bumped the wall
Expand Down
3 changes: 2 additions & 1 deletion code/game/objects/items/storage/boxes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,7 @@
max_storage_space = 14
spawn_type = /obj/item/explosive/grenade/flare
spawn_number = 14
flags_storage = BYPASS_CRYO_CHECK

/obj/item/storage/box/m94/update_icon_state()
. = ..()
Expand Down Expand Up @@ -408,14 +409,14 @@
spawn_type = /obj/item/lightstick/red
spawn_number = 7


/obj/item/storage/box/MRE
name = "\improper TGMC MRE"
desc = "Meal Ready-to-Eat, meant to be consumed in the field, and has an expiration that is two decades past a marine's average combat life expectancy."
icon_state = "mealpack"
w_class = WEIGHT_CLASS_SMALL
can_hold = list(/obj/item/reagent_containers/food/snacks/packaged_meal)
storage_slots = 4
flags_storage = BYPASS_CRYO_CHECK
foldable = 0
var/isopened = 0
///the item left behind when this is used up
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/storage/fancy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,7 @@
w_class = WEIGHT_CLASS_TINY
throwforce = 2
flags_equip_slot = ITEM_SLOT_BELT
flags_storage = BYPASS_CRYO_CHECK
max_storage_space = 18
storage_slots = 18
can_hold = list(
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/storage/firstaid.dm
Original file line number Diff line number Diff line change
Expand Up @@ -262,6 +262,7 @@
storage_slots = null
use_sound = 'sound/items/pillbottle.ogg'
max_storage_space = 16
flags_storage = BYPASS_CRYO_CHECK
greyscale_config = /datum/greyscale_config/pillbottle
greyscale_colors = "#d9cd07#f2cdbb" //default colors
refill_types = list(/obj/item/storage/pill_bottle)
Expand Down
1 change: 1 addition & 0 deletions code/game/objects/items/storage/holsters.dm
Original file line number Diff line number Diff line change
Expand Up @@ -514,6 +514,7 @@
name = "flare pouch"
desc = "A pouch designed to hold flares and a single flaregun. Refillable with a M94 flare pack."
flags_equip_slot = ITEM_SLOT_POCKET
flags_storage = BYPASS_CRYO_CHECK
storage_slots = 28
max_storage_space = 28
icon = 'icons/Marine/marine-pouches.dmi'
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/storage/pill_packets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
var/trash_item = /obj/item/trash/pillpacket
refill_types = null
refill_sound = null
flags_storage = BYPASS_VENDOR_CHECK
flags_storage = BYPASS_VENDOR_CHECK|BYPASS_CRYO_CHECK

/obj/item/storage/pill_bottle/packet/remove_from_storage(obj/item/item, atom/new_location, mob/user)
. = ..()
Expand Down
13 changes: 9 additions & 4 deletions code/game/objects/machinery/cryopod.dm
Original file line number Diff line number Diff line change
Expand Up @@ -187,17 +187,22 @@
assigned_squad?.remove_from_squad(src)
return ..()

/obj/item/proc/store_in_cryo()
/// Move the item to the cryo, if storage_to_remove_from is set, it will try to properly remove the item from the storage
/obj/item/proc/store_in_cryo(obj/item/storage/storage_to_remove_from)
if(is_type_in_typecache(src, GLOB.do_not_preserve) || HAS_TRAIT(src, TRAIT_NODROP) || (flags_item & (ITEM_ABSTRACT|DELONDROP)))
if(!QDELETED(src))
qdel(src)
return
moveToNullspace()
if(!isnull(storage_to_remove_from))
storage_to_remove_from.remove_from_storage(src, null, usr)
else
moveToNullspace()
GLOB.cryoed_item_list += src

/obj/item/storage/store_in_cryo()
for(var/obj/item/I AS in src)
I.store_in_cryo()
if(!(flags_storage & BYPASS_CRYO_CHECK))
for(var/obj/item/I AS in src)
I.store_in_cryo(src)
return ..()

/obj/machinery/cryopod/attackby(obj/item/I, mob/user, params)
Expand Down
8 changes: 6 additions & 2 deletions code/game/objects/machinery/vending/vending.dm
Original file line number Diff line number Diff line change
Expand Up @@ -467,14 +467,18 @@
/obj/machinery/vending/proc/vend(datum/vending_product/R, mob/user)
if(!allowed(user) && (!wires.is_cut(WIRE_IDSCAN) || hacking_safety)) //For SECURE VENDING MACHINES YEAH
to_chat(user, span_warning("Access denied."))
flick(icon_deny, src)
if(icon_deny)
flick(icon_deny, src)
return

if(R.category == CAT_HIDDEN && !extended_inventory)
return

if(locate(/obj/structure/closet/crate) in loc) // RUTMGC ADDITION, hardcoded check to prevent stacking closed crates in vallhalla and opening them all at once with explosion
var/turf/T = loc
if(length(T.contents) > 30 || locate(/obj/structure/closet/crate) in loc) // let's make crashing the server a bit harder
to_chat(user, span_warning("The floor is too cluttered, make some space."))
if(icon_deny)
flick(icon_deny, src)
return

vend_ready = 0 //One thing at a time!!
Expand Down
10 changes: 5 additions & 5 deletions code/modules/reqs/supplypacks/supplies.dm
Original file line number Diff line number Diff line change
Expand Up @@ -50,27 +50,27 @@
/datum/supply_packs/supplies/carpplush
name = "Carp Plushie"
contains = list(/obj/item/toy/plush/carp)
cost = 10
cost = 50

/datum/supply_packs/supplies/lizplush
name = "Lizard Plushie"
contains = list(/obj/item/toy/plush/lizard)
cost = 10
cost = 50

/datum/supply_packs/supplies/slimeplush
name = "Slime Plushie"
contains = list(/obj/item/toy/plush/slime)
cost = 10
cost = 50

/datum/supply_packs/supplies/mothplush
name = "Moth Plushie"
contains = list(/obj/item/toy/plush/moth)
cost = 10
cost = 50

/datum/supply_packs/supplies/rounyplush
name = "Rouny Plushie"
contains = list(/obj/item/toy/plush/rouny)
cost = 10
cost = 50

/datum/supply_packs/supplies/games
name = "Games crate"
Expand Down

0 comments on commit 6e09cc2

Please sign in to comment.