Economy part 1

Economy part 1
This commit is contained in:
QuoteFox
2021-01-25 10:47:15 +00:00
parent 128bbba467
commit ecf93da4b1
14 changed files with 221 additions and 4 deletions
+1
View File
@@ -64,6 +64,7 @@
#define INIT_ORDER_TICKER 9
#define INIT_ORDER_MAPPING 8
#define INIT_ORDER_NETWORKS 7
#define INIT_ORDER_ECONOMY 21
#define INIT_ORDER_ATOMS 6
#define INIT_ORDER_LANGUAGE 5
#define INIT_ORDER_MACHINES 4
+5
View File
@@ -442,6 +442,11 @@ SUBSYSTEM_DEF(job)
if(CONFIG_GET(number/minimal_access_threshold))
to_chat(M, "<span class='notice'><B>As this station was initially staffed with a [CONFIG_GET(flag/jobs_have_minimal_access) ? "full crew, only your job's necessities" : "skeleton crew, additional access may"] have been added to your ID card.</B></span>")
if(ishuman(H))
var/mob/living/carbon/human/wageslave = H
to_chat(M, "<b><span class = 'big'>Your account ID is [wageslave.account_id].</span></b>")
H.add_memory("Your account ID is [wageslave.account_id].")
if(job && H)
if(job.dresscodecompliant)// CIT CHANGE - dress code compliance
equip_loadout(N, H) // CIT CHANGE - allows players to spawn with loadout items
+1 -1
View File
@@ -170,7 +170,7 @@
var/registered_name = null // The name registered_name on the card
var/assignment = null
var/access_txt // mapping aid
var/datum/bank_account/registered_account
/obj/item/card/id/Initialize(mapload)
+1 -1
View File
@@ -19,7 +19,7 @@
/obj/item/stack/spacecash/proc/update_desc()
var/total_worth = amount*value
desc = "It's worth [total_worth] credit[( total_worth > 1 ) ? "s" : ""]"
desc = "A outdated form of currency, It's worth [total_worth] credit[( total_worth > 1 ) ? "s" : ""]"
/obj/item/stack/spacecash/merge(obj/item/stack/S)
+15 -1
View File
@@ -58,7 +58,7 @@
var/list/mind_traits // Traits added to the mind of the mob assigned this job
var/list/blacklisted_quirks //list of quirk typepaths blacklisted.
var/list/alt_titles = list()
//Only override this proc
@@ -90,6 +90,13 @@
if(!H)
return FALSE
if(!visualsOnly)
var/datum/bank_account/bank_account = new(H.real_name, src)
bank_account.account_holder = H.real_name
bank_account.account_job = src
bank_account.account_id = rand(111111,999999)
H.account_id = bank_account.account_id
if(CONFIG_GET(flag/enforce_human_authority) && (title in GLOB.command_positions))
if(H.dna.species.id != "human")
H.set_species(/datum/species/human)
@@ -230,6 +237,13 @@
C.update_label(C.registered_name, preference_source.prefs.alt_titles_preferences[J.title])
else
C.update_label()
for(var/A in SSeconomy.bank_accounts)
var/datum/bank_account/B = A
if(B.account_id == H.account_id)
C.registered_account = B
B.bank_cards += C
break
H.sec_hud_set_ID()
var/obj/item/pda/PDA = H.get_item_by_slot(pda_slot)
@@ -68,5 +68,5 @@
var/static/list/can_ride_typecache = typecacheof(list(/mob/living/carbon/human, /mob/living/simple_animal/slime, /mob/living/simple_animal/parrot))
var/lastpuke = 0
var/last_fire_update
var/account_id
can_be_held = "micro"
@@ -132,6 +132,7 @@
to_chat(src, "<span class='warning'>Use of ranged weaponry would bring dishonor to the clan.</span>")
return FALSE
/mob/living/carbon/human/can_see_reagents()
. = ..()
if(.) //No need to run through all of this if it's already true.
+35
View File
@@ -0,0 +1,35 @@
#define STARTING_PAYCHECKS 5
#define PAYCHECK_ASSISTANT 25
#define PAYCHECK_MINIMAL 75
#define PAYCHECK_EASY 125
#define PAYCHECK_MEDIUM 175
#define PAYCHECK_HARD 200
#define PAYCHECK_COMMAND 250
#define MAX_GRANT_CIV 2500
#define MAX_GRANT_ENG 3000
#define MAX_GRANT_SCI 5000
#define MAX_GRANT_SECMEDSRV 3000
#define ACCOUNT_CIV "CIV"
#define ACCOUNT_CIV_NAME "Civil Budget"
#define ACCOUNT_ENG "ENG"
#define ACCOUNT_ENG_NAME "Engineering Budget"
#define ACCOUNT_SCI "SCI"
#define ACCOUNT_SCI_NAME "Scientific Budget"
#define ACCOUNT_MED "MED"
#define ACCOUNT_MED_NAME "Medical Budget"
#define ACCOUNT_SRV "SRV"
#define ACCOUNT_SRV_NAME "Service Budget"
#define ACCOUNT_CAR "CAR"
#define ACCOUNT_CAR_NAME "Cargo Budget"
#define ACCOUNT_SEC "SEC"
#define ACCOUNT_SEC_NAME "Defense Budget"
#define NO_FREEBIES "commies go home"
//ID bank account support defines.
#define ID_NO_BANK_ACCOUNT 0
#define ID_FREE_BANK_ACCOUNT 1
#define ID_LOCKED_BANK_ACCOUNT 2
@@ -0,0 +1,16 @@
SUBSYSTEM_DEF(economy)
name = "Economy"
wait = 5 MINUTES
init_order = INIT_ORDER_ECONOMY
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/list/bank_accounts = list() //List of normal accounts (not department accounts)
@@ -0,0 +1,26 @@
#define DUMPTIME 3000
/datum/bank_account
var/account_holder = "Rusty Venture"
var/account_balance = 0
var/datum/job/account_job
var/list/bank_cards = list()
var/add_to_accounts = TRUE
var/transferable = TRUE
var/account_id
var/withdrawDelay = 0
/datum/bank_account/New(newname, job)
if(add_to_accounts)
if(!SSeconomy)
log_world("Wack")
SSeconomy.bank_accounts += src
account_holder = newname
account_job = job
account_id = rand(111111,999999)
/datum/bank_account/Destroy()
if(add_to_accounts)
SSeconomy.bank_accounts -= src
return ..()
+115
View File
@@ -0,0 +1,115 @@
//Hyper station economy. Because coding it yourself is easier than port sometimes.
/obj/machinery/atm
name = "automated teller machine"
desc = "a wall mounted electronic banking outlet for accessing your bank account."
icon = 'hyperstation/icons/obj/economy.dmi'
icon_state = "atm"
max_integrity = 250
integrity_failure = 100
armor = list("melee" = 0, "bullet" = 0, "laser" = 0, "energy" = 0, "bomb" = 0, "bio" = 100, "rad" = 100, "fire" = 90, "acid" = 30)
use_power = IDLE_POWER_USE
idle_power_usage = 0
active_power_usage = 0
power_channel = ENVIRON
resistance_flags = FIRE_PROOF
var/obj/item/card/held_card
var/user = ""
light_power = 0
light_range = 7
light_color = "#ff3232"
/obj/machinery/atm/ui_interact(mob/user)
. = ..()
var/dat = {""}
dat += "<body style='background-color:green;'><center>"
dat += "<p>"
dat += "<span class = 'big'><p>ATM</span></span></h1>"
dat += "<b><p>Welcome to Hyper Station 13's Automated Bank Teller Service.</b>"
dat += "<p>"
if(!held_card)
dat += "<p>Welcome, please insert your ID to continue."
else
dat += "<p>Welcome user, <a href='byond://?src=[REF(src)];card=1'>[held_card ? user : "------"]</a><br><br>"
var/obj/item/card/id/idcard = held_card
if(idcard.registered_account)
dat += "<p>Account ID: <b>([idcard.registered_account.account_id])</b>"
dat += "<p>Balance: <b>$[idcard.registered_account.account_balance]</b>"
dat += "<p>"
dat += "<a href='byond://?src=[REF(src)];withdraw=1'>Withdraw</A>"
dat += "<a href='byond://?src=[REF(src)];pin=1'>Change Pin</A>"
dat += "<a href='byond://?src=[REF(src)];settings=1'>Account Settings</A>"
dat += "<a href='byond://?src=[REF(src)];card=1'>Eject</A>"
else
dat += "<p>Error, You don't seem to have a bank account with us.</b>"
dat += "<p>"
dat += "<p>"
var/datum/browser/popup = new(user, "atm", "ATM")
popup.set_content(dat)
popup.set_title_image(user.browse_rsc_icon(icon, icon_state), 500,300)
popup.open()
/obj/machinery/atm/attackby(obj/item/I, mob/living/user)
if(istype(I, /obj/item/card))
if(!held_card)
var/obj/item/card/id/idcard = I
if(!user.transferItemToLoc(I, src)) //check if you can put it in
return
held_card = idcard
user = idcard.registered_name
playsound(src, 'sound/machines/terminal_insert_disc.ogg', 50, FALSE)
/obj/machinery/atm/Topic(href, href_list)
. = ..()
if(..())
return
if(href_list["card"])
if(held_card)
if(usr.CanReach(src))
if(usr.put_in_hands(held_card))
to_chat(usr, "<span class='notice'>You take the ID out of the slot.</span>")
held_card = null
user = ""
else
to_chat(usr, "<span class='warning'>The machine drops the ID onto the floor!</span>")
held_card = null
user = ""
if(href_list["withdraw"])
if(held_card)
var/obj/item/card/id/idcard = held_card
if(idcard.registered_account)
var/ammount = input(user, "Choose ammount", "Withdraw") as num|null
if(ammount)
ammount = max(min( round(text2num(ammount)), idcard.registered_account.account_balance),0)
src.ui_interact(usr)
//Money, Well, get back, I'm all right Jack, Keep your hands off of my stack.
//making our own currency, just to stop exploits (for now)
/obj/item/stack/credits
name = "credits"
singular_name = "credit"
icon = 'hyperstation/icons/obj/economy.dmi'
icon_state = "cash"
amount = 1
max_amount = 100
throwforce = 0
throw_speed = 2
throw_range = 2
w_class = WEIGHT_CLASS_TINY
full_w_class = WEIGHT_CLASS_TINY
resistance_flags = FLAMMABLE
var/value = 1
/obj/item/stack/spacecash/proc/update_desc()
var/total_worth = amount*value
desc = "Legal tender, It's worth [total_worth] credit[( total_worth > 1 ) ? "s" : ""]"
Binary file not shown.

After

Width:  |  Height:  |  Size: 780 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 945 B

+4
View File
@@ -3019,6 +3019,8 @@
#include "code\modules\VR\vr_sleeper.dm"
#include "code\modules\zombie\items.dm"
#include "code\modules\zombie\organs.dm"
#include "hyperstation\code\__DEFINES\economy.dm"
#include "hyperstation\code\controllers\subsystem\economy.dm"
#include "hyperstation\code\datums\elements\holder_micro.dm"
#include "hyperstation\code\datums\mood_events\events.dm"
#include "hyperstation\code\datums\ruins\lavaland.dm"
@@ -3050,6 +3052,7 @@
#include "hyperstation\code\modules\clothing\under\under.dm"
#include "hyperstation\code\modules\crafting\bounties.dm"
#include "hyperstation\code\modules\crafting\recipes.dm"
#include "hyperstation\code\modules\economy\account.dm"
#include "hyperstation\code\modules\integrated_electronics\input.dm"
#include "hyperstation\code\modules\mob\mob_helpers.dm"
#include "hyperstation\code\modules\patreon\patreon.dm"
@@ -3062,6 +3065,7 @@
#include "hyperstation\code\obj\bluespace sewing kit.dm"
#include "hyperstation\code\obj\condom.dm"
#include "hyperstation\code\obj\decal.dm"
#include "hyperstation\code\obj\economy.dm"
#include "hyperstation\code\obj\fluff.dm"
#include "hyperstation\code\obj\kinkyclothes.dm"
#include "hyperstation\code\obj\leash.dm"