Idris Ordering Terminals (#11952)

This commit is contained in:
Casper3667
2021-05-31 12:44:50 +02:00
committed by GitHub
parent eff4e8cb92
commit e16b11bf4a
8 changed files with 315 additions and 41 deletions
+1
View File
@@ -1649,6 +1649,7 @@
#include "code\modules\economy\EFTPOS.dm"
#include "code\modules\economy\Events.dm"
#include "code\modules\economy\Events_Mundane.dm"
#include "code\modules\economy\OrderTerminal.dm"
#include "code\modules\economy\quikpay.dm"
#include "code\modules\economy\TradeDestinations.dm"
#include "code\modules\effects\effect_system.dm"
+206
View File
@@ -0,0 +1,206 @@
/obj/machinery/orderterminal
name = "Idris Ordering Terminal"
desc = "An ordering terminal designed by Idris for quicker expedition."
icon = 'icons/obj/terminals.dmi'
icon_state = "kitchenterminal"
anchored = 1
use_power = 1
idle_power_usage = 10
var/machine_id = ""
var/list/items = list()
var/list/buying = list()
var/sum = 0
var/editmode = FALSE // Permits the menu to be changed
var/unlocking = FALSE // Checks if the machine is waiting for an id to unlock it
var/confirmorder = FALSE // Waits for an id to confirm an order
var/receipt = ""
var/ticket = ""
var/destinationact = "Civilian"
var/ticket_number = 1
req_one_access = list(access_bar, access_kitchen) // Access to change the menu
/obj/machinery/orderterminal/Initialize()
. = ..()
machine_id = "Idris Ordering Terminal #[SSeconomy.num_financial_terminals++]"
update_icon()
/obj/machinery/orderterminal/power_change()
..()
update_icon()
/obj/machinery/orderterminal/update_icon()
cut_overlays()
if(stat & NOPOWER)
set_light(FALSE)
return
var/mutable_appearance/screen_overlay = mutable_appearance(icon, "kitchenterminal-active", EFFECTS_ABOVE_LIGHTING_LAYER)
add_overlay(screen_overlay)
set_light(1.4, 1, COLOR_CYAN)
/obj/machinery/orderterminal/machinery_process()
if(stat & NOPOWER)
cut_overlays()
set_light(FALSE)
return
/obj/machinery/orderterminal/attack_hand(var/mob/user)
ui_interact(user)
/obj/machinery/orderterminal/ui_interact(mob/user)
var/datum/vueui/ui = SSvueui.get_open_ui(usr, src)
if (!ui)
ui = new(usr, src, "machinery-orderterminal-ordering", 450, 450, "Idris Ordering Terminal")
ui.open()
/obj/machinery/orderterminal/proc/print_receipt() // Print the receipt followed by the order ticket
var/obj/item/paper/R = new(usr.loc)
var/receiptname = "Receipt: [machine_id]"
R.set_content_unsafe(receiptname, receipt, sum)
stamp_receipt(R)
// And now we do it but for the ticket.
var/obj/item/paper/T = new(usr.loc)
var/tickettname = "Order ticket: [ticket_number]"
ticket_number++
T.set_content_unsafe(tickettname, ticket, sum)
stamp_receipt(T)
flick("kitchenterminal-receipt",src)
/obj/machinery/orderterminal/proc/stamp_receipt(obj/item/paper/R) // Stamps the papers, made into a proc to avoid copy pasting too much
var/image/stampoverlay = image('icons/obj/bureaucracy.dmi')
stampoverlay.icon_state = "paper_stamp-cent"
if(!R.stamped)
R.stamped = new
R.stamped += /obj/item/stamp
R.add_overlay(stampoverlay)
R.stamps += "<HR><i>This paper has been stamped by the Idris Ordering Terminal.</i>"
/obj/machinery/orderterminal/attackby(obj/O, mob/user)
var/obj/item/card/id/I = O.GetID()
if (!I)
return
if (!istype(O))
return
if(unlocking)
if(check_access(I))
to_chat(user, SPAN_NOTICE("You unlock \the [src]. Please return to the home screen."))
editmode = TRUE
unlocking = FALSE
else
to_chat(user, SPAN_WARNING("Access denied."))
else if (confirmorder)
var/transaction_amount = sum
var/transaction_purpose = "Idris Ordering Terminal order."
var/transaction_terminal = machine_id
if(sum > 0) // it will just get denied if the order is 0 credits. We still need the id regardless for the name
var/transaction = SSeconomy.transfer_money(I.associated_account_number, SSeconomy.get_department_account(destinationact)?.account_number,transaction_purpose,transaction_terminal,transaction_amount,null,usr)
if(transaction)
to_chat(user,"[icon2html(src, user)]<span class='warning'>[transaction].</span>")
else
playsound(src, 'sound/machines/chime.ogg', 50, 1)
src.visible_message("[icon2html(src, viewers(get_turf(src)))] \The [src] chimes.")
ticket += "<br><b>Customer:</b> [I.registered_name]"
receipt += "<br><b>Customer:</b> [I.registered_name]"
print_receipt()
sum = 0
receipt = ""
ticket = ""
to_chat(src.loc, SPAN_NOTICE("Transaction completed, please return to the home screen."))
// VUEUI below
/obj/machinery/orderterminal/vueui_data_change(var/list/data, var/mob/user, var/datum/vueui/ui)
if(!data)
. = data = list()
VUEUI_SET_CHECK_IFNOTSET(data["items"], items, ., data) // List of items that is on the menu
VUEUI_SET_CHECK_IFNOTSET(data["price"], items, ., data) // the price of said items
VUEUI_SET_CHECK_IFNOTSET(data["buying"], buying, ., data) // And the list with items the customer is buying
VUEUI_SET_CHECK_IFNOTSET(data["sum"], sum, ., data)
VUEUI_SET_CHECK_IFNOTSET(data["tmp_name"], "", ., data)
VUEUI_SET_CHECK_IFNOTSET(data["tmp_price"], 0, ., data)
VUEUI_SET_CHECK(data["tmp_price"], max(0, data["tmp_price"]), ., data)
if(data["tmp_price"] < 0)
data["tmp_price"] = 0
. = data
VUEUI_SET_CHECK(data["editmode"], editmode, ., data)
VUEUI_SET_CHECK(data["destinationact"], destinationact, ., data)
/obj/machinery/orderterminal/Topic(href, href_list)
var/datum/vueui/ui = href_list["vueui"]
if(!istype(ui))
return
if(href_list["add"])
if(!editmode)
to_chat(src, SPAN_NOTICE("You don't have access to use this option."))
return 0
items[href_list["add"]["name"]] = href_list["add"]["price"]
ui.data["items"][href_list["add"]["name"]] = href_list["add"]["price"]
. = TRUE
if(href_list["remove"])
if(!editmode)
to_chat(src, SPAN_NOTICE("You don't have access to use this option."))
return 0
items -= href_list["remove"]
ui.data["items"] -= href_list["remove"]
. = TRUE
if(href_list["buy"])
ui.data["buying"][href_list["buy"]["name"]] += href_list["buy"]["amount"]
. = TRUE
if(href_list["removal"])
ui.data["buying"][href_list["removal"]["name"]] -= href_list["removal"]["amount"]
. = TRUE
if(href_list["clear"])
var/buying = ui.data["buying"]
for(var/name in buying)
if(buying[name])
buying[name] = 0
. = TRUE
if(href_list["confirm"])
confirmorder = TRUE
var/buying = ui.data["buying"]
var/items = ui.data["items"]
receipt += "<center><font size=\"4\"><b>Idris Food Terminal Receipt</b></font></br><img src = idrislogo.png></center><hr>"
ticket += "<center><font size=\"4\"><b>Idris Food Terminal Ticket</b></font></br><img src = idrislogo.png></center><hr>"
for(var/name in buying)
if(buying[name])
sum += items[name] * buying[name]
receipt += "<b>[name]</b>: [buying[name]] x [items[name]]c: [items[name] * buying[name]]c<br>"
ticket += "<b>[name]</b>: [buying[name]]<br>"
receipt += "<hr><b>Total:</b> [sum]c"
ticket += "<hr><b>Total:</b> [sum]c"
ui.data["sum"] = sum
ui.activeui = "machinery-orderterminal-orderconfirmation"
. = TRUE
if(href_list["return"])
sum = 0
receipt = ""
ticket = ""
unlocking = FALSE
confirmorder = FALSE
ui.activeui = "machinery-orderterminal-ordering"
. = TRUE
if(href_list["locking"])
if(editmode)
editmode = FALSE
to_chat(src, SPAN_NOTICE("Device Locked."))
SSvueui.check_uis_for_change(src)
return 0
if(!editmode)
unlocking = TRUE
ui.activeui = "machinery-orderterminal-editconfirmation"
. = TRUE
. = TRUE
SSvueui.check_uis_for_change(src)
+7
View File
@@ -0,0 +1,7 @@
author: TheGreyWolf & SomeoneRandom
delete-after: True
changes:
- rscadd: "Added the Idris Ordering Terminal & mapped it in by the kitchen & bar."
- maptweak: "The bar APC has been moved over to above the disposals & the kitchen atm has been shifted to make space for the Idris Ordering Terminal."
Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 19 KiB

+27 -41
View File
@@ -49532,8 +49532,9 @@
/turf/simulated/floor/tiled,
/area/hallway/primary/aft)
"bNy" = (
/obj/machinery/status_display{
pixel_x = 32
/obj/machinery/atm{
pixel_x = 32;
pixel_y = -3
},
/turf/simulated/floor/tiled,
/area/hallway/primary/aft)
@@ -50052,9 +50053,8 @@
/area/library)
"bOP" = (
/obj/effect/floor_decal/corner/red/diagonal,
/obj/machinery/atm{
pixel_x = -2;
pixel_y = 28
/obj/machinery/orderterminal{
pixel_y = 32
},
/turf/simulated/floor/tiled/white,
/area/hallway/primary/aft)
@@ -51190,12 +51190,10 @@
/obj/machinery/door/firedoor{
dir = 8
},
/obj/structure/noticeboard{
desc = "A board for displaying menus.";
name = "Menu Board";
pixel_y = -25
},
/obj/item/glass_jar,
/obj/machinery/status_display{
pixel_y = -32
},
/turf/simulated/floor/tiled/white,
/area/crew_quarters/kitchen)
"bSn" = (
@@ -52472,14 +52470,8 @@
/obj/effect/floor_decal/spline/fancy/wood{
dir = 1
},
/obj/structure/cable/green{
d2 = 2;
icon_state = "0-2"
},
/obj/machinery/power/apc{
dir = 1;
name = "north bump";
pixel_y = 24
/obj/machinery/orderterminal{
pixel_y = 32
},
/turf/simulated/floor/wood,
/area/crew_quarters/bar)
@@ -52829,12 +52821,25 @@
/turf/simulated/floor/wood,
/area/crew_quarters/bar)
"bVZ" = (
/obj/structure/disposalpipe/segment,
/obj/machinery/atmospherics/pipe/simple/hidden/scrubbers,
/obj/machinery/atmospherics/pipe/simple/hidden/supply,
/obj/effect/floor_decal/corner/grey/diagonal,
/obj/structure/cable/green{
d1 = 1;
d2 = 2;
icon_state = "1-2"
},
/turf/simulated/floor/wood,
/obj/machinery/power/apc{
dir = 8;
name = "west bump";
pixel_x = -24
},
/obj/structure/cable/green{
d2 = 2;
icon_state = "0-2"
},
/turf/simulated/floor/tiled/white,
/area/crew_quarters/bar)
"bWa" = (
/turf/simulated/floor/wood,
@@ -52927,25 +52932,6 @@
/obj/machinery/atmospherics/pipe/manifold/hidden/supply,
/turf/simulated/floor/wood,
/area/crew_quarters/bar)
"bWn" = (
/obj/structure/cable/green{
d1 = 1;
d2 = 8;
icon_state = "1-8"
},
/obj/machinery/atmospherics/pipe/simple/hidden/supply{
dir = 4
},
/obj/machinery/atmospherics/pipe/simple/hidden/scrubbers{
dir = 4
},
/obj/structure/cable/green{
d1 = 4;
d2 = 8;
icon_state = "4-8"
},
/turf/simulated/floor/wood,
/area/crew_quarters/bar)
"bWo" = (
/obj/machinery/atmospherics/pipe/simple/hidden/supply{
dir = 4
@@ -101062,8 +101048,8 @@ bUW
bSM
bSM
bVf
bVZ
bWn
bWa
bWo
bZs
dMw
dWO
@@ -104144,7 +104130,7 @@ bkY
bTz
bUg
bUI
bUI
bVZ
bVC
bTz
bWr
@@ -0,0 +1,15 @@
<template>
<div>
<h3> Activating Configuration Mode</h3>
<span> Swipe id card to enter configuration mode.<br></span>
<vui-button :params="{ return: 1 }" width="3em">Return to order menu</vui-button>
</div>
</template>
<script>
export default {
data() {
return this.$root.$data.state;
}
}
</script>
@@ -0,0 +1,21 @@
<template>
<div>
<h3> Selected Products:</h3>
<div v-for="(price, name) in items" :key="name">
<span v-if="buying[name] && buying[name] >= 0">
{{buying[name] }}x {{ name }}: at {{ price * buying[name] }} Credits
</span>
</div>
<h3> Total: {{ sum }}</h3>
<h3>Please swipe your ID to pay.</h3>
<vui-button :params="{ return: 1 }" width="3em">Return to order menu</vui-button>
</div>
</template>
<script>
export default {
data() {
return this.$root.$data.state;
},
};
</script>
@@ -0,0 +1,38 @@
<template>
<div>
<div v-for="(price, name) in items" :key="name" style="clear: both;">
{{ name }}: {{ price }} Credits
<div style="float: right;">
<vui-button :params="{ buy: {name: name, price: price, amount: 1 } }" width="2em">Buy</vui-button>
<vui-button v-if="editmode == 1" :params="{ remove: name }" width="3em">Delete</vui-button>
</div>
</div>
<div v-if="editmode == 1">
<input v-model="tmp_name">
<vui-input-numeric v-model="tmp_price" width="3em" :button-count="2"/>
<vui-button :params="{ add: {name: tmp_name, price: tmp_price }}">Add</vui-button>
</div>
<vui-button :params="{ locking: 1 }" width="3em">Toggle Lock</vui-button>
<vui-button :params="{ confirm: buying }">Confirm Selection</vui-button>
<vui-button :params="{ clear: 1 }">Clear selection</vui-button>
<h4> Selected Products:</h4>
<div v-for="(price, name) in buying" :key="name" style="clear: both;">
<span v-if="buying[name] && buying[name] >= 0">
{{buying[name] }}x {{ name }}: at {{ price * items[name] }} Credits
<div style="float: right;">
<vui-button :params="{ removal: {name: name, price: price, amount: 1 }}" width="2em">Remove</vui-button>
</div>
</span>
</div>
</div>
</template>
<script>
export default {
data() {
return this.$root.$data.state;
}
}
</script>