diff --git a/code/defines/obj/vending.dm b/code/defines/obj/vending.dm index aacb7b0a48..d2218f4b23 100644 --- a/code/defines/obj/vending.dm +++ b/code/defines/obj/vending.dm @@ -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" diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm index bae5caf778..e2c841e2b9 100644 --- a/code/game/machinery/vending.dm +++ b/code/game/machinery/vending.dm @@ -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 = "Select an item:
" + dat += "Coin slot: [coin ? coin : "No coin inserted"] (Remove)

" + if (src.product_records.len == 0) dat += "No product loaded!" 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 += "[R.product_name]:" @@ -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) diff --git a/code/game/objects/items/weapons/cigs_lighters.dm b/code/game/objects/items/weapons/cigs_lighters.dm index 02bb496d5a..4546f5400c 100644 --- a/code/game/objects/items/weapons/cigs_lighters.dm +++ b/code/game/objects/items/weapons/cigs_lighters.dm @@ -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// diff --git a/icons/changelog.html b/icons/changelog.html index 731175a51a..e62d8922af 100644 --- a/icons/changelog.html +++ b/icons/changelog.html @@ -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. --> +14 September 2011: +
    +
  • Errorage updated: +
      +
    • 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.
    • +
    +
  • +
+ 14 September 2011:
  • Lasty updated: