Skip to content

Commit

Permalink
Merge pull request #5 from Tk420634/fenwork
Browse files Browse the repository at this point in the history
sorry dan, fixing slot machines
  • Loading branch information
Tk420634 committed Jul 12, 2024
2 parents a97d555 + 91bd3d4 commit 4afce60
Show file tree
Hide file tree
Showing 10 changed files with 233 additions and 151 deletions.
204 changes: 125 additions & 79 deletions _maps/map_files/coyote_bayou/foxybar.dmm

Large diffs are not rendered by default.

18 changes: 8 additions & 10 deletions _maps/map_files/coyote_bayou/foxybarupper.dmm
Original file line number Diff line number Diff line change
Expand Up @@ -1211,9 +1211,6 @@
},
/area/f13/caves)
"tF" = (
/obj/machinery/computer/slot_machine{
pixel_y = 16
},
/obj/effect/turf_decal/siding/wood{
dir = 1;
color = "#3B2B1A"
Expand All @@ -1223,6 +1220,10 @@
dir = 4;
color = "#3B2B1A"
},
/obj/machinery/computer/slot_machine{
pixel_y = 16;
density = 0
},
/turf/open/floor/carpet/black,
/area/f13/fb/bar)
"tJ" = (
Expand Down Expand Up @@ -1540,14 +1541,15 @@
},
/area/f13/fb/bar)
"yx" = (
/obj/machinery/computer/slot_machine{
pixel_y = 16
},
/obj/effect/turf_decal/siding/wood{
dir = 1;
color = "#3B2B1A"
},
/obj/structure/chair/stool/retro/tan,
/obj/machinery/computer/slot_machine{
pixel_y = 16;
density = 0
},
/turf/open/floor/carpet/black,
/area/f13/fb/bar)
"yH" = (
Expand Down Expand Up @@ -1938,10 +1940,6 @@
color = "#3B2B1A"
},
/obj/structure/chair/stool/retro/tan,
/obj/machinery/computer/slot_machine{
pixel_y = 16;
density = 0
},
/turf/open/floor/carpet/black,
/area/f13/fb/bar)
"Do" = (
Expand Down
14 changes: 14 additions & 0 deletions code/datums/components/storage/concrete/bags.dm
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,20 @@
. = ..()
can_hold = GLOB.storage_produce_bag_can_hold

/// dice cup
/datum/component/storage/concrete/bag/dice_cup
max_items = STORAGE_TRASH_BAG_MAX_ITEMS
max_w_class = WEIGHT_CLASS_NORMAL
max_combined_w_class = STORAGE_TRASH_BAG_MAX_TOTAL_SPACE
max_volume = STORAGE_TRASH_BAG_MAX_TOTAL_SPACE
display_numerical_stacking = FALSE
limited_random_access = FALSE
allow_quick_empty = FALSE

/datum/component/storage/concrete/bag/dice_cup/Initialize()
. = ..()
can_hold = typecacheof(/obj/item/dice)

/// Salvage bag
/datum/component/storage/concrete/bag/salvage
max_items = STORAGE_SALVAGE_BAG_MAX_ITEMS
Expand Down
26 changes: 13 additions & 13 deletions code/datums/components/storage/storage.dm
Original file line number Diff line number Diff line change
Expand Up @@ -98,19 +98,19 @@
if(master)
change_master(master)

RegisterSignal(parent, COMSIG_CONTAINS_STORAGE,PROC_REF(on_check))
RegisterSignal(parent, COMSIG_IS_STORAGE_LOCKED,PROC_REF(check_locked))
RegisterSignal(parent, COMSIG_TRY_STORAGE_SHOW,PROC_REF(signal_show_attempt))
RegisterSignal(parent, COMSIG_TRY_STORAGE_INSERT,PROC_REF(signal_insertion_attempt))
RegisterSignal(parent, COMSIG_TRY_STORAGE_CAN_INSERT,PROC_REF(signal_can_insert))
RegisterSignal(parent, COMSIG_TRY_STORAGE_TAKE_TYPE,PROC_REF(signal_take_type))
RegisterSignal(parent, COMSIG_TRY_STORAGE_FILL_TYPE,PROC_REF(signal_fill_type))
RegisterSignal(parent, COMSIG_TRY_STORAGE_SET_LOCKSTATE,PROC_REF(set_locked))
RegisterSignal(parent, COMSIG_TRY_STORAGE_TAKE,PROC_REF(signal_take_obj))
RegisterSignal(parent, COMSIG_TRY_STORAGE_QUICK_EMPTY,PROC_REF(signal_quick_empty))
RegisterSignal(parent, COMSIG_TRY_STORAGE_HIDE_FROM,PROC_REF(signal_hide_attempt))
RegisterSignal(parent, COMSIG_TRY_STORAGE_HIDE_ALL,PROC_REF(close_all))
RegisterSignal(parent, COMSIG_TRY_STORAGE_RETURN_INVENTORY,PROC_REF(signal_return_inv))
RegisterSignal(parent, COMSIG_CONTAINS_STORAGE, PROC_REF(on_check))
RegisterSignal(parent, COMSIG_IS_STORAGE_LOCKED, PROC_REF(check_locked))
RegisterSignal(parent, COMSIG_TRY_STORAGE_SHOW, PROC_REF(signal_show_attempt))
RegisterSignal(parent, COMSIG_TRY_STORAGE_INSERT, PROC_REF(signal_insertion_attempt))
RegisterSignal(parent, COMSIG_TRY_STORAGE_CAN_INSERT, PROC_REF(signal_can_insert))
RegisterSignal(parent, COMSIG_TRY_STORAGE_TAKE_TYPE, PROC_REF(signal_take_type))
RegisterSignal(parent, COMSIG_TRY_STORAGE_FILL_TYPE, PROC_REF(signal_fill_type))
RegisterSignal(parent, COMSIG_TRY_STORAGE_SET_LOCKSTATE, PROC_REF(set_locked))
RegisterSignal(parent, COMSIG_TRY_STORAGE_TAKE, PROC_REF(signal_take_obj))
RegisterSignal(parent, COMSIG_TRY_STORAGE_QUICK_EMPTY, PROC_REF(signal_quick_empty))
RegisterSignal(parent, COMSIG_TRY_STORAGE_HIDE_FROM, PROC_REF(signal_hide_attempt))
RegisterSignal(parent, COMSIG_TRY_STORAGE_HIDE_ALL, PROC_REF(close_all))
RegisterSignal(parent, COMSIG_TRY_STORAGE_RETURN_INVENTORY, PROC_REF(signal_return_inv))

RegisterSignal(parent, COMSIG_PARENT_ATTACKBY,PROC_REF(attackby))

Expand Down
27 changes: 12 additions & 15 deletions code/game/machinery/slotmachine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#define SMALL_PRIZE 25
#define BIG_PRIZE 50
#define DEFAULT_JACKPOT 100
#define SPIN_TIME 60 //As always, deciseconds.
#define SPIN_TIME 50 //As always, deciseconds.
#define REEL_DEACTIVATE_DELAY 7
#define SEVEN "<font color='red'>7</font>"
#define MAX_CASH_STACK_AMOUNT 15000 // This should be the currencies max limit.
Expand Down Expand Up @@ -159,7 +159,7 @@

visible_message(span_notice("[user] pulls the lever and the slot machine starts spinning!"))
//we put the sound here, so it plays when you pull the lever
playsound(src, 'sound/machines/slotmachine.ogg', 100, TRUE, -1)
playsound(src, 'sound/machines/slotmachine.ogg.ogg', 100, TRUE, -1)

balance -= SPIN_PRICE
money += SPIN_PRICE
Expand Down Expand Up @@ -216,30 +216,31 @@

if(reels[1][2] + reels[2][2] + reels[3][2] + reels[4][2] + reels[5][2] == "[SEVEN][SEVEN][SEVEN][SEVEN][SEVEN]")
visible_message("<b>[src]</b> says, 'JACKPOT! You win [money] coins!'")
playsound(src, 'sound/machines/jackpot.ogg', 70, TRUE, -1)
playsound(src, 'sound/machines/jackpot.ogg', 50, TRUE, -1)
jackpots += 1
give_money(money)
drop_caps(money)
money = 0

else if(linelength == 5)
visible_message("<b>[src]</b> says, 'Big Winner! You win [BIG_PRIZE] coins!'")
playsound(src, 'sound/machines/bigwin.ogg', 70, TRUE, -1)
give_money(BIG_PRIZE)
playsound(src, 'sound/machines/bigwin.ogg', 50, TRUE, -1)
drop_caps(BIG_PRIZE)

else if(linelength == 4)
visible_message("<b>[src]</b> says, 'Winner! You win [SMALL_PRIZE] coins!'")
playsound(src, 'sound/machines/smallwin.ogg', 70, TRUE, -1)
give_money(SMALL_PRIZE)
playsound(src, 'sound/machines/smallwin.ogg', 50, TRUE, -1)
drop_caps(SMALL_PRIZE)

else if(linelength == 3)
to_chat(user, span_notice("You win three free games!"))
give_money(SPIN_PRICE * 4)
playsound(src, 'sound/machines/smallwin.ogg', 70, TRUE, -1)
drop_caps(SPIN_PRICE * 4)
playsound(src, 'sound/machines/smallwin.ogg', 50, TRUE, -1)
money = max(money - SPIN_PRICE * 4, money)

else
to_chat(user, span_warning("No luck!"))
playsound(src, 'sound/machines/fail.ogg', 100, TRUE, -1)

/obj/machinery/computer/slot_machine/proc/get_lines()
var/amountthesame
for(var/i = 1, i <= 3, i++)
Expand All @@ -258,11 +259,7 @@
return amountthesame

/obj/machinery/computer/slot_machine/proc/give_money(amt)
var/turf/here = get_turf(src)
var/obj/item/stack/f13Cash/caps/money = locate(/obj/item/stack/f13Cash/caps) in here
if(!money)
money = new /obj/item/stack/f13Cash/caps(here)
money.amount += amt
balance += amt

#undef SEVEN
#undef SPIN_TIME
Expand Down
81 changes: 60 additions & 21 deletions code/game/objects/items/dice.dm
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@
diceroll(thrownby)
. = ..()

/obj/item/dice/proc/diceroll(mob/user)
/obj/item/dice/proc/diceroll(mob/user, sayit = TRUE)
result = roll(sides)
if(rigged && result != rigged)
if(prob(clamp(1/(sides - 1) * 100, 25, 80)))
Expand All @@ -175,7 +175,11 @@
result = (result - 1)*10
if(special_faces.len == sides)
result = special_faces[result]
if(user != null) //Dice was rolled in someone's hand
if(sayit)
say_result(user, fake_result, comment)

/obj/item/dice/proc/say_result(mob/user, fake_result, comment)
if(!isnull(user)) //Dice was rolled in someone's hand
user.visible_message("[user] has thrown [src]. It lands on [result]. [comment]", \
span_notice("You throw [src]. It lands on [result]. [comment]"), \
span_italic("You hear [src] rolling, it sounds like a [fake_result]."))
Expand All @@ -191,26 +195,61 @@
rigged = result
..(M)

/obj/item/storage/bag/tray/dice_cup
name = "tray"
desc = "A metal tray to lay food on."
/obj/item/storage/bag/dice_cup
name = "dice cup"
desc = "Put dice in this cup! Click it to roll them inside the cup! Smack it on a table to dump em out! Gambling is fun!"
icon = 'icons/obj/drinks.dmi'
icon_state = "stone_mug"
max_items = 2000
max_reach = 7
component_type = /datum/component/storage/concrete/bag/dice_cup

/obj/item/storage/bag/tray/dice_cup/ComponentInitialize()
. = ..()
var/datum/component/storage/STR = GetComponent(/datum/component/storage)
STR.max_w_class = WEIGHT_CLASS_NORMAL
STR.can_hold = typecacheof(/obj/item/dice)
STR.insert_preposition = "in"
STR.max_items = max_items

/obj/item/storage/bag/tray/dice_cup/attack(mob/living/M, mob/living/user)
var/list/oldContents = contents.Copy()
for(var/obj/item/dice/D in oldContents)
D.diceroll(user)
/obj/item/storage/bag/dice_cup/ComponentInitialize()
. = ..()
// Drop all the things. All of them.


RegisterSignal(src, COMSIG_ITEM_ATTACK_SELF, PROC_REF(rattle_them_bones))
RegisterSignal(src, COMSIG_TABLE_CLICKED_WITH_ITEM, PROC_REF(click_on_table))

/obj/item/storage/bag/dice_cup/proc/rattle_them_bones(datum/source, mob/M)
if(!M)
return
if(!LAZYLEN(contents))
M.visible_message(
span_notice("[M] rattles [M.p_their()] empty dice cup! Pass the dice, please!"),
span_italic("You rattle your empty dice cup!"))
return
M.visible_message(
span_notice("[M] rattles [M.p_their()] dice cup! The dice inside clatter!"),
span_italic("You rattle your dice cup! The dice inside clatter!"))

/// actually rolls the dice and chunks them out on the table
/// must be a table, but ya know
/obj/item/storage/bag/dice_cup/proc/click_on_table(datum/source, obj/structure/table/T, mob/user, params)
if(!T || !user)
return
/// first check if there are any dice on the table
var/turf/tabturf = get_turf(T)
if(!tabturf)
return
var/haz_dice = FALSE
for(var/obj/item/dice/D in tabturf.contents)
if(SEND_SIGNAL(src, COMSIG_TRY_STORAGE_INSERT, D, user, TRUE))
haz_dice = TRUE
if(haz_dice)
user.visible_message(
span_notice("[user] gathers up the dice on the table and puts them in [src]."),
span_italic("You gather up the dice on the table and put them in [src]."))
return TABLE_NO_PLACE // I love this anime, Table No Place
/// if there are no dice on the table, dump the dice cup's contents
if(!LAZYLEN(contents))
return
var/list/output_messages = list()
for(var/obj/item/dice/D in contents)
if(!SEND_SIGNAL(src, COMSIG_TRY_STORAGE_TAKE, D, tabturf, FALSE))
continue
D.diceroll(user, FALSE)
output_messages += "[FOURSPACES]\A [D] rolls: [D.result]"
D.pixel_x = rand(-16, 16)
D.pixel_y = rand(-16, 16)
var/msg_out = span_green("[user] dumps the dice out of \the [src]! And here are the results...<br>")
msg_out += span_notice(output_messages.Join("<br>"))
user.visible_message(msg_out)
return TABLE_NO_PLACE
3 changes: 0 additions & 3 deletions code/modules/fallout/areas/area.dm
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
/datum/looping_sound/ambient/swamp,
/datum/looping_sound/ambient/critters/birds,
/datum/looping_sound/ambient/critters/birds/crow,
/datum/looping_sound/ambient/critters/frogs,
/datum/looping_sound/ambient/forest,
)
outdoors = 1
Expand Down Expand Up @@ -61,9 +60,7 @@
name = "City"
icon_state = "yellow"
ambience_area = list(
/datum/looping_sound/ambient/city,
/datum/looping_sound/ambient/critters,

/datum/looping_sound/ambient/swamp/quiet,
/datum/looping_sound/ambient/critters/birds,
/datum/looping_sound/ambient/critters/birds/crow,
Expand Down
11 changes: 1 addition & 10 deletions code/modules/mob/dead/new_player/new_player.dm
Original file line number Diff line number Diff line change
Expand Up @@ -612,16 +612,7 @@

for(var/i in GLOB.player_list)
if(isliving(i))
if(istype(humanc.get_item_by_slot(SLOT_WEAR_ID), /obj/item/card/id/selfassign))
var/obj/item/card/id/selfassign/id = humanc.get_item_by_slot(SLOT_WEAR_ID)
to_chat(i, span_nicegreen("You hear through the grapevine that [humanc.name] the [id.assignment] may be poking around the bar."))

else if(istype(humanc.get_item_by_slot(SLOT_WEAR_ID), /obj/item/pda))
var/obj/item/pda/id = humanc.get_item_by_slot(SLOT_WEAR_ID)
to_chat(i, span_nicegreen("You hear through the grapevine that [humanc.name] the [id.ownjob] may be poking around the bar."))

else
to_chat(i, span_nicegreen("You hear through the grapevine that [humanc.name] the [rank] may be poking around the bar."))
to_chat(i, span_nicegreen("You overhear a mention that [humanc.name] may be poking around the bar."))

/mob/dead/new_player/proc/AddEmploymentContract(mob/living/carbon/human/employee)
//TODO: figure out a way to exclude wizards/nukeops/demons from this.
Expand Down
Binary file removed sound/machines/slotmachine.ogg
Binary file not shown.
Binary file added sound/machines/slotmachine.ogg.ogg
Binary file not shown.

0 comments on commit 4afce60

Please sign in to comment.