Skip to content
This repository was archived by the owner on Apr 16, 2021. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 0 additions & 2 deletions code/WorkInProgress/Railgun.dm
Original file line number Diff line number Diff line change
Expand Up @@ -404,8 +404,6 @@ proc/line_ReturnEfficDir(Angle)
ReturnedDir = WEST
return ReturnedDir



//This returns the tangent reciprocal of x, for use with East and West straights.
proc/tanR(x)
return (cos(x)/sin(x))
2 changes: 1 addition & 1 deletion code/obj/machinery/manufacturer.dm
Original file line number Diff line number Diff line change
Expand Up @@ -817,7 +817,7 @@
src.output_target = M
boutput(usr, "<span style=\"color:blue\">You set the manufacturer to output to [over_object]!</span>")

else if (istype(over_object,/obj/table/) && istype(over_object,/obj/rack/))
else if (istype(over_object,/obj/table/) || istype(over_object,/obj/rack/))
var/obj/O = over_object
src.output_target = O.loc
boutput(usr, "<span style=\"color:blue\">You set the manufacturer to output on top of [O]!</span>")
Expand Down
67 changes: 64 additions & 3 deletions code/obj/machinery/vending.dm
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,8 @@

var/datum/light/light

var/output_target = null

power_usage = 50

New()
Expand All @@ -113,6 +115,65 @@
proc/create_products()
return

MouseDrop(over_object, src_location, over_location)
if(!istype(usr,/mob/living/))
boutput(usr, "<span style=\"color:red\">Only living mobs are able to set the output target for [src].</span>")
return

if(get_dist(over_object,src) > 1)
boutput(usr, "<span style=\"color:red\">[src] is too far away from the target!</span>")
return

if(get_dist(over_object,usr) > 1)
boutput(usr, "<span style=\"color:red\">You are too far away from the target!</span>")
return

if (istype(over_object,/obj/storage/crate/))
var/obj/storage/crate/C = over_object
if (C.locked || C.welded)
boutput(usr, "<span style=\"color:red\">You can't use a currently unopenable crate as an output target.</span>")
else
src.output_target = over_object
boutput(usr, "<span style=\"color:blue\">You set [src] to output to [over_object]!</span>")

else if (istype(over_object,/obj/table/) || istype(over_object,/obj/rack/))
var/obj/O = over_object
src.output_target = O.loc
boutput(usr, "<span style=\"color:blue\">You set [src] to output on top of [O]!</span>")

else if (istype(over_object,/turf/simulated/floor/))
src.output_target = over_object
boutput(usr, "<span style=\"color:blue\">You set [src] to output to [over_object]!</span>")

else
boutput(usr, "<span style=\"color:red\">You can't use that as an output target.</span>")
return

proc/get_output_location()
if (!src.output_target)
return src.loc

if (get_dist(src.output_target,src) > 1)
src.output_target = null
return src.loc

if (istype(src.output_target,/obj/storage/crate/))
var/obj/storage/crate/C = src.output_target
if (C.locked || C.welded)
src.output_target = null
return src.loc
else
if (C.open)
return C.loc
else
return C

else if (istype(src.output_target,/turf/simulated/floor/))
return src.output_target

else
return src.loc

/obj/machinery/vending/coffee
name = "coffee machine"
desc = "A Robust Coffee vending machine."
Expand Down Expand Up @@ -1150,13 +1211,13 @@
if (!pay || (src.credit >= R.product_cost) || (account && account.fields["current_money"] >= R.product_cost)) //Conor12: Prevents credit hitting negative numbers if multiple items are bought at once.
R.product_amount--
if (ispath(product_path))
new product_path(get_turf(src))
new product_path(get_output_location())
else if (isicon(R.product_path))
var/icon/welp = icon(R.product_path)
if (welp.Width() > 32 || welp.Height() > 32)
welp.Scale(32, 32)
R.product_path = welp // if scaling is required reset the product_path so it only happens the first time
var/obj/dummy = new /obj/item(get_turf(src))
var/obj/dummy = new /obj/item(get_output_location())
dummy.name = R.product_name
dummy.desc = "?!"
dummy.icon = welp
Expand Down Expand Up @@ -1196,7 +1257,7 @@
if (href_list["return_credits"])
spawn(src.vend_delay)
if (src.credit > 0)
var/obj/item/spacecash/returned = new /obj/item/spacecash(get_turf(src), src.credit)
var/obj/item/spacecash/returned = new /obj/item/spacecash(get_output_location(), src.credit)
src.credit = 0
boutput(usr, "<span style=\"color:blue\">You receive [returned].</span>")
src.generate_HTML(1)
Expand Down