Merge branch 'master' into upstream-merge-32311
This commit is contained in:
@@ -57,19 +57,17 @@
|
||||
toggle_cam()
|
||||
|
||||
/obj/machinery/camera/Destroy()
|
||||
toggle_cam(null, 0) //kick anyone viewing out
|
||||
if(can_use())
|
||||
toggle_cam(null, 0) //kick anyone viewing out and remove from the camera chunks
|
||||
GLOB.cameranet.cameras -= src
|
||||
if(isarea(myarea))
|
||||
LAZYREMOVE(myarea.cameras, src)
|
||||
if(assembly)
|
||||
qdel(assembly)
|
||||
assembly = null
|
||||
QDEL_NULL(assembly)
|
||||
if(bug)
|
||||
bug.bugged_cameras -= src.c_tag
|
||||
if(bug.current == src)
|
||||
bug.current = null
|
||||
bug = null
|
||||
GLOB.cameranet.removeCamera(src) //Will handle removal from the camera network and the chunks, so we don't need to worry about that
|
||||
GLOB.cameranet.cameras -= src
|
||||
return ..()
|
||||
|
||||
/obj/machinery/camera/emp_act(severity)
|
||||
|
||||
@@ -1,10 +1,4 @@
|
||||
/mob/living/silicon/ai/proc/get_camera_list()
|
||||
|
||||
track.cameras.Cut()
|
||||
|
||||
if(src.stat == DEAD)
|
||||
return
|
||||
|
||||
var/list/L = list()
|
||||
for (var/obj/machinery/camera/C in GLOB.cameranet.cameras)
|
||||
L.Add(C)
|
||||
@@ -18,25 +12,18 @@
|
||||
if (tempnetwork.len)
|
||||
T[text("[][]", C.c_tag, (C.can_use() ? null : " (Deactivated)"))] = C
|
||||
|
||||
track.cameras = T
|
||||
return T
|
||||
|
||||
|
||||
/mob/living/silicon/ai/proc/ai_camera_list(camera)
|
||||
if (!camera)
|
||||
return 0
|
||||
|
||||
var/obj/machinery/camera/C = track.cameras[camera]
|
||||
src.eyeobj.setLoc(C)
|
||||
|
||||
return
|
||||
/mob/living/silicon/ai/proc/show_camera_list()
|
||||
var/list/cameras = get_camera_list()
|
||||
var/camera = input(src, "Choose which camera you want to view", "Cameras") as null|anything in cameras
|
||||
switchCamera(cameras[camera])
|
||||
|
||||
/datum/trackable
|
||||
var/list/names = list()
|
||||
var/list/namecounts = list()
|
||||
var/list/humans = list()
|
||||
var/list/others = list()
|
||||
var/list/cameras = list()
|
||||
|
||||
/mob/living/silicon/ai/proc/trackable_mobs()
|
||||
|
||||
@@ -143,13 +130,9 @@
|
||||
/obj/machinery/camera/attack_ai(mob/living/silicon/ai/user)
|
||||
if (!istype(user))
|
||||
return
|
||||
if (!src.can_use())
|
||||
if (!can_use())
|
||||
return
|
||||
user.eyeobj.setLoc(get_turf(src))
|
||||
|
||||
|
||||
/mob/living/silicon/ai/attack_ai(mob/user)
|
||||
ai_camera_list()
|
||||
user.switchCamera(src)
|
||||
|
||||
/proc/camera_sort(list/L)
|
||||
var/obj/machinery/camera/a
|
||||
|
||||
@@ -83,12 +83,23 @@
|
||||
|
||||
if(!eyeobj.eye_initialized)
|
||||
var/camera_location
|
||||
for(var/obj/machinery/camera/C in GLOB.cameranet.cameras)
|
||||
if(!C.can_use() || z_lock.len && !(C.z in z_lock))
|
||||
continue
|
||||
if(C.network & networks)
|
||||
camera_location = get_turf(C)
|
||||
break
|
||||
var/turf/myturf = get_turf(src)
|
||||
if(eyeobj.use_static)
|
||||
if((!z_lock.len || (myturf.z in z_lock)) && GLOB.cameranet.checkTurfVis(myturf))
|
||||
camera_location = myturf
|
||||
else
|
||||
for(var/obj/machinery/camera/C in GLOB.cameranet.cameras)
|
||||
if(!C.can_use() || z_lock.len && !(C.z in z_lock))
|
||||
continue
|
||||
var/list/network_overlap = networks & C.network
|
||||
if(network_overlap.len)
|
||||
camera_location = get_turf(C)
|
||||
break
|
||||
else
|
||||
camera_location = myturf
|
||||
if(z_lock.len && !(myturf.z in z_lock))
|
||||
camera_location = locate(round(world.maxx/2), round(world.maxy/2), z_lock[1])
|
||||
|
||||
if(camera_location)
|
||||
eyeobj.eye_initialized = TRUE
|
||||
give_eye_control(L)
|
||||
@@ -300,9 +311,6 @@
|
||||
else if(isspaceturf(T))
|
||||
to_chat(user, "<span class='sevtug_small'>[prob(1) ? "Servant cannot into space." : "You can't teleport into space."]</span>")
|
||||
return
|
||||
else if(T.flags_1 & NOJAUNT_1)
|
||||
to_chat(user, "<span class='sevtug_small'>This tile is blessed by holy water and deflects the warp.</span>")
|
||||
return
|
||||
var/area/AR = get_area(T)
|
||||
if(!AR.clockwork_warp_allowed)
|
||||
to_chat(user, "<span class='sevtug_small'>[AR.clockwork_warp_fail]</span>")
|
||||
|
||||
@@ -449,7 +449,7 @@
|
||||
scantemp = "<font class='bad'>Subject's brain is not responding to scanning stimuli.</font>"
|
||||
playsound(src, 'sound/machines/terminal_prompt_deny.ogg', 50, 0)
|
||||
return
|
||||
if((mob_occupant.has_disability(NOCLONE)) && (src.scanner.scan_level < 2))
|
||||
if((mob_occupant.has_disability(DISABILITY_NOCLONE)) && (src.scanner.scan_level < 2))
|
||||
scantemp = "<font class='bad'>Subject no longer contains the fundamental materials required to create a living clone.</font>"
|
||||
playsound(src, 'sound/machines/terminal_alert.ogg', 50, 0)
|
||||
return
|
||||
|
||||
@@ -81,7 +81,7 @@
|
||||
if(connected && connected.is_operational())
|
||||
if(connected.occupant) //set occupant_status message
|
||||
viable_occupant = connected.occupant
|
||||
if(viable_occupant.has_dna() && (!(RADIMMUNE in viable_occupant.dna.species.species_traits)) && (!(viable_occupant.has_disability(NOCLONE)) || (connected.scan_level == 3))) //occupant is viable for dna modification
|
||||
if(viable_occupant.has_dna() && (!(RADIMMUNE in viable_occupant.dna.species.species_traits)) && (!(viable_occupant.has_disability(DISABILITY_NOCLONE)) || (connected.scan_level == 3))) //occupant is viable for dna modification
|
||||
occupant_status += "[viable_occupant.name] => "
|
||||
switch(viable_occupant.stat)
|
||||
if(CONSCIOUS)
|
||||
@@ -528,7 +528,7 @@
|
||||
var/mob/living/carbon/viable_occupant = null
|
||||
if(connected)
|
||||
viable_occupant = connected.occupant
|
||||
if(!istype(viable_occupant) || !viable_occupant.dna || (viable_occupant.has_disability(NOCLONE)))
|
||||
if(!istype(viable_occupant) || !viable_occupant.dna || (viable_occupant.has_disability(DISABILITY_NOCLONE)))
|
||||
viable_occupant = null
|
||||
return viable_occupant
|
||||
|
||||
|
||||
@@ -100,7 +100,7 @@
|
||||
var/mob/living/mob_occupant = get_mob_or_brainmob(occupant)
|
||||
if(istype(mob_occupant))
|
||||
if(locate_computer(/obj/machinery/computer/cloning))
|
||||
if(!mob_occupant.suiciding && !(mob_occupant.has_disability(NOCLONE)) && !mob_occupant.hellbound)
|
||||
if(!mob_occupant.suiciding && !(mob_occupant.has_disability(DISABILITY_NOCLONE)) && !mob_occupant.hellbound)
|
||||
mob_occupant.notify_ghost_cloning("Your corpse has been placed into a cloning scanner. Re-enter your corpse if you want to be cloned!", source = src)
|
||||
|
||||
// DNA manipulators cannot operate on severed heads or brains
|
||||
|
||||
@@ -251,13 +251,16 @@
|
||||
note = null
|
||||
update_icon()
|
||||
|
||||
/obj/machinery/door/airlock/proc/unzap() //for addtimer
|
||||
justzap = FALSE
|
||||
|
||||
/obj/machinery/door/airlock/bumpopen(mob/living/user) //Airlocks now zap you when you 'bump' them open when they're electrified. --NeoFite
|
||||
if(!issilicon(usr))
|
||||
if(isElectrified())
|
||||
if(!justzap)
|
||||
if(shock(user, 100))
|
||||
justzap = TRUE
|
||||
addtimer(VARSET_CALLBACK(src, justzap, FALSE) , 10)
|
||||
addtimer(CALLBACK(src, .proc/unzap), 10)
|
||||
return
|
||||
else
|
||||
return
|
||||
@@ -677,7 +680,7 @@
|
||||
|
||||
if(ishuman(user) && prob(40) && src.density)
|
||||
var/mob/living/carbon/human/H = user
|
||||
if((H.disabilities & DUMB) && Adjacent(user))
|
||||
if((H.has_disability(DISABILITY_DUMB)) && Adjacent(user))
|
||||
playsound(src.loc, 'sound/effects/bang.ogg', 25, 1)
|
||||
if(!istype(H.head, /obj/item/clothing/head/helmet))
|
||||
H.visible_message("<span class='danger'>[user] headbutts the airlock.</span>", \
|
||||
|
||||
@@ -195,7 +195,7 @@
|
||||
/obj/machinery/door/emp_act(severity)
|
||||
if(prob(20/severity) && (istype(src, /obj/machinery/door/airlock) || istype(src, /obj/machinery/door/window)) )
|
||||
INVOKE_ASYNC(src, .proc/open)
|
||||
if(prob(severity*10 - 20))
|
||||
if(prob(40/severity))
|
||||
if(secondsElectrified == 0)
|
||||
secondsElectrified = -1
|
||||
shockedby += "\[[time_stamp()]\]EM Pulse"
|
||||
|
||||
@@ -1,66 +1,68 @@
|
||||
/obj/machinery/door/poddoor
|
||||
name = "blast door"
|
||||
desc = "A heavy duty blast door that opens mechanically."
|
||||
icon = 'icons/obj/doors/blastdoor.dmi'
|
||||
icon_state = "closed"
|
||||
var/id = 1
|
||||
/obj/machinery/door/poddoor
|
||||
name = "blast door"
|
||||
desc = "A heavy duty blast door that opens mechanically."
|
||||
icon = 'icons/obj/doors/blastdoor.dmi'
|
||||
icon_state = "closed"
|
||||
var/id = 1
|
||||
sub_door = TRUE
|
||||
explosion_block = 3
|
||||
explosion_block = 3
|
||||
heat_proof = TRUE
|
||||
safe = FALSE
|
||||
max_integrity = 600
|
||||
armor = list(melee = 50, bullet = 100, laser = 100, energy = 100, bomb = 50, bio = 100, rad = 100, fire = 100, acid = 70)
|
||||
resistance_flags = FIRE_PROOF
|
||||
damage_deflection = 70
|
||||
|
||||
/obj/machinery/door/poddoor/preopen
|
||||
icon_state = "open"
|
||||
max_integrity = 600
|
||||
armor = list(melee = 50, bullet = 100, laser = 100, energy = 100, bomb = 50, bio = 100, rad = 100, fire = 100, acid = 70)
|
||||
resistance_flags = FIRE_PROOF
|
||||
damage_deflection = 70
|
||||
|
||||
/obj/machinery/door/poddoor/preopen
|
||||
icon_state = "open"
|
||||
density = FALSE
|
||||
opacity = 0
|
||||
|
||||
/obj/machinery/door/poddoor/ert
|
||||
desc = "A heavy duty blast door that only opens for dire emergencies."
|
||||
|
||||
//special poddoors that open when emergency shuttle docks at centcom
|
||||
/obj/machinery/door/poddoor/shuttledock
|
||||
var/checkdir = 4 //door won't open if turf in this dir is `turftype`
|
||||
var/turftype = /turf/open/space
|
||||
|
||||
/obj/machinery/door/poddoor/shuttledock/proc/check()
|
||||
var/turf/T = get_step(src, checkdir)
|
||||
if(!istype(T, turftype))
|
||||
INVOKE_ASYNC(src, .proc/open)
|
||||
else
|
||||
INVOKE_ASYNC(src, .proc/close)
|
||||
|
||||
opacity = 0
|
||||
|
||||
/obj/machinery/door/poddoor/ert
|
||||
desc = "A heavy duty blast door that only opens for dire emergencies."
|
||||
|
||||
//special poddoors that open when emergency shuttle docks at centcom
|
||||
/obj/machinery/door/poddoor/shuttledock
|
||||
var/checkdir = 4 //door won't open if turf in this dir is `turftype`
|
||||
var/turftype = /turf/open/space
|
||||
|
||||
/obj/machinery/door/poddoor/shuttledock/proc/check()
|
||||
var/turf/T = get_step(src, checkdir)
|
||||
if(!istype(T, turftype))
|
||||
INVOKE_ASYNC(src, .proc/open)
|
||||
else
|
||||
INVOKE_ASYNC(src, .proc/close)
|
||||
|
||||
/obj/machinery/door/poddoor/CollidedWith(atom/movable/AM)
|
||||
if(density)
|
||||
return 0
|
||||
else
|
||||
return ..()
|
||||
|
||||
//"BLAST" doors are obviously stronger than regular doors when it comes to BLASTS.
|
||||
/obj/machinery/door/poddoor/ex_act(severity, target)
|
||||
if(severity == 3)
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/machinery/door/poddoor/do_animate(animation)
|
||||
switch(animation)
|
||||
if("opening")
|
||||
flick("opening", src)
|
||||
if("closing")
|
||||
flick("closing", src)
|
||||
|
||||
/obj/machinery/door/poddoor/update_icon()
|
||||
if(density)
|
||||
icon_state = "closed"
|
||||
else
|
||||
icon_state = "open"
|
||||
|
||||
/obj/machinery/door/poddoor/try_to_activate_door(mob/user)
|
||||
return
|
||||
|
||||
/obj/machinery/door/poddoor/try_to_crowbar(obj/item/I, mob/user)
|
||||
if(stat & NOPOWER)
|
||||
open(1)
|
||||
if(density)
|
||||
return 0
|
||||
else
|
||||
return ..()
|
||||
|
||||
//"BLAST" doors are obviously stronger than regular doors when it comes to BLASTS.
|
||||
/obj/machinery/door/poddoor/ex_act(severity, target)
|
||||
if(severity == 3)
|
||||
return
|
||||
..()
|
||||
|
||||
/obj/machinery/door/poddoor/do_animate(animation)
|
||||
switch(animation)
|
||||
if("opening")
|
||||
flick("opening", src)
|
||||
playsound(src, 'sound/machines/blastdoor.ogg', 30, 1)
|
||||
if("closing")
|
||||
flick("closing", src)
|
||||
playsound(src, 'sound/machines/blastdoor.ogg', 30, 1)
|
||||
|
||||
/obj/machinery/door/poddoor/update_icon()
|
||||
if(density)
|
||||
icon_state = "closed"
|
||||
else
|
||||
icon_state = "open"
|
||||
|
||||
/obj/machinery/door/poddoor/try_to_activate_door(mob/user)
|
||||
return
|
||||
|
||||
/obj/machinery/door/poddoor/try_to_crowbar(obj/item/I, mob/user)
|
||||
if(stat & NOPOWER)
|
||||
open(1)
|
||||
|
||||
@@ -22,7 +22,6 @@ GLOBAL_LIST_EMPTY(allCasters)
|
||||
var/creationTime
|
||||
var/authorCensor
|
||||
var/bodyCensor
|
||||
var/photo_file
|
||||
|
||||
/datum/newscaster/feed_message/proc/returnAuthor(censor)
|
||||
if(censor == -1)
|
||||
@@ -98,7 +97,6 @@ GLOBAL_LIST_EMPTY(allCasters)
|
||||
var/scannedUser
|
||||
var/isAdminMsg
|
||||
var/icon/img
|
||||
var/photo_file
|
||||
|
||||
/datum/newscaster/feed_network
|
||||
var/list/datum/newscaster/feed_channel/network_channels = list()
|
||||
@@ -128,7 +126,6 @@ GLOBAL_LIST_EMPTY(allCasters)
|
||||
if(photo)
|
||||
newMsg.img = photo.img
|
||||
newMsg.caption = photo.scribble
|
||||
newMsg.photo_file = save_photo(photo.img)
|
||||
for(var/datum/newscaster/feed_channel/FC in network_channels)
|
||||
if(FC.channel_name == channel_name)
|
||||
FC.messages += newMsg
|
||||
@@ -146,7 +143,6 @@ GLOBAL_LIST_EMPTY(allCasters)
|
||||
wanted_issue.isAdminMsg = adminMsg
|
||||
if(photo)
|
||||
wanted_issue.img = photo.img
|
||||
wanted_issue.photo_file = save_photo(photo.img)
|
||||
if(newMessage)
|
||||
for(var/obj/machinery/newscaster/N in GLOB.allCasters)
|
||||
N.newsAlert()
|
||||
@@ -161,12 +157,7 @@ GLOBAL_LIST_EMPTY(allCasters)
|
||||
for(var/obj/machinery/newscaster/NEWSCASTER in GLOB.allCasters)
|
||||
NEWSCASTER.update_icon()
|
||||
|
||||
/datum/newscaster/feed_network/proc/save_photo(icon/photo)
|
||||
var/photo_file = copytext(md5("\icon[photo]"), 1, 6)
|
||||
if(!fexists("[GLOB.log_directory]/photos/[photo_file].png"))
|
||||
var/icon/p = icon(photo, frame = 1)
|
||||
fcopy(p, "[GLOB.log_directory]/photos/[photo_file].png")
|
||||
return photo_file
|
||||
|
||||
|
||||
/obj/item/wallframe/newscaster
|
||||
name = "newscaster frame"
|
||||
|
||||
+181
-97
@@ -25,8 +25,8 @@
|
||||
integrity_failure = 100
|
||||
armor = list(melee = 20, bullet = 0, laser = 0, energy = 0, bomb = 0, bio = 0, rad = 0, fire = 50, acid = 70)
|
||||
circuit = /obj/item/circuitboard/machine/vendor
|
||||
var/active = TRUE //No sales pitches if off!
|
||||
var/vend_ready = TRUE //Are we ready to vend?? Is it time??
|
||||
var/active = 1 //No sales pitches if off!
|
||||
var/vend_ready = 1 //Are we ready to vend?? Is it time??
|
||||
|
||||
// To be filled out at compile time
|
||||
var/list/products = list() //For each, use the following pattern:
|
||||
@@ -227,15 +227,15 @@
|
||||
if(!allowed(user) && !emagged && scan_id)
|
||||
to_chat(user, "<span class='warning'>[src]'s chef compartment blinks red: Access denied.</span>")
|
||||
req_access_txt = "0"
|
||||
return FALSE
|
||||
return 0
|
||||
req_access_txt = "0"
|
||||
return TRUE
|
||||
return 1
|
||||
|
||||
/obj/machinery/vending/snack/proc/iscompartmentfull(mob/user)
|
||||
if(contents.len >= 30) // no more than 30 dishes can fit inside
|
||||
to_chat(user, "<span class='warning'>[src]'s chef compartment is full.</span>")
|
||||
return TRUE
|
||||
return FALSE
|
||||
return 1
|
||||
return 0
|
||||
|
||||
/obj/machinery/vending/snack/proc/food_load(obj/item/reagent_containers/food/snacks/S)
|
||||
if(dish_quants[S.name])
|
||||
@@ -350,6 +350,180 @@
|
||||
/obj/machinery/vending/attack_ai(mob/user)
|
||||
return attack_hand(user)
|
||||
|
||||
/obj/machinery/vending/attack_hand(mob/user)
|
||||
var/dat = ""
|
||||
if(panel_open && !isAI(user))
|
||||
return wires.interact(user)
|
||||
else
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
|
||||
dat += "<h3>Select an item</h3>"
|
||||
dat += "<div class='statusDisplay'>"
|
||||
if(product_records.len == 0)
|
||||
dat += "<font color = 'red'>No product loaded!</font>"
|
||||
else
|
||||
var/list/display_records = product_records
|
||||
if(extended_inventory)
|
||||
display_records = product_records + hidden_records
|
||||
if(coin || bill)
|
||||
display_records = product_records + coin_records
|
||||
if((coin || bill) && extended_inventory)
|
||||
display_records = product_records + hidden_records + coin_records
|
||||
dat += "<ul>"
|
||||
for (var/datum/data/vending_product/R in display_records)
|
||||
dat += "<li>"
|
||||
if(R.amount > 0)
|
||||
dat += "<a href='byond://?src=[REF(src)];vend=[REF(R)]'>Vend</a> "
|
||||
else
|
||||
dat += "<span class='linkOff'>Sold out</span> "
|
||||
dat += "<font color = '[R.display_color]'><b>[sanitize(R.product_name)]</b>:</font>"
|
||||
dat += " <b>[R.amount]</b>"
|
||||
dat += "</li>"
|
||||
dat += "</ul>"
|
||||
dat += "</div>"
|
||||
if(premium.len > 0)
|
||||
dat += "<b>Change Return:</b> "
|
||||
if (coin || bill)
|
||||
dat += "[(coin ? coin : "")][(bill ? bill : "")] <a href='byond://?src=[REF(src)];remove_coin=1'>Remove</a>"
|
||||
else
|
||||
dat += "<i>No money</i> <span class='linkOff'>Remove</span>"
|
||||
if(istype(src, /obj/machinery/vending/snack))
|
||||
dat += "<h3>Chef's Food Selection</h3>"
|
||||
dat += "<div class='statusDisplay'>"
|
||||
for (var/O in dish_quants)
|
||||
if(dish_quants[O] > 0)
|
||||
var/N = dish_quants[O]
|
||||
dat += "<a href='byond://?src=[REF(src)];dispense=[sanitize(O)]'>Dispense</A> "
|
||||
dat += "<B>[capitalize(O)]: [N]</B><br>"
|
||||
dat += "</div>"
|
||||
user.set_machine(src)
|
||||
if(seconds_electrified && !(stat & NOPOWER))
|
||||
if(shock(user, 100))
|
||||
return
|
||||
|
||||
var/datum/browser/popup = new(user, "vending", (name))
|
||||
popup.set_content(dat)
|
||||
popup.set_title_image(user.browse_rsc_icon(icon, icon_state))
|
||||
popup.open()
|
||||
|
||||
|
||||
/obj/machinery/vending/Topic(href, href_list)
|
||||
if(..())
|
||||
return
|
||||
|
||||
if(href_list["remove_coin"])
|
||||
if(!(coin || bill))
|
||||
to_chat(usr, "<span class='notice'>There is no money in this machine.</span>")
|
||||
return
|
||||
if(coin)
|
||||
if(!usr.get_active_held_item())
|
||||
usr.put_in_hands(coin)
|
||||
else
|
||||
coin.forceMove(get_turf(src))
|
||||
to_chat(usr, "<span class='notice'>You remove [coin] from [src].</span>")
|
||||
coin = null
|
||||
if(bill)
|
||||
if(!usr.get_active_held_item())
|
||||
usr.put_in_hands(bill)
|
||||
else
|
||||
bill.forceMove(get_turf(src))
|
||||
to_chat(usr, "<span class='notice'>You remove [bill] from [src].</span>")
|
||||
bill = null
|
||||
|
||||
|
||||
usr.set_machine(src)
|
||||
|
||||
if((href_list["dispense"]) && (vend_ready))
|
||||
var/N = href_list["dispense"]
|
||||
if(dish_quants[N] <= 0) // Sanity check, there are probably ways to press the button when it shouldn't be possible.
|
||||
return
|
||||
vend_ready = 0
|
||||
use_power(5)
|
||||
|
||||
dish_quants[N] = max(dish_quants[N] - 1, 0)
|
||||
for(var/obj/O in contents)
|
||||
if(O.name == N)
|
||||
O.forceMove(drop_location())
|
||||
break
|
||||
vend_ready = 1
|
||||
updateUsrDialog()
|
||||
return
|
||||
|
||||
if((href_list["vend"]) && (vend_ready))
|
||||
if(panel_open)
|
||||
to_chat(usr, "<span class='notice'>The vending machine cannot dispense products while its service panel is open!</span>")
|
||||
return
|
||||
|
||||
if((!allowed(usr)) && !emagged && scan_id) //For SECURE VENDING MACHINES YEAH
|
||||
to_chat(usr, "<span class='warning'>Access denied.</span>" )
|
||||
flick(icon_deny,src)
|
||||
return
|
||||
|
||||
vend_ready = 0 //One thing at a time!!
|
||||
|
||||
var/datum/data/vending_product/R = locate(href_list["vend"])
|
||||
if(!R || !istype(R) || !R.product_path)
|
||||
vend_ready = 1
|
||||
return
|
||||
|
||||
if(R in hidden_records)
|
||||
if(!extended_inventory)
|
||||
vend_ready = 1
|
||||
return
|
||||
else if(R in coin_records)
|
||||
if(!(coin || bill))
|
||||
to_chat(usr, "<span class='warning'>You need to insert money to get this item!</span>")
|
||||
vend_ready = 1
|
||||
return
|
||||
if(coin && coin.string_attached)
|
||||
if(prob(50))
|
||||
if(usr.put_in_hands(coin))
|
||||
to_chat(usr, "<span class='notice'>You successfully pull [coin] out before [src] could swallow it.</span>")
|
||||
coin = null
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>You couldn't pull [coin] out because your hands are full!</span>")
|
||||
QDEL_NULL(coin)
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>You weren't able to pull [coin] out fast enough, the machine ate it, string and all!</span>")
|
||||
QDEL_NULL(coin)
|
||||
else
|
||||
QDEL_NULL(coin)
|
||||
QDEL_NULL(bill)
|
||||
|
||||
else if (!(R in product_records))
|
||||
vend_ready = 1
|
||||
message_admins("Vending machine exploit attempted by [key_name(usr, usr.client)]!")
|
||||
return
|
||||
|
||||
if (R.amount <= 0)
|
||||
to_chat(usr, "<span class='warning'>Sold out.</span>")
|
||||
vend_ready = 1
|
||||
return
|
||||
else
|
||||
R.amount--
|
||||
|
||||
if(((last_reply + 200) <= world.time) && vend_reply)
|
||||
speak(vend_reply)
|
||||
last_reply = world.time
|
||||
|
||||
use_power(5)
|
||||
if(icon_vend) //Show the vending animation if needed
|
||||
flick(icon_vend,src)
|
||||
new R.product_path(get_turf(src))
|
||||
SSblackbox.record_feedback("nested tally", "vending_machine_usage", 1, list("[type]", "[R.product_path]"))
|
||||
vend_ready = 1
|
||||
return
|
||||
|
||||
updateUsrDialog()
|
||||
return
|
||||
|
||||
else if(href_list["togglevoice"] && panel_open)
|
||||
shut_up = !shut_up
|
||||
|
||||
updateUsrDialog()
|
||||
|
||||
|
||||
/obj/machinery/vending/process()
|
||||
if(stat & (BROKEN|NOPOWER))
|
||||
return
|
||||
@@ -431,96 +605,6 @@
|
||||
else
|
||||
return FALSE
|
||||
|
||||
/obj/machinery/vending/ui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = 0, \
|
||||
datum/tgui/master_ui = null, datum/ui_state/state = GLOB.physical_state)
|
||||
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
|
||||
if(!ui)
|
||||
ui = new(user, src, ui_key, "vending", name, 350, 475, master_ui, state)
|
||||
ui.open()
|
||||
|
||||
/obj/machinery/vending/ui_data()
|
||||
var/list/data = list()
|
||||
var/list/listed_products = list()
|
||||
var/list/display_records = product_records
|
||||
if(extended_inventory)
|
||||
display_records += hidden_records
|
||||
if(coin)
|
||||
display_records += coin_records
|
||||
for(var/key = 1 to display_records.len)
|
||||
var/datum/data/vending_product/I = display_records[key]
|
||||
listed_products.Add(list(list(
|
||||
"key" = key,
|
||||
"name" = I.product_name,
|
||||
"color" = I.display_color,
|
||||
"amount" = I.amount)))
|
||||
data["products"] = listed_products
|
||||
if(!isnull(coin))
|
||||
data["coin"] = coin.name
|
||||
data["coinslot"] = premium.len
|
||||
data["canvend"] = vend_ready
|
||||
|
||||
return data
|
||||
|
||||
/obj/machinery/vending/ui_act(action, params)
|
||||
if(..())
|
||||
return
|
||||
if(!vend_ready)
|
||||
return
|
||||
switch(action)
|
||||
if("vend")
|
||||
if(!allowed(usr) && !emagged && scan_id) //For SECURE VENDING MACHINES YEAH
|
||||
to_chat(usr, "<span class='warning'>Access denied.</span>")
|
||||
flick(icon_deny,src)
|
||||
return
|
||||
vend_ready = FALSE
|
||||
addtimer(VARSET_CALLBACK(src, vend_ready, TRUE), 10)
|
||||
var/key = text2num(params["key"])
|
||||
var/datum/data/vending_product/R = product_records[key]
|
||||
if(R in hidden_records)
|
||||
if(!extended_inventory)
|
||||
return
|
||||
else if(R in coin_records)
|
||||
if(!coin)
|
||||
to_chat(usr, "<span class='warning'>You need to insert a coin to get this item!</span>")
|
||||
return
|
||||
if(coin.string_attached)
|
||||
if(prob(50))
|
||||
if(usr.put_in_hands(coin))
|
||||
to_chat(usr, "<span class='notice'>You successfully pull [coin] out before [src] could swallow it.</span>")
|
||||
coin = null
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>You couldn't pull [coin] out because your hands are full!</span>")
|
||||
QDEL_NULL(coin)
|
||||
else
|
||||
to_chat(usr, "<span class='warning'>You weren't able to pull [coin] out fast enough, the machine ate it, string and all!</span>")
|
||||
QDEL_NULL(coin)
|
||||
else
|
||||
QDEL_NULL(coin)
|
||||
else if (!(R in product_records))
|
||||
return
|
||||
|
||||
|
||||
|
||||
if (R.amount <= 0)
|
||||
to_chat(usr, "<span class='warning'>Sold out.</span>")
|
||||
return
|
||||
R.amount--
|
||||
if(((last_reply + 200) <= world.time) && vend_reply)
|
||||
speak(vend_reply)
|
||||
last_reply = world.time
|
||||
use_power(5)
|
||||
if(icon_vend) //Show the vending animation if needed
|
||||
flick(icon_vend,src)
|
||||
new R.product_path(drop_location())
|
||||
return TRUE
|
||||
if("eject")
|
||||
if(!coin)
|
||||
to_chat(usr, "<span class='notice'>There is no coin in this machine.</span>")
|
||||
return
|
||||
usr.put_in_hands(coin)
|
||||
to_chat(usr, "<span class='notice'>You remove [coin] from [src].</span>")
|
||||
coin = null
|
||||
|
||||
/*
|
||||
* Vending machine types
|
||||
*/
|
||||
@@ -1111,4 +1195,4 @@ IF YOU MODIFY THE PRODUCTS LIST OF A MACHINE, MAKE SURE TO UPDATE ITS RESUPPLY C
|
||||
|
||||
#undef STANDARD_CHARGE
|
||||
#undef CONTRABAND_CHARGE
|
||||
#undef COIN_CHARGE
|
||||
#undef COIN_CHARGE
|
||||
Reference in New Issue
Block a user