Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master' into guestbook
Browse files Browse the repository at this point in the history
  • Loading branch information
meemofcourse committed Mar 27, 2024
2 parents a27aeb5 + 77ca54d commit 995316e
Show file tree
Hide file tree
Showing 69 changed files with 159 additions and 820 deletions.
61 changes: 13 additions & 48 deletions code/controllers/subsystem/economy.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,53 +3,18 @@ SUBSYSTEM_DEF(economy)
init_order = INIT_ORDER_ECONOMY
flags = SS_NO_FIRE
runlevels = RUNLEVEL_GAME
var/roundstart_paychecks = 5
var/budget_pool = 35000
var/list/department_accounts = list(ACCOUNT_CIV = ACCOUNT_CIV_NAME,
ACCOUNT_ENG = ACCOUNT_ENG_NAME,
ACCOUNT_SCI = ACCOUNT_SCI_NAME,
ACCOUNT_MED = ACCOUNT_MED_NAME,
ACCOUNT_SRV = ACCOUNT_SRV_NAME,
ACCOUNT_CAR = ACCOUNT_CAR_NAME,
ACCOUNT_SEC = ACCOUNT_SEC_NAME)
var/list/generated_accounts = list()
var/full_ancap = FALSE // Enables extra money charges for things that normally would be free, such as sleepers/cryo/cloning.
//Take care when enabling, as players will NOT respond well if the economy is set up for low cash flows.
var/slime_bounty = list("grey" = 10,
// tier 1
"orange" = 100,
"metal" = 100,
"blue" = 100,
"purple" = 100,
// tier 2
"dark purple" = 500,
"dark blue" = 500,
"green" = 500,
"silver" = 500,
"gold" = 500,
"yellow" = 500,
"red" = 500,
"pink" = 500,
// tier 3
"cerulean" = 750,
"sepia" = 750,
"bluespace" = 750,
"pyrite" = 750,
"light pink" = 750,
"oil" = 750,
"adamantine" = 750,
// tier 4
"rainbow" = 1000)
var/list/bank_accounts = list() //List of normal accounts (not department accounts)
var/list/dep_cards = list()

/datum/controller/subsystem/economy/Initialize(timeofday)
var/budget_to_hand_out = round(budget_pool / department_accounts.len)
for(var/A in department_accounts)
new /datum/bank_account/department(A, budget_to_hand_out)
return ..()
///List of normal accounts (not ship accounts)
var/list/bank_accounts = list()
///Total amount of physical money in the game
var/physical_money = 0
///Total amount of money in bank accounts
var/bank_money = 0

/datum/controller/subsystem/economy/proc/get_dep_account(dep_id)
for(var/datum/bank_account/department/D in generated_accounts)
if(D.department_id == dep_id)
return D
/datum/controller/subsystem/economy/stat_entry(msg)
msg += "{"
msg += "PH: [physical_money]|"
msg += "BN: [bank_money]|"
msg += "TOT: [physical_money + bank_money]"
msg += "}"
return ..()
2 changes: 1 addition & 1 deletion code/datums/components/pricetag.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
var/price = item_value
if(price)
var/adjusted_value = price*(profit_ratio/100)
owner.adjust_money(adjusted_value)
owner.adjust_money(adjusted_value, "pricetag")
owner.bank_card_talk("Sale recorded. [adjusted_value] credits added to account.")
return TRUE

Expand Down
28 changes: 0 additions & 28 deletions code/datums/datacore.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,33 +48,6 @@
c.dataId = ++securityCrimeCounter
return c

/datum/datacore/proc/addCitation(id = "", datum/data/crime/crime)
for(var/datum/data/record/R in security)
if(R.fields["id"] == id)
var/list/crimes = R.fields["citation"]
crimes |= crime
return

/datum/datacore/proc/removeCitation(id, cDataId)
for(var/datum/data/record/R in security)
if(R.fields["id"] == id)
var/list/crimes = R.fields["citation"]
for(var/datum/data/crime/crime in crimes)
if(crime.dataId == text2num(cDataId))
crimes -= crime
return

/datum/datacore/proc/payCitation(id, cDataId, amount)
for(var/datum/data/record/R in security)
if(R.fields["id"] == id)
var/list/crimes = R.fields["citation"]
for(var/datum/data/crime/crime in crimes)
if(crime.dataId == text2num(cDataId))
crime.paid = crime.paid + amount
var/datum/bank_account/D = SSeconomy.get_dep_account(ACCOUNT_SEC)
D.adjust_money(amount)
return

/**
* Adds crime to security record.
*
Expand Down Expand Up @@ -282,7 +255,6 @@
S.fields["id"] = id
S.fields["name"] = H.real_name
S.fields["criminal"] = "None"
S.fields["citation"] = list()
S.fields["crim"] = list()
S.fields["notes"] = "No notes."
security += S
Expand Down
42 changes: 20 additions & 22 deletions code/game/machinery/bank_machine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
var/siphoning = FALSE
var/next_warning = 0
var/obj/item/radio/radio
var/datum/weakref/ship_account_ref
var/radio_channel = RADIO_CHANNEL_COMMON
var/minimum_time_between_warnings = 400
var/syphoning_credits = 0
Expand All @@ -19,23 +20,21 @@
radio.canhear_range = 0
radio.recalculateChannels()

/obj/machinery/computer/bank_machine/connect_to_shuttle(obj/docking_port/mobile/port, obj/docking_port/stationary/dock)
. = ..()
ship_account_ref = WEAKREF(port.current_ship.ship_account)

/obj/machinery/computer/bank_machine/Destroy()
QDEL_NULL(radio)
. = ..()

/obj/machinery/computer/bank_machine/attackby(obj/item/I, mob/user)
var/value = 0
if(istype(I, /obj/item/spacecash/bundle))
var/obj/item/spacecash/bundle/C = I
value = C.value
else if(istype(I, /obj/item/holochip))
var/obj/item/holochip/H = I
value = H.credits
var/value = I.get_item_credit_value()
if(value)
var/datum/bank_account/D = SSeconomy.get_dep_account(ACCOUNT_CAR)
if(D)
D.adjust_money(value)
to_chat(user, "<span class='notice'>You deposit [I]. The Cargo Budget is now [D.account_balance] cr.</span>")
var/datum/bank_account/ship_account = ship_account_ref.resolve()
if(ship_account)
ship_account.adjust_money(value, "deposit")
to_chat(user, "<span class='notice'>You deposit [I]. The [ship_account.account_holder] Budget is now [ship_account.account_balance] cr.</span>")
qdel(I)
return
return ..()
Expand All @@ -46,15 +45,15 @@
if (machine_stat & (BROKEN|NOPOWER))
say("Insufficient power. Halting siphon.")
end_syphon()
var/datum/bank_account/D = SSeconomy.get_dep_account(ACCOUNT_CAR)
if(!D.has_money(200))
say("Cargo budget depleted. Halting siphon.")
var/datum/bank_account/ship_account = ship_account_ref.resolve()
if(!ship_account?.has_money(200))
say("Ship budget depleted. Halting siphon.")
end_syphon()
return

playsound(src, 'sound/items/poster_being_created.ogg', 100, TRUE)
syphoning_credits += 200
D.adjust_money(-200)
ship_account.adjust_money(-200)
if(next_warning < world.time && prob(15))
var/area/A = get_area(loc)
var/message = "Unauthorized credit withdrawal underway in [initial(A.name)]!!"
Expand All @@ -69,14 +68,13 @@

/obj/machinery/computer/bank_machine/ui_data(mob/user)
var/list/data = list()
var/datum/bank_account/D = SSeconomy.get_dep_account(ACCOUNT_CAR)

if(D)
data["current_balance"] = D.account_balance
var/datum/bank_account/ship_account = ship_account_ref.resolve()
if(ship_account)
data["current_balance"] = ship_account.account_balance
else
data["current_balance"] = 0
data["siphoning"] = siphoning
data["station_name"] = station_name()
data["ship_name"] = ship_account.account_holder

return data

Expand All @@ -87,11 +85,11 @@

switch(action)
if("siphon")
say("Siphon of company credits has begun!")
say("Siphon of ship credits has begun!")
siphoning = TRUE
. = TRUE
if("halt")
say("Company credit withdrawal halted.")
say("Ship credit withdrawal halted.")
end_syphon()
. = TRUE

Expand Down
2 changes: 0 additions & 2 deletions code/game/machinery/computer/card.dm
Original file line number Diff line number Diff line change
Expand Up @@ -419,8 +419,6 @@ GLOBAL_VAR_INIT(time_last_changed_position, 0)
to_chat(usr, "<span class='alert'>No log exists for this job.</span>")
updateUsrDialog()
return
if(inserted_modify_id.registered_account)
inserted_modify_id.registered_account.account_job = jobdatum // this is a terrible idea and people will grief but sure whatever

inserted_modify_id.access = (istype(src, /obj/machinery/computer/card/centcom) ? get_centcom_access(t1) : jobdatum.get_access())
if (inserted_modify_id)
Expand Down
85 changes: 0 additions & 85 deletions code/game/machinery/computer/security.dm
Original file line number Diff line number Diff line change
Expand Up @@ -190,35 +190,9 @@
if((istype(active2, /datum/data/record) && GLOB.data_core.security.Find(active2)))
dat += "<font size='4'><b>Security Data</b></font>"
dat += "<br>Criminal Status: <A href='?src=[REF(src)];choice=Edit Field;field=criminal'>[active2.fields["criminal"]]</A>"
dat += "<br><br>Citations: <A href='?src=[REF(src)];choice=Edit Field;field=citation_add'>Add New</A>"

dat +={"<table style="text-align:center;" border="1" cellspacing="0" width="100%">
<tr>
<th>Crime</th>
<th>Fine</th>
<th>Author</th>
<th>Time Added</th>
<th>Amount Due</th>
<th>Del</th>
</tr>"}
for(var/datum/data/crime/c in active2.fields["citation"])
var/owed = c.fine - c.paid
dat += {"<tr><td>[c.crimeName]</td>
<td>[c.fine] cr</td><td>[c.author]</td>
<td>[c.time]</td>"}
if(owed > 0)
dat += "<td>[owed] cr <A href='?src=[REF(src)];choice=Pay;field=citation_pay;cdataid=[c.dataId]'>\[Pay\]</A></td></td>"
else
dat += "<td>All Paid Off</td>"
dat += {"<td>
<A href='?src=[REF(src)];choice=Edit Field;field=citation_delete;cdataid=[c.dataId]'>\[X\]</A>
</td>
</tr>"}
dat += "</table>"

dat += "<br><br>Crimes: <A href='?src=[REF(src)];choice=Edit Field;field=crim_add'>Add New</A>"


dat +={"<table style="text-align:center;" border="1" cellspacing="0" width="100%">
<tr>
<th>Crime</th>
Expand Down Expand Up @@ -347,26 +321,6 @@ What a mess.*/
active2 = E
screen = 3

if("Pay")
for(var/datum/data/crime/p in active2.fields["citation"])
if(p.dataId == text2num(href_list["cdataid"]))
var/obj/item/holochip/C = usr.is_holding_item_of_type(/obj/item/holochip)
if(C && istype(C))
var/pay = C.get_item_credit_value()
if(!pay)
to_chat(usr, "<span class='warning'>[C] doesn't seem to be worth anything!</span>")
else
var/diff = p.fine - p.paid
GLOB.data_core.payCitation(active2.fields["id"], text2num(href_list["cdataid"]), pay)
to_chat(usr, "<span class='notice'>You have paid [pay] credit\s towards your fine.</span>")
if (pay == diff || pay > diff || pay >= diff)
investigate_log("Citation Paid off: <strong>[p.crimeName]</strong> Fine: [p.fine] | Paid off by [key_name(usr)]", INVESTIGATE_RECORDS)
to_chat(usr, "<span class='notice'>The fine has been paid in full.</span>")
qdel(C)
playsound(src, "terminal_type", 25, FALSE)
else
to_chat(usr, "<span class='warning'>Fines can only be paid with holochips!</span>")

if("Print Record")
if(!(printing))
printing = 1
Expand Down Expand Up @@ -677,45 +631,6 @@ What a mess.*/
return
GLOB.data_core.addCrimeDetails(active1.fields["id"], href_list["cdataid"], t1)
investigate_log("New Crime details: [t1] | Added to [active1.fields["name"]] by [key_name(usr)]", INVESTIGATE_RECORDS)
if("citation_add")
if(istype(active1, /datum/data/record))
var/maxFine = CONFIG_GET(number/maxfine)

var/t1 = stripped_input(usr, "Please input citation crime:", "Secure. records", "", null)
var/fine = FLOOR(input(usr, "Please input citation fine, up to [maxFine]:", "Secure. records", 50) as num|null, 1)

if (isnull(fine))
return
fine = min(fine, maxFine)

if(fine < 0)
to_chat(usr, "<span class='warning'>You're pretty sure that's not how money works.</span>")
return

if(!canUseSecurityRecordsConsole(usr, t1, null, a2))
return

var/crime = GLOB.data_core.createCrimeEntry(t1, "", authenticated, station_time_timestamp(), fine)
for (var/obj/item/pda/P in GLOB.PDAs)
if(P.owner == active1.fields["name"])
var/message = "You have been fined [fine] credits for '[t1]'. Fines may be paid at security."
var/datum/signal/subspace/messaging/pda/signal = new(src, list(
"name" = "Security Citation",
"job" = "Citation Server",
"message" = message,
"targets" = list("[P.owner] ([P.ownjob])"),
"automated" = 1
))
signal.send_to_receivers()
usr.log_message("(PDA: Citation Server) sent \"[message]\" to [signal.format_target()]", LOG_PDA)
GLOB.data_core.addCitation(active1.fields["id"], crime)
investigate_log("New Citation: <strong>[t1]</strong> Fine: [fine] | Added to [active1.fields["name"]] by [key_name(usr)]", INVESTIGATE_RECORDS)
if("citation_delete")
if(istype(active1, /datum/data/record))
if(href_list["cdataid"])
if(!canUseSecurityRecordsConsole(usr, "delete", null, a2))
return
GLOB.data_core.removeCitation(active1.fields["id"], href_list["cdataid"])
if("notes")
if(istype(active2, /datum/data/record))
var/t1 = stripped_input(usr, "Please summarize notes:", "Secure. records", active2.fields["notes"], null)
Expand Down
44 changes: 0 additions & 44 deletions code/game/machinery/computer/warrant.dm
Original file line number Diff line number Diff line change
Expand Up @@ -41,31 +41,6 @@
<strong>[current.fields["criminal"]][notice]</strong>
</div>"}

dat += "<br><br>Citations:"

dat +={"<table style="text-align:center;" border="1" cellspacing="0" width="100%">
<tr>
<th>Crime</th>
<th>Fine</th>
<th>Author</th>
<th>Time Added</th>
<th>Amount Due</th>
<th>Make Payment</th>
</tr>"}
for(var/datum/data/crime/c in current.fields["citation"])
var/owed = c.fine - c.paid
dat += {"<tr><td>[c.crimeName]</td>
<td>[c.fine] cr</td>
<td>[c.author]</td>
<td>[c.time]</td>"}
if(owed > 0)
dat += {"<td>[owed] cr</td>
<td><A href='?src=[REF(src)];choice=Pay;field=citation_pay;cdataid=[c.dataId]'>\[Pay\]</A></td>"}
else
dat += "<td colspan='2'>All Paid Off</td>"
dat += "</tr>"
dat += "</table>"

dat += "<br>Crimes:"
dat +={"<table style="text-align:center;" border="1" cellspacing="0" width="100%">
<tr>
Expand Down Expand Up @@ -108,24 +83,5 @@
authenticated = null
playsound(src, 'sound/machines/terminal_off.ogg', 50, FALSE)

if("Pay")
for(var/datum/data/crime/p in current.fields["citation"])
if(p.dataId == text2num(href_list["cdataid"]))
var/obj/item/holochip/C = M.is_holding_item_of_type(/obj/item/holochip)
if(C && istype(C))
var/pay = C.get_item_credit_value()
if(!pay)
to_chat(M, "<span class='warning'>[C] doesn't seem to be worth anything!</span>")
else
var/diff = p.fine - p.paid
GLOB.data_core.payCitation(current.fields["id"], text2num(href_list["cdataid"]), pay)
to_chat(M, "<span class='notice'>You have paid [pay] credit\s towards your fine.</span>")
if (pay == diff || pay > diff || pay >= diff)
investigate_log("Citation Paid off: <strong>[p.crimeName]</strong> Fine: [p.fine] | Paid off by [key_name(usr)]", INVESTIGATE_RECORDS)
to_chat(M, "<span class='notice'>The fine has been paid in full.</span>")
qdel(C)
playsound(src, "terminal_type", 25, FALSE)
else
to_chat(M, "<span class='warning'>Fines can only be paid with holochips!</span>")
updateUsrDialog()
add_fingerprint(M)
Loading

0 comments on commit 995316e

Please sign in to comment.