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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

[READY] Luxury shuttle charges bank cards #40334

Merged
merged 2 commits into from
Sep 24, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 10 additions & 0 deletions code/modules/mob/living/carbon/human/human_helpers.dm
Original file line number Diff line number Diff line change
Expand Up @@ -147,3 +147,13 @@
return FALSE

return .

/mob/living/carbon/human/proc/get_bank_account()
var/datum/bank_account/account
var/obj/item/card/id/I = get_idcard()

if(I && I.registered_account)
account = I.registered_account
return account

return FALSE
70 changes: 46 additions & 24 deletions code/modules/shuttle/special.dm
Original file line number Diff line number Diff line change
Expand Up @@ -206,11 +206,13 @@
//Luxury Shuttle Blockers

/obj/effect/forcefield/luxury_shuttle
name = "Luxury shuttle ticket booth"
desc = "A forceful money collector."
timeleft = 0
var/threshold = 500
var/static/list/approved_passengers = list()
var/static/list/check_times = list()

var/list/payees = list()

/obj/effect/forcefield/luxury_shuttle/CanPass(atom/movable/mover, turf/target)
if(mover in approved_passengers)
Expand All @@ -227,46 +229,66 @@
if(!isliving(AM))
return ..()

if(check_times[AM] && check_times[AM] > world.time) //Let's not spam the message
return ..()

check_times[AM] = world.time + LUXURY_MESSAGE_COOLDOWN

var/total_cash = 0
var/list/counted_money = list()

for(var/obj/item/coin/C in AM.GetAllContents())
total_cash += C.value
payees[AM] += C.value
counted_money += C
if(total_cash >= threshold)
if(payees[AM] >= threshold)
break
for(var/obj/item/stack/spacecash/S in AM.GetAllContents())
total_cash += S.value * S.amount
payees[AM] += S.value * S.amount
counted_money += S
if(total_cash >= threshold)
if(payees[AM] >= threshold)
break

if(AM.pulling)
if(istype(AM.pulling, /obj/item/coin))
var/obj/item/coin/C = AM.pulling
total_cash += C.value
counted_money += C
if(istype(AM.pulling, /obj/item/coin))
var/obj/item/coin/C = AM.pulling
payees[AM] += C.value
counted_money += C

else if(istype(AM.pulling, /obj/item/stack/spacecash))
var/obj/item/stack/spacecash/S = AM.pulling
payees[AM] += S.value * S.amount
counted_money += S

if(ishuman(AM))
var/mob/living/carbon/human/H = AM
if(H.get_bank_account())
var/datum/bank_account/account = H.get_bank_account()

else if(istype(AM.pulling, /obj/item/stack/spacecash))
var/obj/item/stack/spacecash/S = AM.pulling
total_cash += S.value * S.amount
counted_money += S
if(account.account_balance < threshold)
payees[AM] += account.account_balance
account.adjust_money(-account.account_balance)
else
var/money_owed = threshold - payees[AM]
payees[AM] += money_owed
account.adjust_money(-money_owed)

if(total_cash >= threshold)
if(payees[AM] >= threshold)
for(var/obj/I in counted_money)
qdel(I)

to_chat(AM, "Thank you for your payment! Please enjoy your flight.")
payees[AM] -= threshold
say("<span class='robot'>Welcome aboard, [AM]!</span>")
approved_passengers += AM

if(payees[AM] > 0 && ishuman(AM))
var/mob/living/carbon/human/H = AM
if(H.get_bank_account())
var/datum/bank_account/account = H.get_bank_account()
account.adjust_money(payees[AM])
payees[AM] -= payees[AM]

check_times -= AM
return
else if (payees[AM] > 0)
for(var/obj/I in counted_money)
qdel(I)
if(!check_times[AM] || check_times[AM] < world.time) //Let's not spam the message
say("<span class='robot'>$[payees[AM]] received, [AM]. You need $[threshold-payees[AM]] more.</span>")
check_times[AM] = world.time + LUXURY_MESSAGE_COOLDOWN
return ..()
else
to_chat(AM, "<span class='warning'>You don't have enough money to enter the main shuttle. You'll have to fly coach.</span>")
return ..()

/mob/living/simple_animal/hostile/bear/fightpit
Expand Down