mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-07-14 09:35:30 +01:00
Merge pull request #8296 from phil235/TablecraftFix
Tablecraft Fix and recipe detection
This commit is contained in:
@@ -157,6 +157,10 @@
|
||||
update_icon()
|
||||
return
|
||||
|
||||
/obj/item/weapon/flamethrower/CheckParts()
|
||||
weldtool = locate(/obj/item/weapon/weldingtool) in contents
|
||||
igniter = locate(/obj/item/device/assembly/igniter) in contents
|
||||
update_icon()
|
||||
|
||||
//Called from turf.dm turf/dblclick
|
||||
/obj/item/weapon/flamethrower/proc/flame_turf(turflist)
|
||||
@@ -195,9 +199,11 @@
|
||||
|
||||
/obj/item/weapon/flamethrower/full/New(var/loc)
|
||||
..()
|
||||
weldtool = new /obj/item/weapon/weldingtool(src)
|
||||
if(!weldtool)
|
||||
weldtool = new /obj/item/weapon/weldingtool(src)
|
||||
weldtool.status = 0
|
||||
igniter = new /obj/item/device/assembly/igniter(src)
|
||||
if(!igniter)
|
||||
igniter = new /obj/item/device/assembly/igniter(src)
|
||||
igniter.secured = 0
|
||||
status = 1
|
||||
update_icon()
|
||||
@@ -205,4 +211,4 @@
|
||||
/obj/item/weapon/flamethrower/full/tank/New(var/loc)
|
||||
..()
|
||||
ptank = new /obj/item/weapon/tank/internals/plasma/full(src)
|
||||
update_icon()
|
||||
update_icon()
|
||||
|
||||
@@ -96,6 +96,7 @@
|
||||
F.ptank = src
|
||||
user.unEquip(src)
|
||||
src.loc = F
|
||||
F.update_icon()
|
||||
return
|
||||
|
||||
/obj/item/weapon/tank/internals/plasma/full/New()
|
||||
|
||||
@@ -308,6 +308,7 @@
|
||||
//Toggles the welder off and on
|
||||
/obj/item/weapon/weldingtool/proc/toggle(mob/user, message = 0)
|
||||
if(!status)
|
||||
user << "<span class='notice'>[src] can't be turned on while unsecured.</span>"
|
||||
return
|
||||
welding = !welding
|
||||
if(welding)
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
var/tools[] = list() //type paths of items needed but not consumed
|
||||
var/time = 30 //time in deciseconds
|
||||
var/parts[] = list() //type paths of items that will be placed in the result
|
||||
var/chem_catalists[] = list() //like tools but for reagents
|
||||
var/chem_catalysts[] = list() //like tools but for reagents
|
||||
|
||||
|
||||
/datum/table_recipe/IED
|
||||
@@ -87,7 +87,9 @@
|
||||
result = /obj/item/weapon/flamethrower
|
||||
reqs = list(/obj/item/weapon/weldingtool = 1,
|
||||
/obj/item/device/assembly/igniter = 1,
|
||||
/obj/item/stack/rods = 2)
|
||||
/obj/item/stack/rods = 1)
|
||||
parts = list(/obj/item/device/assembly/igniter = 1,
|
||||
/obj/item/weapon/weldingtool = 1)
|
||||
tools = list(/obj/item/weapon/screwdriver)
|
||||
time = 20
|
||||
|
||||
|
||||
@@ -17,11 +17,22 @@
|
||||
if(table_contents[B] >= R.reqs[A])
|
||||
continue main_loop
|
||||
return 0
|
||||
for(var/A in R.chem_catalists)
|
||||
if(table_contents[A] < R.chem_catalists[A])
|
||||
for(var/A in R.chem_catalysts)
|
||||
if(table_contents[A] < R.chem_catalysts[A])
|
||||
return 0
|
||||
return 1
|
||||
|
||||
/obj/structure/table/proc/partial_check_contents(datum/table_recipe/R)
|
||||
check_table()
|
||||
var/required_amount = max(round(R.reqs.len/2), 1)
|
||||
var/amount = 0
|
||||
for(var/A in R.reqs)
|
||||
for(var/B in table_contents)
|
||||
if(ispath(B, A))
|
||||
amount += 1
|
||||
if(amount >= required_amount)
|
||||
return 1
|
||||
|
||||
/obj/structure/table/proc/check_table()
|
||||
table_contents = list()
|
||||
for(var/obj/item/I in loc)
|
||||
@@ -164,11 +175,46 @@
|
||||
dat += "Crafting in progress...</div>"
|
||||
else
|
||||
for(var/datum/table_recipe/R in table_recipes)
|
||||
var/name_text = ""
|
||||
var/req_text = ""
|
||||
var/tool_text = ""
|
||||
var/catalist_text = ""
|
||||
if(check_contents(R))
|
||||
dat += "<A href='?src=\ref[src];make=\ref[R]'>[R.name]</A><BR>"
|
||||
name_text ="<A href='?src=\ref[src];make=\ref[R]'>[R.name]</A>"
|
||||
|
||||
else if(partial_check_contents(R))
|
||||
name_text = "<span class='linkOff'>[R.name]</span>"
|
||||
|
||||
if(name_text)
|
||||
for(var/A in R.reqs)
|
||||
if(ispath(A, /obj))
|
||||
var/obj/O = new A
|
||||
req_text += " [R.reqs[A]] [O.name]"
|
||||
qdel(O)
|
||||
if(ispath(A, /datum/reagent))
|
||||
var/datum/reagent/RE = new A
|
||||
req_text += " [R.reqs[A]] [RE.name]"
|
||||
qdel(RE)
|
||||
|
||||
if(R.chem_catalysts.len)
|
||||
catalist_text += ", Catalysts:"
|
||||
for(var/C in R.chem_catalysts)
|
||||
if(ispath(C, /datum/reagent))
|
||||
var/datum/reagent/RE = new C
|
||||
catalist_text += " [R.chem_catalysts[C]] [RE.name]"
|
||||
qdel(RE)
|
||||
if(R.tools.len)
|
||||
tool_text += ", Tools:"
|
||||
for(var/O in R.tools)
|
||||
if(ispath(O, /obj))
|
||||
var/obj/T = new O
|
||||
tool_text += " [R.tools[O]] [T.name]"
|
||||
qdel(T)
|
||||
|
||||
dat += "[name_text][req_text][tool_text][catalist_text]<BR>"
|
||||
dat += "</div>"
|
||||
|
||||
var/datum/browser/popup = new(user, "table", "Table", 300, 300)
|
||||
var/datum/browser/popup = new(user, "table", "Table", 500, 500)
|
||||
popup.set_content(dat)
|
||||
popup.open()
|
||||
return
|
||||
|
||||
@@ -52,7 +52,7 @@
|
||||
name = "Not a sandwich"
|
||||
reqs = list(
|
||||
/obj/item/weapon/reagent_containers/food/snacks/breadslice/plain = 2,
|
||||
/obj/item/clothing/mask/fakemoustache
|
||||
/obj/item/clothing/mask/fakemoustache = 1
|
||||
)
|
||||
result = /obj/item/weapon/reagent_containers/food/snacks/notasandwich
|
||||
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
author: phil235
|
||||
|
||||
delete-after: True
|
||||
|
||||
changes:
|
||||
- rscadd: "The tablecrafting window now also shows partial recipes in grey, if there's some of the things required for the recipe on the table. Recipe requirements are now also shown next to the names of recipes listed in the window."
|
||||
Reference in New Issue
Block a user