mirror of
https://github.com/vgstation-coders/vgstation13.git
synced 2025-12-10 18:32:03 +00:00
Merch store is in and working.
This commit is contained in:
@@ -343,6 +343,7 @@
|
||||
#include "code\game\machinery\computer\shuttle.dm"
|
||||
#include "code\game\machinery\computer\specops_shuttle.dm"
|
||||
#include "code\game\machinery\computer\station_alert.dm"
|
||||
#include "code\game\machinery\computer\store.dm"
|
||||
#include "code\game\machinery\computer\syndicate_shuttle.dm"
|
||||
#include "code\game\machinery\computer\syndicate_specops_shuttle.dm"
|
||||
#include "code\game\machinery\doors\airlock.dm"
|
||||
@@ -758,6 +759,7 @@
|
||||
#include "code\modules\clothing\under\jobs\security.dm"
|
||||
#include "code\modules\customitems\item_spawning.dm"
|
||||
#include "code\modules\customitems\definitions\base.dm"
|
||||
#include "code\modules\customitems\definitions\N3X15.dm"
|
||||
#include "code\modules\DetectiveWork\detective_scanner.dm"
|
||||
#include "code\modules\DetectiveWork\detective_work.dm"
|
||||
#include "code\modules\DetectiveWork\evidence.dm"
|
||||
@@ -1246,6 +1248,8 @@
|
||||
#include "code\modules\scripting\Scanner\Tokens.dm"
|
||||
#include "code\modules\security levels\keycard authentication.dm"
|
||||
#include "code\modules\security levels\security levels.dm"
|
||||
#include "code\modules\store\items.dm"
|
||||
#include "code\modules\store\store.dm"
|
||||
#include "code\modules\surgery\appendix.dm"
|
||||
#include "code\modules\surgery\bones.dm"
|
||||
#include "code\modules\surgery\braincore.dm"
|
||||
|
||||
@@ -347,7 +347,8 @@ var/global/datum/controller/occupations/job_master
|
||||
|
||||
//give them an account in the station database
|
||||
if(centcomm_account_db)
|
||||
var/datum/money_account/M = create_account(H.real_name, rand(50,500)*10, null)
|
||||
var/balance = round(rand(1,5))*100 // Between $100 and $500
|
||||
var/datum/money_account/M = create_account(H.real_name, balance , null)
|
||||
if(H.mind)
|
||||
var/remembered_info = ""
|
||||
remembered_info += "<b>Your account number is:</b> #[M.account_number]<br>"
|
||||
|
||||
153
code/game/machinery/computer/store.dm
Normal file
153
code/game/machinery/computer/store.dm
Normal file
@@ -0,0 +1,153 @@
|
||||
/obj/machinery/computer/merch
|
||||
name = "Merch Computer"
|
||||
icon = 'icons/obj/computer.dmi'
|
||||
icon_state = "comm_logs"
|
||||
circuit = "/obj/item/weapon/circuitboard/merch"
|
||||
|
||||
/obj/machinery/computer/merch/New()
|
||||
..()
|
||||
|
||||
/obj/machinery/computer/merch/attack_paw(mob/user as mob)
|
||||
return attack_hand(user)
|
||||
|
||||
/obj/machinery/computer/merch/attack_ai(mob/user as mob)
|
||||
src.add_hiddenprint(user)
|
||||
return attack_hand(user)
|
||||
|
||||
/obj/machinery/computer/merch/attack_hand(mob/user as mob)
|
||||
user.set_machine(src)
|
||||
add_fingerprint(user)
|
||||
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
|
||||
var/balance=user.mind.initial_account.money
|
||||
|
||||
var/dat = {"
|
||||
<html>
|
||||
<head>
|
||||
<title>[command_name()] Merchandise</title>
|
||||
<style type="text/css">
|
||||
* {
|
||||
font-family:sans-serif;
|
||||
font-size:x-small;
|
||||
}
|
||||
html {
|
||||
background:#333;
|
||||
color:#999;
|
||||
}
|
||||
|
||||
a {
|
||||
color:#cfcfcf;
|
||||
text-decoration:none;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
a:hover {
|
||||
color:#ffffff;
|
||||
}
|
||||
tr {
|
||||
background:#303030;
|
||||
border-radius:6px;
|
||||
margin-bottom:0.5em;
|
||||
border-bottom:1px solid black;
|
||||
}
|
||||
tr:nth-child(even) {
|
||||
background:#3f3f3f;
|
||||
}
|
||||
|
||||
td.cost {
|
||||
font-size:20pt;
|
||||
font-weight:bold;
|
||||
}
|
||||
|
||||
td.cost.affordable {
|
||||
background:green;
|
||||
}
|
||||
|
||||
td.cost.toomuch {
|
||||
background:maroon;
|
||||
}
|
||||
|
||||
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<p style="float:right"><a href='byond://?src=\ref[src];refresh=1'>Refresh</a> | <b>Balance:</b> $[balance]</p>
|
||||
<h1>[command_name()] Merchandise</h1>
|
||||
<p>
|
||||
<b>Doing your job and not getting any recognition at work?</b> Well, welcome to the
|
||||
merch shop! Here, you can buy cool things in exchange for money you earn when you've
|
||||
completed your Job Objectives.
|
||||
</p>
|
||||
<p>Work hard. Get cash. Acquire bragging rights.</p>
|
||||
<h2>In Stock:</h2>
|
||||
<table cellspacing="0" cellpadding="0">
|
||||
<thead>
|
||||
<th>#</th>
|
||||
<th>Name/Description</th>
|
||||
<th>Price</th>
|
||||
</thead>
|
||||
<tbody>
|
||||
"}
|
||||
for(var/datum/storeitem/item in centcomm_store.items)
|
||||
var/cost_class="affordable"
|
||||
if(item.cost>balance)
|
||||
cost_class="toomuch"
|
||||
var/itemID=centcomm_store.items.Find(item)
|
||||
dat += {"
|
||||
<tr>
|
||||
<th>
|
||||
[itemID]
|
||||
</th>
|
||||
<td>
|
||||
<p><b>[item.name]</b></p>
|
||||
<p>[item.desc]</p>
|
||||
</td>
|
||||
<td class="cost [cost_class]">
|
||||
<a href="byond://?src=\ref[src];buy=[itemID]">$[item.cost]</a>
|
||||
</td>
|
||||
</tr>
|
||||
"}
|
||||
dat += {"
|
||||
</tbody>
|
||||
</table>
|
||||
</body>
|
||||
</html>"}
|
||||
user << browse(dat, "window=merch")
|
||||
onclose(user, "merch")
|
||||
return
|
||||
|
||||
/obj/machinery/computer/merch/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
|
||||
//testing(href)
|
||||
|
||||
src.add_fingerprint(usr)
|
||||
|
||||
if (href_list["buy"])
|
||||
var/itemID = text2num(href_list["buy"])
|
||||
var/datum/storeitem/item = centcomm_store.items[itemID]
|
||||
var/sure = alert(usr,"Are you sure you wish to purchase [item.name] for $[item.cost]?","You sure?","Yes","No") in list("Yes","No")
|
||||
if(sure=="No")
|
||||
updateUsrDialog()
|
||||
return
|
||||
if(!centcomm_store.PlaceOrder(usr,itemID))
|
||||
usr << "\red Unable to charge your account."
|
||||
else
|
||||
usr << "\blue You've successfully purchased the item. It should be in your hands or on the floor."
|
||||
src.updateUsrDialog()
|
||||
return
|
||||
|
||||
/obj/machinery/computer/cloning/update_icon()
|
||||
|
||||
if(stat & BROKEN)
|
||||
icon_state = "comm_logs0"
|
||||
else
|
||||
if(stat & NOPOWER)
|
||||
src.icon_state = "comm_logs"
|
||||
stat |= NOPOWER
|
||||
else
|
||||
icon_state = initial(icon_state)
|
||||
stat &= ~NOPOWER
|
||||
@@ -111,7 +111,7 @@
|
||||
item_state = "reactiveoff"
|
||||
blood_overlay_type = "armor"
|
||||
slowdown = 1
|
||||
flags = FPRINT | TABLEPASS
|
||||
flags = FPRINT | TABLEPASS | ONESIZEFITSALL
|
||||
armor = list(melee = 0, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0)
|
||||
|
||||
/obj/item/clothing/suit/armor/reactive/IsShield()
|
||||
|
||||
@@ -1,13 +1,25 @@
|
||||
/obj/item/clothing/suit/storage/labcoat
|
||||
name = "labcoat"
|
||||
desc = "A suit that protects against minor chemical spills."
|
||||
icon_state = "labcoat_open"
|
||||
var/base_icon_state = "labcoat"
|
||||
var/open=1
|
||||
//icon_state = "labcoat_open"
|
||||
item_state = "labcoat"
|
||||
blood_overlay_type = "coat"
|
||||
body_parts_covered = UPPER_TORSO|LOWER_TORSO|ARMS
|
||||
allowed = list(/obj/item/device/analyzer,/obj/item/stack/medical,/obj/item/weapon/dnainjector,/obj/item/weapon/reagent_containers/dropper,/obj/item/weapon/reagent_containers/syringe,/obj/item/weapon/reagent_containers/hypospray,/obj/item/device/healthanalyzer,/obj/item/device/flashlight/pen)
|
||||
armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 50, rad = 0)
|
||||
|
||||
New()
|
||||
..()
|
||||
update_icon()
|
||||
|
||||
update_icon()
|
||||
if(open)
|
||||
icon_state="[base_icon_state]_open"
|
||||
else
|
||||
icon_state="[base_icon_state]"
|
||||
|
||||
verb/toggle()
|
||||
set name = "Toggle Labcoat Buttons"
|
||||
set category = "Object"
|
||||
@@ -16,83 +28,43 @@
|
||||
if(!usr.canmove || usr.stat || usr.restrained())
|
||||
return 0
|
||||
|
||||
switch(icon_state)
|
||||
if("labcoat_open")
|
||||
src.icon_state = "labcoat"
|
||||
usr << "You button up the labcoat."
|
||||
if("labcoat")
|
||||
src.icon_state = "labcoat_open"
|
||||
usr << "You unbutton the labcoat."
|
||||
if("labcoat_cmo_open")
|
||||
src.icon_state = "labcoat_cmo"
|
||||
usr << "You button up the labcoat."
|
||||
if("labcoat_cmo")
|
||||
src.icon_state = "labcoat_cmo_open"
|
||||
usr << "You unbutton the labcoat."
|
||||
if("labcoat_gen_open")
|
||||
src.icon_state = "labcoat_gen"
|
||||
usr << "You button up the labcoat."
|
||||
if("labcoat_gen")
|
||||
src.icon_state = "labcoat_gen_open"
|
||||
usr << "You unbutton the labcoat."
|
||||
if("labcoat_chem_open")
|
||||
src.icon_state = "labcoat_chem"
|
||||
usr << "You button up the labcoat."
|
||||
if("labcoat_chem")
|
||||
src.icon_state = "labcoat_chem_open"
|
||||
usr << "You unbutton the labcoat."
|
||||
if("labcoat_vir_open")
|
||||
src.icon_state = "labcoat_vir"
|
||||
usr << "You button up the labcoat."
|
||||
if("labcoat_vir")
|
||||
src.icon_state = "labcoat_vir_open"
|
||||
usr << "You unbutton the labcoat."
|
||||
if("labcoat_tox_open")
|
||||
src.icon_state = "labcoat_tox"
|
||||
usr << "You button up the labcoat."
|
||||
if("labcoat_tox")
|
||||
src.icon_state = "labcoat_tox_open"
|
||||
usr << "You unbutton the labcoat."
|
||||
if("labgreen_open")
|
||||
src.icon_state = "labgreen"
|
||||
usr << "You button up the labcoat."
|
||||
if("labgreen")
|
||||
src.icon_state = "labgreen_open"
|
||||
usr << "You unbutton the labcoat."
|
||||
else
|
||||
usr << "You attempt to button-up the velcro on your [src], before promptly realising how retarded you are."
|
||||
return
|
||||
if(open)
|
||||
usr << "You button up the labcoat."
|
||||
else
|
||||
usr << "You unbutton the labcoat."
|
||||
open=!open
|
||||
update_icon()
|
||||
usr.update_inv_wear_suit() //so our overlays update
|
||||
|
||||
/obj/item/clothing/suit/storage/labcoat/cmo
|
||||
name = "chief medical officer's labcoat"
|
||||
desc = "Bluer than the standard model."
|
||||
icon_state = "labcoat_cmo_open"
|
||||
base_icon_state = "labcoat_cmo"
|
||||
item_state = "labcoat_cmo"
|
||||
|
||||
/obj/item/clothing/suit/storage/labcoat/mad
|
||||
name = "The Mad's labcoat"
|
||||
desc = "It makes you look capable of konking someone on the noggin and shooting them into space."
|
||||
icon_state = "labgreen_open"
|
||||
base_icon_state = "labgreen"
|
||||
item_state = "labgreen"
|
||||
|
||||
/obj/item/clothing/suit/storage/labcoat/genetics
|
||||
name = "Geneticist Labcoat"
|
||||
desc = "A suit that protects against minor chemical spills. Has a blue stripe on the shoulder."
|
||||
icon_state = "labcoat_gen_open"
|
||||
base_icon_state = "labcoat_gen"
|
||||
|
||||
/obj/item/clothing/suit/storage/labcoat/chemist
|
||||
name = "Chemist Labcoat"
|
||||
desc = "A suit that protects against minor chemical spills. Has an orange stripe on the shoulder."
|
||||
icon_state = "labcoat_chem_open"
|
||||
base_icon_state = "labcoat_chem"
|
||||
|
||||
/obj/item/clothing/suit/storage/labcoat/virologist
|
||||
name = "Virologist Labcoat"
|
||||
desc = "A suit that protects against minor chemical spills. Offers slightly more protection against biohazards than the standard model. Has a green stripe on the shoulder."
|
||||
icon_state = "labcoat_vir_open"
|
||||
base_icon_state = "labcoat_vir"
|
||||
armor = list(melee = 0, bullet = 0, laser = 0,energy = 0, bomb = 0, bio = 60, rad = 0)
|
||||
|
||||
/obj/item/clothing/suit/storage/labcoat/science
|
||||
name = "Scientist Labcoat"
|
||||
desc = "A suit that protects against minor chemical spills. Has a purple stripe on the shoulder."
|
||||
icon_state = "labcoat_tox_open"
|
||||
base_icon_state = "labcoat_tox"
|
||||
|
||||
@@ -88,7 +88,7 @@
|
||||
desc = "This robe commands authority."
|
||||
icon_state = "judge"
|
||||
item_state = "judge"
|
||||
flags = FPRINT | TABLEPASS
|
||||
flags = FPRINT | TABLEPASS | ONESIZEFITSALL
|
||||
body_parts_covered = UPPER_TORSO|LOWER_TORSO|LEGS|ARMS
|
||||
allowed = list(/obj/item/weapon/storage/fancy/cigarettes,/obj/item/weapon/spacecash)
|
||||
flags_inv = HIDEJUMPSUIT
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
allowed = list(/obj/item/device/flashlight,/obj/item/weapon/tank/emergency_oxygen,/obj/item/weapon/extinguisher)
|
||||
slowdown = 1.0
|
||||
flags_inv = HIDEGLOVES|HIDESHOES|HIDEJUMPSUIT
|
||||
flags = FPRINT | TABLEPASS | STOPSPRESSUREDMAGE
|
||||
flags = FPRINT | TABLEPASS | ONESIZEFITSALL | STOPSPRESSUREDMAGE
|
||||
heat_protection = UPPER_TORSO|LOWER_TORSO|LEGS|FEET|ARMS|HANDS
|
||||
max_heat_protection_temperature = FIRESUIT_MAX_HEAT_PROTECITON_TEMPERATURE
|
||||
cold_protection = UPPER_TORSO | LOWER_TORSO | LEGS | FEET | ARMS | HANDS
|
||||
|
||||
@@ -2,6 +2,7 @@
|
||||
* N3X15's Testing Shit
|
||||
*
|
||||
* Used to test this on /fail/station. Not used, so left out. A decent example though.
|
||||
* Added back in for the store
|
||||
*/
|
||||
|
||||
/obj/item/clothing/suit/storage/labcoat/custom/N3X15
|
||||
@@ -24,4 +25,4 @@
|
||||
name = "roboticist's jumpsuit"
|
||||
icon_state = "robotics"
|
||||
item_state = "robotics"
|
||||
color = "robotics"
|
||||
_color = "robotics"
|
||||
24
code/modules/store/items.dm
Normal file
24
code/modules/store/items.dm
Normal file
@@ -0,0 +1,24 @@
|
||||
/////////////////////////////
|
||||
// Store Item
|
||||
/////////////////////////////
|
||||
/datum/storeitem
|
||||
var/name="Thing"
|
||||
var/desc="It's a thing."
|
||||
var/typepath=/obj/item/weapon/storage/box
|
||||
var/cost=0
|
||||
|
||||
|
||||
/////////////////////////////
|
||||
// Shit for robotics
|
||||
/////////////////////////////
|
||||
/datum/storeitem/robotnik_labcoat
|
||||
name = "Robotnik's Research Labcoat"
|
||||
desc = "Join the empire and display your hatred for woodland animals."
|
||||
typepath = /obj/item/clothing/suit/storage/labcoat/custom/N3X15/robotics
|
||||
cost = 500
|
||||
|
||||
/datum/storeitem/robotik_jumpsuit
|
||||
name = "Robotics Interface Suit"
|
||||
desc = "A modern black and red design with reinforced seams and brass neural interface fittings."
|
||||
typepath = /obj/item/clothing/under/custom/N3X15/robotics
|
||||
cost = 350
|
||||
67
code/modules/store/store.dm
Normal file
67
code/modules/store/store.dm
Normal file
@@ -0,0 +1,67 @@
|
||||
/*****************************
|
||||
* /vg/station In-Game Store *
|
||||
*****************************
|
||||
|
||||
By Nexypoo
|
||||
|
||||
The idea is to give people who do their jobs a reward.
|
||||
|
||||
Ideally, these items should be cosmetic in nature to avoid fucking up round balance.
|
||||
People joining the round get between $100 and $500. Keep this in mind.
|
||||
|
||||
Money should not persist between rounds, although a "bank" system to voluntarily store
|
||||
money between rounds might be cool. It'd need to be a bit volatile: perhaps completing
|
||||
job objectives = good stock market, shitty job objective completion = shitty economy.
|
||||
|
||||
Goal for now is to get the store itself working, however.
|
||||
*/
|
||||
|
||||
var/global/datum/store/centcomm_store=new
|
||||
|
||||
/datum/store
|
||||
var/list/datum/storeitem/items=list()
|
||||
var/list/datum/storeorder/orders=list()
|
||||
|
||||
var/obj/machinery/account_database/linked_db
|
||||
|
||||
/datum/store/New()
|
||||
for(var/itempath in typesof(/datum/storeitem) - /datum/storeitem/)
|
||||
items += new itempath()
|
||||
|
||||
/datum/store/proc/charge(var/datum/mind/mind,var/amount,var/datum/storeitem/item)
|
||||
if(!mind.initial_account)
|
||||
//testing("No initial_account")
|
||||
return 0
|
||||
if(mind.initial_account.money < amount)
|
||||
//testing("Not enough cash")
|
||||
return 0
|
||||
mind.initial_account.money -= amount
|
||||
var/datum/transaction/T = new()
|
||||
T.target_name = "[command_name()] Merchandising"
|
||||
T.purpose = "Purchase of [item.name]"
|
||||
T.amount = -amount
|
||||
T.date = current_date_string
|
||||
T.time = worldtime2text()
|
||||
T.source_terminal = "\[CLASSIFIED\] Terminal #[rand(111,333)]"
|
||||
mind.initial_account.transaction_log.Add(T)
|
||||
return 1
|
||||
|
||||
/datum/store/proc/reconnect_database()
|
||||
for(var/obj/machinery/account_database/DB in world)
|
||||
if(DB.z == 1)
|
||||
linked_db = DB
|
||||
break
|
||||
|
||||
/datum/store/proc/PlaceOrder(var/mob/living/usr, var/itemID)
|
||||
// Get our item, first.
|
||||
var/datum/storeitem/item = items[itemID]
|
||||
if(!item)
|
||||
return 0
|
||||
// Try to deduct funds.
|
||||
if(!charge(usr.mind,item.cost,item))
|
||||
return 0
|
||||
// Give them the item.
|
||||
var/obj/item/weapon/storage/box/box=new(usr.loc)
|
||||
new item.typepath(box)
|
||||
usr.put_in_hands(box)
|
||||
return 1
|
||||
BIN
icons/mob/custom/N3X15/suits.dmi
Normal file
BIN
icons/mob/custom/N3X15/suits.dmi
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user