Skip to content
This repository has been archived by the owner on Jan 28, 2023. It is now read-only.

Commit

Permalink
Basically functional. Flaws:
Browse files Browse the repository at this point in the history
No step icons
Previously completed steps still shown
Items arent unequipped properly when consumed
Surface crafting still unimplemented

passive craftinguntested
  • Loading branch information
NanakoAC committed Jul 14, 2019
1 parent 639fb28 commit 41ce373
Show file tree
Hide file tree
Showing 10 changed files with 61 additions and 18 deletions.
1 change: 1 addition & 0 deletions baystation12.dme
Original file line number Diff line number Diff line change
Expand Up @@ -1010,6 +1010,7 @@
#include "code\game\objects\items\weapons\tools\tape.dm"
#include "code\game\objects\items\weapons\tools\weldingtools.dm"
#include "code\game\objects\items\weapons\tools\wirecutters.dm"
#include "code\game\objects\items\weapons\tools\workbench.dm"
#include "code\game\objects\items\weapons\tools\wrenches.dm"
#include "code\game\objects\items\weapons\tools\mods\_upgrades.dm"
#include "code\game\objects\items\weapons\tools\mods\mod_types.dm"
Expand Down
6 changes: 3 additions & 3 deletions code/__defines/craft.dm
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#define CRAFT_ONE_PER_TURF 1
#define CRAFT_ON_FLOOR 2

#define CRAFT_ONE_PER_TURF 1
#define CRAFT_ON_FLOOR 2
#define CRAFT_ON_SURFACE 3



Expand Down
2 changes: 2 additions & 0 deletions code/datums/craft/menu.dm
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@
"ref" = "\ref[CR]",
"desc" = CR.get_description(),
)
var/list/temp = data["cur_item"]
world << "[temp["icon"]]"
var/list/items = list()
for(var/datum/craft_recipe/recipe in SScraft.categories[curr_category])
items += list(list(
Expand Down
5 changes: 1 addition & 4 deletions code/datums/craft/recipe.dm
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,11 @@
user.put_in_hands(M)


/datum/craft_recipe/proc/get_description(pass_steps)
/datum/craft_recipe/proc/get_description()
. = list()
var/atom/A = result
.+="[initial(A.desc)]<br>"
for(var/item in steps)
if(pass_steps > 0)
--pass_steps
continue
var/datum/craft_step/CS = item
. += CS.desc
return jointext(., "<br>")
Expand Down
19 changes: 16 additions & 3 deletions code/datums/craft/recipes/weapon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@
result = /obj/item/weapon/flamethrower
steps = list(
list(CRAFT_OBJECT, /obj/item/weapon/tool/weldingtool, "time" = 60),
list(QUALITY_SCREW_DRIVING, 10, 70),
list(CRAFT_TOOL, QUALITY_SCREW_DRIVING, 10, 70),
list(CRAFT_OBJECT, /obj/item/device/assembly/igniter,),
)

Expand All @@ -97,8 +97,21 @@
result = /obj/item/weapon/beartrap/makeshift
steps = list(
list(CRAFT_OBJECT, /obj/item/weapon/tool/saw, "time" = 120),
list(QUALITY_SCREW_DRIVING, 10, 70),
list(CRAFT_TOOL, QUALITY_SCREW_DRIVING, 10, 70),
list(CRAFT_MATERIAL, MATERIAL_STEEL, 20),
list(QUALITY_BOLT_TURNING, 10, 70),
list(CRAFT_TOOL, QUALITY_BOLT_TURNING, 10, 70),
list(CRAFT_STACK, /obj/item/stack/cable_coil, 2, "time" = 10)
)


/datum/craft_recipe/weapon/ripper
name = "RC-DS Remote Control Disc Ripper"
result = /obj/item/weapon/gun/projectile/ripper
passive_steps = list(CRAFT_PASSIVE, QUALITY_WORKBENCH, 1, 0)
time = 100
steps = list(
list(CRAFT_OBJECT, /obj/item/weapon/tool/wrench),
list(CRAFT_OBJECT, /obj/item/weapon/stock_parts/matter_bin),
list(CRAFT_STACK, /obj/item/stack/cable_coil, 5),
list(CRAFT_STACK, /obj/item/stack/power_node, 1)
)
15 changes: 9 additions & 6 deletions code/datums/craft/step_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,11 @@
if (noconsume)
.=..()
else if (I && target)
I.forceMove(target) //The item will be deleted along with the craft object later, when all steps are complete
//In the meantime, it can be recovered if crafting is cancelled
if (user)
user.unEquip(I, target)
if (I.loc != target)
I.forceMove(target) //The item will be deleted along with the craft object later, when all steps are complete
//In the meantime, it can be recovered if crafting is cancelled

//We don't call parent and thus don't consume resources

Expand Down Expand Up @@ -112,7 +115,7 @@

var/material/M = get_material_by_name("[required_material]")
icon_type = M.stack_type
if (required_quantity > 1)
if (required_quantity <= 1)
desc = "Apply [M.display_name]"
else
desc = "Apply [required_quantity] units of [M.display_name]"
Expand Down Expand Up @@ -190,8 +193,8 @@


//Now setting the name and desc
var/var/obj/I = required_type
var/name = initial(I.name)
var/var/obj/item/stack/I = required_type
var/name = (required_quantity > 1?initial(I.name):initial(I.singular_name))

if (required_quantity > 1)
desc = "Apply [name]"
Expand Down Expand Up @@ -338,7 +341,7 @@
if (params.len >= 3)
required_level = params[3]
if (params.len >= 4 && isnum(params[4]))
required_level = params[4]
apply_range = params[4]

desc = "Requires a nearby [required_quality]."

Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/stacks/power_node.dm
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
/obj/item/stack/power_node
name = "power nodes"
desc = "It seems to radiating a lot of energy."
singular_name = "node"
singular_name = "power node"
icon = 'icons/obj/tools.dmi'
icon_state = "powernode"
w_class = ITEM_SIZE_SMALL
Expand Down
15 changes: 15 additions & 0 deletions code/game/objects/items/weapons/tools/workbench.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
//A workbench for upgrading things
/obj/structure/table/workbench
name = "Nanocircuit Repair Bench"
tool_qualities = list(QUALITY_WORKBENCH = 1)
icon = 'icons/obj/machines/research.dmi'
icon_state = "deadspace_workbench"
standalone = TRUE //No connecting, uses its own icon
can_plate = FALSE


//Quick ways to open crafting menu at this workbench
/obj/structure/table/workbench/AltClick(var/mob/user)
if (isliving(user))
var/mob/living/L = user
L.open_craft_menu()
1 change: 0 additions & 1 deletion code/modules/client/asset_cache.dm
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,6 @@ var/decl/asset_cache/asset_cache = new()

for(var/datum/craft_step/CS in CR.steps)
if(CS.icon_type)
world << "Making icon [CS.icon_type] for [CS] in [CR]"
var/filename = sanitizeFileName("[CS.icon_type].png")
var/icon/I = getFlatTypeIcon(CS.icon_type)
register_asset(filename, I)
Expand Down
13 changes: 13 additions & 0 deletions code/modules/tables/tables.dm
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@
var/material/material = null
var/material/reinforced = null

//If true, ignores connecting and dynamic icon behaviour. Useful for things that you want to be table-like surfaces but without wierdness
var/standalone = FALSE

// Gambling tables. I'd prefer reinforced with carpet/felt/cloth/whatever, but AFAIK it's either harder or impossible to get /obj/item/stack/material of those.
// Convert if/when you can easily get stacks of these.
var/carpeted = 0
Expand Down Expand Up @@ -292,6 +295,11 @@
return shards

/obj/structure/table/update_icon()
//No fancy icon behaviour
if (standalone)
overlays.Cut()
return

if(flipped != 1)
icon_state = "blank"
overlays.Cut()
Expand Down Expand Up @@ -364,6 +372,11 @@

// set propagate if you're updating a table that should update tables around it too, for example if it's a new table or something important has changed (like material).
/obj/structure/table/update_connections(propagate=0)
//No connections to anything
if (standalone)
connections = list("0", "0", "0", "0")
return

if(!material)
connections = list("0", "0", "0", "0")

Expand Down

0 comments on commit 41ce373

Please sign in to comment.