Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The Great Shiptest IRS Audit (Branch Edition) #3917

Open
wants to merge 22 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 5 additions & 4 deletions code/game/machinery/roulette_machine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
///Machine that lets you play roulette. Odds are pre-defined to be the same as European Roulette without the "En Prison" rule
/obj/machinery/roulette
name = "Roulette Table"
desc = "A computerized roulette table. Swipe your ID to play or register yourself as owner!"
desc = "A computerized roulette table. Swipe your cash card to play or register yourself as the owner!"
icon = 'icons/obj/machines/roulette.dmi'
icon_state = "idle"
density = TRUE
Expand Down Expand Up @@ -213,11 +213,11 @@
audible_message("<span class='notice'>The result is: [result]</span>")

playing = FALSE
update_icon(potential_payout, color, rolled_number, is_winner)
update_icon(ALL, potential_payout, color, rolled_number, is_winner)
handle_color_light(color)

if(!is_winner)
audible_message("<span class='warning'>You lost! Better luck next time</span>")
audible_message("<span class='warning'>You lost! Better luck next time!</span>")
playsound(src, 'sound/machines/synth_no.ogg', 50)
return FALSE

Expand Down Expand Up @@ -403,7 +403,7 @@

/obj/item/roulette_wheel_beacon
name = "roulette wheel beacon"
desc = "N.T. approved roulette wheel beacon, toss it down and you will have a complementary roulette wheel delivered to you."
desc = "An N.T.-approved roulette wheel beacon. Toss it down, and a complementary roulette wheel will be delivered to you."
icon = 'icons/obj/objects.dmi'
icon_state = "floor_beacon"
var/used
Expand All @@ -412,6 +412,7 @@
if(used)
return
loc.visible_message("<span class='warning'>\The [src] begins to beep loudly!</span>")
playsound(get_turf(src), 'sound/machines/click.ogg', 50, TRUE)
used = TRUE
addtimer(CALLBACK(src, PROC_REF(launch_payload)), 40)

Expand Down
101 changes: 19 additions & 82 deletions code/game/machinery/slotmachine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
| Slot Machines |
| Original code by Glloyd |
| Tgstation port by Miauw |
| Shiptest adjustments by |
| Flopppi |
\*******************************/

#define SPIN_PRICE 5
Expand All @@ -11,8 +13,6 @@
#define SPIN_TIME 65 //As always, deciseconds.
#define REEL_DEACTIVATE_DELAY 7
#define SEVEN "<font color='red'>7</font>"
#define CASH 1
#define COIN 2

/obj/machinery/computer/slot_machine
name = "slot machine"
Expand All @@ -31,9 +31,6 @@
var/working = 0
var/balance = 0 //How much money is in the machine, ready to be CONSUMED.
var/jackpots = 0
var/paymode = CASH //toggles between CASH/COIN, defined above
var/cointype = /obj/item/coin/iron //default cointype
var/list/coinvalues = list()
var/list/reels = list(list("", "", "") = 0, list("", "", "") = 0, list("", "", "") = 0, list("", "", "") = 0, list("", "", "") = 0)
var/list/symbols = list(SEVEN = 1, "<font color='orange'>&</font>" = 2, "<font color='yellow'>@</font>" = 2, "<font color='green'>$</font>" = 2, "<font color='blue'>?</font>" = 2, "<font color='grey'>#</font>" = 2, "<font color='white'>!</font>" = 2, "<font color='fuchsia'>%</font>" = 2) //if people are winning too much, multiply every number in this list by 2 and see if they are still winning too much.

Expand All @@ -51,10 +48,6 @@

INVOKE_ASYNC(src, PROC_REF(toggle_reel_spin), FALSE)

for(cointype in typesof(/obj/item/coin))
var/obj/item/coin/C = cointype
coinvalues["[cointype]"] = initial(C.value)

/obj/machinery/computer/slot_machine/Destroy()
if(balance)
give_payout(balance)
Expand Down Expand Up @@ -82,45 +75,13 @@


/obj/machinery/computer/slot_machine/attackby(obj/item/I, mob/living/user, params)
if(istype(I, /obj/item/coin))
var/obj/item/coin/C = I
if(paymode == COIN)
if(prob(2))
if(!user.transferItemToLoc(C, drop_location(), silent = FALSE))
return
C.throw_at(user, 3, 10)
if(prob(10))
balance = max(balance - SPIN_PRICE, 0)
to_chat(user, "<span class='warning'>[src] spits your coin back out!</span>")

else
if(!user.temporarilyRemoveItemFromInventory(C))
return
to_chat(user, "<span class='notice'>You insert [C] into [src]'s slot!</span>")
balance += C.value
qdel(C)
else
to_chat(user, "<span class='warning'>This machine is only accepting cash!</span>")
else if(istype(I, /obj/item/spacecash/bundle))
if(paymode == CASH)
var/obj/item/spacecash/bundle/H = I
if(!user.temporarilyRemoveItemFromInventory(H))
return
to_chat(user, "<span class='notice'>You insert [H.value] credits into [src]'s! slot</span>")
balance += H.value
qdel(H)
else
to_chat(user, "<span class='warning'>This machine is only accepting coins!</span>")
else if(I.tool_behaviour == TOOL_MULTITOOL)
if(balance > 0)
visible_message("<b>[src]</b> says, 'ERROR! Please empty the machine balance before altering paymode'") //Prevents converting coins into holocredits and vice versa
else
if(paymode == CASH)
paymode = COIN
visible_message("<b>[src]</b> says, 'This machine now works with COINS!'")
else
paymode = CASH
visible_message("<b>[src]</b> says, 'This machine now works with CASH!'")
if(istype(I, /obj/item/spacecash/bundle))
var/obj/item/spacecash/bundle/H = I
if(!user.temporarilyRemoveItemFromInventory(H))
return
to_chat(user, "<span class='notice'>You insert [H.value] credits into [src]'s slot!</span>")
balance += H.value
qdel(H)
else
return ..()

Expand Down Expand Up @@ -149,7 +110,7 @@

else
dat = {"Five credits to play!<BR>
<B>Prize Money Available:</B> [money] (jackpot payout is ALWAYS 100%!)<BR>
<B>Prize Money Available:</B> [money] (Jackpot payout is ALWAYS 100%!)<BR>
<B>Credit Remaining:</B> [balance]<BR>
[plays] players have tried their luck today, and [jackpots] have won a jackpot!<BR>
<HR><BR>
Expand All @@ -158,7 +119,7 @@
[reeltext]
<BR>"}
if(balance > 0)
dat+="<font size='1'><A href='?src=[REF(src)];refund=1'>Refund balance</A><BR>"
dat+="<font size='1'><A href='?src=[REF(src)];refund=1'>Refund Balance</A><BR>"

var/datum/browser/popup = new(user, "slotmachine", "Slot Machine")
popup.set_content(dat)
Expand Down Expand Up @@ -259,17 +220,11 @@

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] credits!'")
priority_announce("Congratulations to [user ? user.real_name : usrname] for winning the jackpot at the slot machine in [get_area(src)]!")
jackpots += 1
balance += money - give_payout(JACKPOT)
money = 0
if(paymode == CASH)
new /obj/item/spacecash/bundle(loc,JACKPOT)
else
for(var/i = 0, i < 5, i++)
cointype = pick(subtypesof(/obj/item/coin))
var/obj/item/coin/C = new cointype(loc)
random_step(C, 2, 50)

new /obj/item/spacecash/bundle(loc,JACKPOT)

else if(linelength == 5)
visible_message("<b>[src]</b> says, 'Big Winner! You win a thousand credits!'")
Expand Down Expand Up @@ -313,37 +268,21 @@
balance += surplus

/obj/machinery/computer/slot_machine/proc/give_payout(amount)
if(paymode == CASH)
cointype = /obj/item/spacecash/bundle
else
cointype = obj_flags & EMAGGED ? /obj/item/coin/iron : /obj/item/coin/silver

if(!(obj_flags & EMAGGED))
amount = dispense(amount, cointype, null, 0)
amount = dispense(amount, null, 0)

else
var/mob/living/target = locate() in range(2, src)

amount = dispense(amount, cointype, target, 1)
amount = dispense(amount, target, 1)

return amount

/obj/machinery/computer/slot_machine/proc/dispense(amount = 0, cointype = /obj/item/coin/silver, mob/living/target, throwit = 0)
if(paymode == CASH)
var/obj/item/spacecash/bundle/H = new /obj/item/spacecash/bundle(loc, amount)

if(throwit && target)
H.throw_at(target, 3, 10)
else
var/value = coinvalues["[cointype]"]
/obj/machinery/computer/slot_machine/proc/dispense(amount = 0, mob/living/target, throwit = 0)
var/obj/item/spacecash/bundle/H = new /obj/item/spacecash/bundle(loc, amount)

while(amount >= value)
var/obj/item/coin/C = new cointype(loc) //DOUBLE THE PAIN
amount -= value
if(throwit && target)
C.throw_at(target, 3, 10)
else
random_step(C, 2, 40)
if(throwit && target)
H.throw_at(target, 3, 10)

return amount

Expand All @@ -353,5 +292,3 @@
#undef BIG_PRIZE
#undef SMALL_PRIZE
#undef SPIN_PRICE
#undef CASH
#undef COIN
4 changes: 2 additions & 2 deletions tgui/packages/tgui/interfaces/MiningVendor.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ export const MiningVendor = (props, context) => {
</Box>
)) || (
<Box color="light-gray">
No registered ID card!
No registered cash card!
<br />
Please contact your local HoP!
Please contact your local bank!
</Box>
)}
</Section>
Expand Down
2 changes: 1 addition & 1 deletion tgui/packages/tgui/interfaces/Roulette.js
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ export const RouletteBetTable = (props, context) => {
<tr>
<td colSpan="2">
<Box bold m={1} fontSize="14px" textAlign="center">
Swipe an ID card with a connected account to spin!
Swipe a cash card with a connected account to spin!
</Box>
</td>
</tr>
Expand Down
4 changes: 2 additions & 2 deletions tgui/packages/tgui/interfaces/Vending.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,9 @@ export const Vending = (props, context) => {
</Box>
)) || (
<Box color="light-grey">
No registered ID card!
No registered cash card!
<br />
Please contact your local HoP!
Please contact your local bank!
</Box>
)}
</Section>
Expand Down
Loading