diff --git a/code/game/machinery/slotmachine.dm b/code/game/machinery/slotmachine.dm index 192d2355656..7e132f64614 100644 --- a/code/game/machinery/slotmachine.dm +++ b/code/game/machinery/slotmachine.dm @@ -1,4 +1,5 @@ var/datum/announcement/minor/slotmachine_announcement = new(do_log = 0) + /obj/machinery/slot_machine name = "slot machine" desc = "Gambling for the antisocial." @@ -6,77 +7,70 @@ var/datum/announcement/minor/slotmachine_announcement = new(do_log = 0) icon_state = "slots-off" anchored = 1 density = 1 -// mats = 10 - var/money = 25000 var/plays = 0 var/working = 0 var/balance=0 - attack_hand(var/mob/user as mob) - if(user.mind) - if(user.mind.initial_account) - balance = user.mind.initial_account.money - user.machine = src - if (src.working) - var/dat = {"Slot Machine
-

- Please wait!
"} - user << browse(dat, "window=slotmachine;size=450x500") - onclose(user, "slotmachine") - else - var/dat = {"Slot Machine
-

- Five credits to play!
- Prize Money Available: [src.money]
- Credits Remaining: [balance]
- [src.plays] players have tried their luck today!
-

- Play!
"} - user << browse(dat, "window=slotmachine;size=400x500") - onclose(user, "slotmachine") +/obj/machinery/slot_machine/attack_hand(var/mob/user as mob) + if(user.mind) + if(user.mind.initial_account) + balance = user.mind.initial_account.money + user.machine = src + if (working) + var/dat = {"Slot Machine
+

+ Please wait!
"} + user << browse(dat, "window=slotmachine;size=450x500") + onclose(user, "slotmachine") + else + var/dat = {"Slot Machine
+

+ Five credits to play!
+ Credits Remaining: [balance]
+ [plays] players have tried their luck today!
+

+
Play!
"} + user << browse(dat, "window=slotmachine;size=400x500") + onclose(user, "slotmachine") - Topic(href, href_list) - if(href_list["ops"]) - var/operation = text2num(href_list["ops"]) - if(operation == 1) // Play -/* if (src.working == 1) - usr << "\red You need to wait until the machine stops spinning!" - return */ - if (balance < 5) - usr << "\red Insufficient money to play!" - return - usr.mind.initial_account.money -= 5 - src.money += 5 - src.plays += 1 - src.working = 1 - src.icon_state = "slots-on" - usr << "Let's roll!" - var/roll = rand(1,10000) - spawn(100) - if (roll == 1) - for(var/mob/O in hearers(src, null)) - O.show_message(text("[] says, 'JACKPOT! You win [src.money]!'", src), 1) - slotmachine_announcement.Announce("Congratulations [usr.name] on winning the Jackpot!", "Jackpot Winner") - usr.mind.initial_account.money += src.money - src.money = 0 - else if (roll > 1 && roll <= 10) - for(var/mob/O in hearers(src, null)) - O.show_message(text("[] says, 'Big Winner! You win five thousand credits!'", src), 1) - usr.mind.initial_account.money += 5000 - src.money -= 5000 - else if (roll > 10 && roll <= 100) - for(var/mob/O in hearers(src, null)) - O.show_message(text("[] says, 'Winner! You win five hundred credits!'", src), 1) - usr.mind.initial_account.money += 500 - src.money -= 500 - else if (roll > 100 && roll <= 1000) - usr << "\blue You win a free game!" - usr.mind.initial_account.money += 5 - src.money -= 5 - else - usr << "\red No luck!" - src.working = 0 - src.icon_state = "slots-off" - src.add_fingerprint(usr) - src.updateUsrDialog() - return +/obj/machinery/slot_machine/Topic(href, href_list) + if(href_list["ops"]) + var/operation = text2num(href_list["ops"]) + if(operation == 1) // Play + if (working == 1) + usr << "You need to wait until the machine stops spinning!" + return + if (balance < 5) + usr << "Insufficient money to play!" + return + usr.mind.initial_account.money -= 5 + plays += 1 + working = 1 + icon_state = "slots-on" + var/roll = rand(1,10000) + playsound(src.loc, 'sound/machines/ding.ogg', 50, 1) + spawn(30) + if (roll == 1) + playsound(src.loc, 'sound/effects/engine_alert2.ogg', 50, 0) + visible_message("[src] says, 'JACKPOT! [usr.name] has won two hundred and fifty thousand credits!'") + slotmachine_announcement.Announce("Congratulations to [usr.name] on winning the jackpot of two hundred and fifty thousand credits!", "Jackpot Winner") + usr.mind.initial_account.money += 250000 + else if (roll > 1 && roll <= 10) + playsound(src.loc, 'sound/machines/ping.ogg', 50, 0) + visible_message("[src] says, 'Big Winner! [usr.name] has won five thousand credits!'") + usr.mind.initial_account.money += 5000 + else if (roll > 10 && roll <= 100) + playsound(src.loc, 'sound/machines/ping.ogg', 50, 0) + visible_message("[src] says, 'Winner! [usr.name] has won win five hundred credits!'") + usr.mind.initial_account.money += 500 + else if (roll > 100 && roll <= 1000) + playsound(src.loc, 'sound/machines/ping.ogg', 50, 0) + usr << "You win 5 credits!" + usr.mind.initial_account.money += 5 + else + usr << "No luck!" + working = 0 + icon_state = "slots-off" + add_fingerprint(usr) + updateUsrDialog() + return