You can now insert a coin into a vending machine. Some (currently only cigarette machine) have special items which you can only get to with a coin. No, hacking will not allow you to get to these items.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2209 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
baloh.matevz
2011-09-17 01:17:36 +00:00
parent bc1af5e099
commit 48e5403e72
4 changed files with 56 additions and 2 deletions
+6
View File
@@ -14,8 +14,11 @@
var/product_slogans = "" //String of slogans separated by semicolons, optional
var/product_hidden = "" //String of products that are hidden unless hacked.
var/product_hideamt = "" //String of hidden product amounts, separated by semicolons. Exact same as amounts. Must be left blank if hidden is.
var/product_coin = ""
var/product_coin_amt = ""
var/list/product_records = list()
var/list/hidden_records = list()
var/list/coin_records = list()
var/list/slogan_list = list()
var/vend_reply //Thank you for shopping!
var/last_reply = 0
@@ -30,6 +33,7 @@
var/extended_inventory = 0 //can we access the hidden inventory?
var/panel_open = 0 //Hacking that vending machine. Gonna get a free candy bar.
var/wires = 15
var/obj/item/weapon/coin/coin
/obj/machinery/vending/boozeomat
name = "Booze-O-Mat"
@@ -90,6 +94,8 @@
vend_delay = 34
product_hidden = "/obj/item/weapon/zippo"
product_hideamt = "4"
product_coin = "/obj/item/clothing/mask/cigarette/cigar/havanian"
product_coin_amt = "2"
/obj/machinery/vending/medical
name = "NanoMed Plus"
+35 -2
View File
@@ -19,6 +19,8 @@
var/list/temp_amounts = dd_text2List(src.product_amounts, ";")
var/list/temp_hidden = dd_text2List(src.product_hidden, ";")
var/list/temp_hideamt = dd_text2List(src.product_hideamt, ";")
var/list/temp_coin = dd_text2List(src.product_coin, ";")
var/list/temp_coin_amt = dd_text2List(src.product_coin_amt, ";")
//Little sanity check here
if ((isnull(temp_paths)) || (isnull(temp_amounts)) || (temp_paths.len != temp_amounts.len) || (temp_hidden.len != temp_hideamt.len))
stat |= BROKEN
@@ -28,6 +30,7 @@
src.build_inventory(temp_paths,temp_amounts)
//Add hidden inventory
src.build_inventory(temp_hidden,temp_hideamt, 1)
src.build_inventory(temp_coin,temp_coin_amt, 0, 1)
power_change()
return
@@ -60,7 +63,7 @@
return
/obj/machinery/vending/proc/build_inventory(var/list/path_list,var/list/amt_list,hidden=0)
/obj/machinery/vending/proc/build_inventory(var/list/path_list,var/list/amt_list,hidden=0,req_coin=0)
for(var/p=1, p <= path_list.len ,p++)
var/checkpath = text2path(path_list[p])
@@ -77,6 +80,9 @@
if(hidden)
R.amount = text2num(amt_list[p])
src.hidden_records += R
else if(req_coin)
R.amount = text2num(amt_list[p])
src.coin_records += R
else
R.amount = text2num(amt_list[p])
src.product_records += R
@@ -105,6 +111,12 @@
if(src.panel_open)
attack_hand(user)
return
else if(istype(W, /obj/item/weapon/coin))
user.drop_item()
W.loc = src
coin = W
user << "\blue You insert the [W] into the [src]"
return
else
..()
@@ -125,12 +137,18 @@
var/dat = "<TT><b>Select an item:</b><br>"
dat += "<b>Coin slot:</b> [coin ? coin : "No coin inserted"] (<a href='byond://?src=\ref[src];remove_coin=1'>Remove</A>)<br><br>"
if (src.product_records.len == 0)
dat += "<font color = 'red'>No product loaded!</font>"
else
var/list/display_records = src.product_records
if(src.extended_inventory)
display_records = (src.product_records + src.hidden_records)
display_records = src.product_records + src.hidden_records
if(src.coin)
display_records = src.product_records + src.coin_records
if(src.coin && src.extended_inventory)
display_records = src.product_records + src.hidden_records + src.coin_records
for (var/datum/data/vending_product/R in display_records)
dat += "<FONT color = '[R.display_color]'><B>[R.product_name]</B>:"
@@ -190,6 +208,18 @@
usr << "\red The vending machine refuses to interface with you, as you are not in its target demographic!"
return
if(href_list["remove_coin"])
if(!coin)
usr << "There is no coin in this machine."
return
coin.loc = src.loc
if(!usr.get_active_hand())
usr.put_in_hand(coin)
usr << "\blue You remove the [coin] from the [src]"
coin = null
if ((usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf))))
usr.machine = src
if ((href_list["vend"]) && (src.vend_ready))
@@ -214,6 +244,9 @@
src.vend_ready = 1
return
if (R in coin_records)
del(coin)
R.amount--
if(((src.last_reply + (src.vend_delay + 200)) <= world.time) && src.vend_reply)
@@ -243,6 +243,12 @@ ZIPPO
throwforce = 1
/obj/item/clothing/mask/cigarette/cigar/havanian/attackby(obj/item/weapon/W as obj, mob/user as mob)
if(istype(W, /obj/item/weapon/match) && (W:lit > 0))
user << "\red The [src] straight out REFUSES to be lit by such uncivilized means."
else
..()
////////////
//CIG PACK//
+9
View File
@@ -54,6 +54,15 @@ Stuff which is in development and not yet visible to players or just code relate
(ie. code improvements for expandability, etc.) should not be listed here. They
should be listed in the changelog upon commit tho. Thanks. -->
<b><font color='blue'>14 September 2011:</font><b>
<ul>
<li><b>Errorage updated:</b>
<ul>
<li>You can now insert a coin into a vending machines. Some machines (currently only the cigarette vending machine) have special items that you can only get to with a coin. No, hacking will not let you get the items, coin only.</li>
</ul>
</li>
</ul>
<b><font color='blue'>14 September 2011:</font><b>
<ul>
<li><b>Lasty updated:</b>