Skip to content

Commit c90cba5

Browse files
committed
Keep track of version number
1 parent f95f9f2 commit c90cba5

File tree

2 files changed

+181
-178
lines changed

2 files changed

+181
-178
lines changed

README.md

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,38 +1,38 @@
1-
# Customizable Crafting Table
2-
This is a simple, yet highly customizable crafting table made to work with all gamemodes. The workshop version can be found [here.](https://steamcommunity.com/sharedfiles/filedetails/?id=1793133869)
3-
4-
# Features
5-
- Not hard coded to accept specific entities like other crafting systems.
6-
- Accepts any entity as an ingredient and/or craftable item. (As long as the item is configured correctly.)
7-
- Allows for an infinite amount of new items to be added.
8-
- Button that allows players to manually remove ingredients from the table.
9-
- Extra ingredients leftover after crafting an item stay in the table for another use.
10-
- Customizable sounds, UI colors, table appearance, table health, and item spawn function. Some elements such as sounds, table appearance, and table health can be customized in-game as long as you're a superadmin.
11-
- Comes with HL2 and DarkRP weapon support by default.
12-
- Comes with rock and tree entities that players can mine with a crowbar to obtain crafting ingredients.
13-
- Category support for large amounts of items.
14-
- Icons next to each recipe to let the player know if it's able to be crafted, close to having enough materials to be crafted, or can't be crafted.
15-
- Developer functions to help addon and server developers integrate their own systems with this one. You can find more info about that [here.](https://github.com/LambdaGaming/Crafting_System/blob/master/dev.md)
16-
- Automation option that allows users to tell the table to repeatedly craft a certain item as long as it has enough ingredients.
17-
18-
# Other Versions
19-
I've made other versions of this addon with special features for specific servers. If you're looking for a specific feature that this version doesn't have, one of these versions might have it. Please note that I do not give any support for these versions.
20-
- [Blueprint Version](https://github.com/LambdaGaming/CityRP/tree/master/addons/Crafting_System) - Requires players to place a blueprint of the specified crafting item near the table before being able to craft said item. Items can also be configured to not require a blueprint so it can be crafted like normal.
21-
- [Table Type Version](https://github.com/LambdaGaming/Half-Life-Universe-RP/tree/master/addons/Crafting%20System) - Allows developers to make more than one table with different items. Useful if you want a separate item list for different teams.
22-
23-
# FAQs
24-
## How do I craft an item?
25-
Simply touch the required ingredients with the table and it will accept it. After all of the required items are in the table, click the craft items button and select the item you want to craft, then press the craft button and your item will spawn below the table.
26-
27-
## How do I create new items or customize the table?
28-
To create new items, download or clone this repository, go to `lua/entities/crafting_table`, open the shared.lua file, and follow the instructions from there. To customize the table, go to `lua/autorun`, open the craft_config.lua file, and follow the instructions from there. Please note that the workshop version does not support custom items and only supports a handful of table customization options in-game.
29-
30-
## Why do rocks/trees spawn invisible after a map change?
31-
This can happen when you save rocks or trees with a perma prop system that saves an entity's color data. If the server shuts down or changes levels while a rock or tree is in it's "mined" state, the entity can become permanently stuck like that. You can prevent this by using a more simplistic perma-prop system that doesn't save this data, or by writing a script that spawns rocks/trees at hard-coded coordinates.
32-
It's also possible for this to happen if you set a custom model for rocks/trees that is either invalid or corrupted.
33-
34-
## Will you help me with [thing I want to do]?
35-
If you are having issues changing values in the config or creating new items, I will guide you through the process. I will NOT generate whole configs for you, or help you make a customized version of the addon to suit your needs. If you want a more advanced level of customization that exceeds what is possible with the default configs, you will have to do it yourself.
36-
37-
# Issues & Pull Requests
38-
If you would like to contribute to this repository by creating an issue or pull request, please refer to the [contributing guidelines.](https://lambdagaming.github.io/contributing.html)
1+
# Universal Crafting System
2+
This is a simple, yet highly customizable crafting table made to work with all gamemodes. The workshop version can be found [here.](https://steamcommunity.com/sharedfiles/filedetails/?id=1793133869)
3+
4+
# Features
5+
- Not hard coded to accept specific entities like other crafting systems.
6+
- Accepts any entity as an ingredient and/or craftable item. (As long as the item is configured correctly.)
7+
- Allows for an infinite amount of new items to be added.
8+
- Button that allows players to manually remove ingredients from the table.
9+
- Extra ingredients leftover after crafting an item stay in the table for another use.
10+
- Customizable sounds, UI colors, table appearance, table health, and item spawn function. Some elements such as sounds, table appearance, and table health can be customized in-game as long as you're a superadmin.
11+
- Comes with HL2 and DarkRP weapon support by default.
12+
- Comes with rock and tree entities that players can mine with a crowbar to obtain crafting ingredients.
13+
- Category support for large amounts of items.
14+
- Icons next to each recipe to let the player know if it's able to be crafted, close to having enough materials to be crafted, or can't be crafted.
15+
- Developer functions to help addon and server developers integrate their own systems with this one. You can find more info about that [here.](https://github.com/LambdaGaming/Crafting_System/blob/master/dev.md)
16+
- Automation option that allows users to tell the table to repeatedly craft a certain item as long as it has enough ingredients.
17+
18+
# Other Versions
19+
I've made other versions of this addon with special features for specific servers. If you're looking for a specific feature that this version doesn't have, one of these versions might have it. Please note that I do not give any support for these versions.
20+
- [Blueprint Version](https://github.com/LambdaGaming/CityRP/tree/master/addons/Crafting_System) - Requires players to place a blueprint of the specified crafting item near the table before being able to craft said item. Items can also be configured to not require a blueprint so it can be crafted like normal.
21+
- [Table Type Version](https://github.com/LambdaGaming/Half-Life-Universe-RP/tree/master/addons/Crafting%20System) - Allows developers to make more than one table with different items. Useful if you want a separate item list for different teams.
22+
23+
# FAQs
24+
## How do I craft an item?
25+
Simply touch the required ingredients with the table and it will accept it. After all of the required items are in the table, click the craft items button and select the item you want to craft, then press the craft button and your item will spawn below the table.
26+
27+
## How do I create new items or customize the table?
28+
To create new items, download or clone this repository, go to `lua/entities/crafting_table`, open the shared.lua file, and follow the instructions from there. To customize the table, go to `lua/autorun`, open the craft_config.lua file, and follow the instructions from there. Please note that the workshop version does not support custom items and only supports a handful of table customization options in-game.
29+
30+
## Why do rocks/trees spawn invisible after a map change?
31+
This can happen when you save rocks or trees with a perma prop system that saves an entity's color data. If the server shuts down or changes levels while a rock or tree is in it's "mined" state, the entity can become permanently stuck like that. You can prevent this by using a more simplistic perma-prop system that doesn't save this data, or by writing a script that spawns rocks/trees at hard-coded coordinates.
32+
It's also possible for this to happen if you set a custom model for rocks/trees that is either invalid or corrupted.
33+
34+
## Will you help me with [thing I want to do]?
35+
If you are having issues changing values in the config or creating new items, I will guide you through the process. I will NOT generate whole configs for you, or help you make a customized version of the addon to suit your needs. If you want a more advanced level of customization that exceeds what is possible with the default configs, you will have to do it yourself.
36+
37+
# Issues & Pull Requests
38+
If you would like to contribute to this repository by creating an issue or pull request, please refer to the [contributing guidelines.](https://lambdagaming.github.io/contributing.html)

lua/autorun/craft_config.lua

Lines changed: 143 additions & 140 deletions
Original file line numberDiff line numberDiff line change
@@ -1,140 +1,143 @@
1-
--Customize your crafting table here. Each constant has a comment above it to tell you what it does.
2-
3-
--[[
4-
NOTE: Some of the table customizations have been moved to ConVars, meaning you can change them through the server console or spawn menu.
5-
Below are the customizations that are configurable through ConVars by default. If you want to configure everything through this file,
6-
uncomment the lines below.
7-
--]]
8-
9-
--Health of the table
10-
--CRAFT_CONFIG_MAX_HEALTH = 100
11-
12-
--Model of the table
13-
--CRAFT_CONFIG_MODEL = "models/props_wasteland/controlroom_desk001b.mdl"
14-
15-
--Material of the table, leave as an empty string if you want to keep the default model texture
16-
--CRAFT_CONFIG_MATERIAL = ""
17-
18-
--Sound that plays when an item is placed on the table
19-
--CRAFT_CONFIG_PLACE_SOUND = "physics/metal/metal_solid_impact_hard1.wav"
20-
21-
--Sound that plays when an item is crafted
22-
--CRAFT_CONFIG_CRAFT_SOUND = "ambient/machines/catapult_throw.wav"
23-
24-
--Sound that plays when a button is pressed in the menu
25-
--CRAFT_CONFIG_UI_SOUND = "ui/buttonclickrelease.wav"
26-
27-
--Sound that plays when an item is selected
28-
--CRAFT_CONFIG_SELECT_SOUND = "buttons/lightswitch2.wav"
29-
30-
--Sound that plays when crafting fails
31-
--CRAFT_CONFIG_FAIL_SOUND = "buttons/button2.wav"
32-
33-
--Sound that plays when an ingredient is manually removed from the table
34-
--CRAFT_CONFIG_DROP_SOUND = "physics/metal/metal_canister_impact_soft1.wav"
35-
36-
--Sound that plays when the table is destroyed, only plays when the explosion is disabled, you don't need to have math.random, I only added that for variety
37-
--CRAFT_CONFIG_DESTROY_SOUND = "physics/metal/metal_box_break"..math.random( 1, 2 )..".wav"
38-
39-
--Whether or not the table should explode when its health reaches 0
40-
--CRAFT_CONFIG_SHOULD_EXPLODE = true
41-
42-
--Health of the trees
43-
--CRAFT_CONFIG_TREE_HEALTH = 100
44-
45-
--How long in seconds it takes for a tree to respawn
46-
--CRAFT_CONFIG_TREE_RESPAWN = 300
47-
48-
--Minimum number of entities that can be mined from a rock or tree
49-
--CRAFT_CONFIG_MIN_SPAWN = 2
50-
51-
--Maximum number of entities that can be mined from a rock or tree
52-
--CRAFT_CONFIG_MAX_SPAWN = 6
53-
54-
--Health of the rocks
55-
--CRAFT_CONFIG_ROCK_HEALTH = 100
56-
57-
--How long in seconds it takes for a rock to respawn
58-
--CRAFT_CONFIG_ROCK_RESPAWN = 300
59-
60-
--Whether or not players should be allowed to use the automation feature
61-
--CRAFT_CONFIG_ALLOW_AUTOMATION = true
62-
63-
--The time it takes in seconds for the table to complete an automation process
64-
--CRAFT_CONFIG_AUTOMATION_TIME = 120
65-
66-
--Max range in hammer units that the player can be away from the table to get automation messages. Set to 0 for infinite
67-
--CRAFT_CONFIG_AUTOMATION_MESSAGE_RANGE = 0
68-
69-
70-
--[[
71-
NOTE: Below are all of the customizations that don't have ConVar counterparts. Commenting out these lines will cause errors.
72-
]]
73-
74-
--Color of the table, default is white (which means no change)
75-
CRAFT_CONFIG_COLOR = color_white --Using a global for optimization, you can also use Color()
76-
77-
--Color of the menu background
78-
CRAFT_CONFIG_MENU_COLOR = Color( 49, 53, 61, 200 )
79-
80-
--Color of the buttons
81-
CRAFT_CONFIG_BUTTON_COLOR = Color( 230, 93, 80, 255 )
82-
83-
--Color of the button text if all required ingredients are on the table
84-
CRAFT_CONFIG_BUTTON_TEXT_COLOR = color_white
85-
86-
--List of models the rocks can have
87-
CRAFT_CONFIG_ROCK_MODELS = {
88-
"models/props_debris/barricade_short01a.mdl",
89-
"models/props_debris/barricade_short02a.mdl",
90-
"models/props_debris/barricade_tall01a.mdl"
91-
}
92-
93-
--List of entities that can be dropped from mining a rock
94-
CRAFT_CONFIG_ROCK_INGREDIENTS = {
95-
{ "iron", 100 } --First entry is the entity name, second entry is the chance it has of spawning from 1 to 100
96-
}
97-
98-
--List of models the trees can have
99-
CRAFT_CONFIG_TREE_MODELS = {
100-
"models/props_foliage/tree_deciduous_01a-lod.mdl",
101-
"models/props_foliage/tree_poplar_01.mdl"
102-
}
103-
104-
--List of entities that can be dropped from mining a tree
105-
CRAFT_CONFIG_TREE_INGREDIENTS = {
106-
{ "wood", 100 }
107-
}
108-
109-
--List of allowed weapons to be used to mine trees
110-
CRAFT_CONFIG_MINE_WHITELIST_TREE = {
111-
["weapon_crowbar"] = true
112-
}
113-
114-
--Same as above but for rocks
115-
CRAFT_CONFIG_MINE_WHITELIST_ROCK = {
116-
["weapon_crowbar"] = true
117-
}
118-
119-
--Specify weapons to deal specific damage to rocks and trees. Any weapons listed here must be in one of the whitelists to work.
120-
--Any weapons not listed here but are in the whitelist will assume their default damage values
121-
CRAFT_CONFIG_MINE_DAMAGE_OVERRIDE = {
122-
["weapon_crowbar"] = 5
123-
}
124-
125-
126-
--Don't touch anything below this line unless you know what you're doing
127-
128-
--Function to see if part of the entity is outside of the world, not just it's origin
129-
--Only accurate on models with simple geometry
130-
function util.IsAllInWorld( ent )
131-
if IsValid( ent ) and IsEntity( ent ) then
132-
local inworld = ent:IsInWorld()
133-
local vec1, vec2 = ent:GetCollisionBounds()
134-
local realvec1, realvec2 = ent:WorldToLocal( vec1 ), ent:WorldToLocal( vec2 )
135-
if inworld and util.IsInWorld( realvec1 ) and util.IsInWorld( realvec2 ) then
136-
return true
137-
end
138-
end
139-
return false
140-
end
1+
--Customize your crafting table here. Each constant has a comment above it to tell you what it does.
2+
3+
--[[
4+
NOTE: Some of the table customizations have been moved to ConVars, meaning you can change them through the server console or spawn menu.
5+
Below are the customizations that are configurable through ConVars by default. If you want to configure everything through this file,
6+
uncomment the lines below.
7+
--]]
8+
9+
--Health of the table
10+
--CRAFT_CONFIG_MAX_HEALTH = 100
11+
12+
--Model of the table
13+
--CRAFT_CONFIG_MODEL = "models/props_wasteland/controlroom_desk001b.mdl"
14+
15+
--Material of the table, leave as an empty string if you want to keep the default model texture
16+
--CRAFT_CONFIG_MATERIAL = ""
17+
18+
--Sound that plays when an item is placed on the table
19+
--CRAFT_CONFIG_PLACE_SOUND = "physics/metal/metal_solid_impact_hard1.wav"
20+
21+
--Sound that plays when an item is crafted
22+
--CRAFT_CONFIG_CRAFT_SOUND = "ambient/machines/catapult_throw.wav"
23+
24+
--Sound that plays when a button is pressed in the menu
25+
--CRAFT_CONFIG_UI_SOUND = "ui/buttonclickrelease.wav"
26+
27+
--Sound that plays when an item is selected
28+
--CRAFT_CONFIG_SELECT_SOUND = "buttons/lightswitch2.wav"
29+
30+
--Sound that plays when crafting fails
31+
--CRAFT_CONFIG_FAIL_SOUND = "buttons/button2.wav"
32+
33+
--Sound that plays when an ingredient is manually removed from the table
34+
--CRAFT_CONFIG_DROP_SOUND = "physics/metal/metal_canister_impact_soft1.wav"
35+
36+
--Sound that plays when the table is destroyed, only plays when the explosion is disabled, you don't need to have math.random, I only added that for variety
37+
--CRAFT_CONFIG_DESTROY_SOUND = "physics/metal/metal_box_break"..math.random( 1, 2 )..".wav"
38+
39+
--Whether or not the table should explode when its health reaches 0
40+
--CRAFT_CONFIG_SHOULD_EXPLODE = true
41+
42+
--Health of the trees
43+
--CRAFT_CONFIG_TREE_HEALTH = 100
44+
45+
--How long in seconds it takes for a tree to respawn
46+
--CRAFT_CONFIG_TREE_RESPAWN = 300
47+
48+
--Minimum number of entities that can be mined from a rock or tree
49+
--CRAFT_CONFIG_MIN_SPAWN = 2
50+
51+
--Maximum number of entities that can be mined from a rock or tree
52+
--CRAFT_CONFIG_MAX_SPAWN = 6
53+
54+
--Health of the rocks
55+
--CRAFT_CONFIG_ROCK_HEALTH = 100
56+
57+
--How long in seconds it takes for a rock to respawn
58+
--CRAFT_CONFIG_ROCK_RESPAWN = 300
59+
60+
--Whether or not players should be allowed to use the automation feature
61+
--CRAFT_CONFIG_ALLOW_AUTOMATION = true
62+
63+
--The time it takes in seconds for the table to complete an automation process
64+
--CRAFT_CONFIG_AUTOMATION_TIME = 120
65+
66+
--Max range in hammer units that the player can be away from the table to get automation messages. Set to 0 for infinite
67+
--CRAFT_CONFIG_AUTOMATION_MESSAGE_RANGE = 0
68+
69+
70+
--[[
71+
NOTE: Below are all of the customizations that don't have ConVar counterparts. Commenting out these lines will cause errors.
72+
]]
73+
74+
--Color of the table, default is white (which means no change)
75+
CRAFT_CONFIG_COLOR = color_white --Using a global for optimization, you can also use Color()
76+
77+
--Color of the menu background
78+
CRAFT_CONFIG_MENU_COLOR = Color( 49, 53, 61, 200 )
79+
80+
--Color of the buttons
81+
CRAFT_CONFIG_BUTTON_COLOR = Color( 230, 93, 80, 255 )
82+
83+
--Color of the button text if all required ingredients are on the table
84+
CRAFT_CONFIG_BUTTON_TEXT_COLOR = color_white
85+
86+
--List of models the rocks can have
87+
CRAFT_CONFIG_ROCK_MODELS = {
88+
"models/props_debris/barricade_short01a.mdl",
89+
"models/props_debris/barricade_short02a.mdl",
90+
"models/props_debris/barricade_tall01a.mdl"
91+
}
92+
93+
--List of entities that can be dropped from mining a rock
94+
CRAFT_CONFIG_ROCK_INGREDIENTS = {
95+
{ "iron", 100 } --First entry is the entity name, second entry is the chance it has of spawning from 1 to 100
96+
}
97+
98+
--List of models the trees can have
99+
CRAFT_CONFIG_TREE_MODELS = {
100+
"models/props_foliage/tree_deciduous_01a-lod.mdl",
101+
"models/props_foliage/tree_poplar_01.mdl"
102+
}
103+
104+
--List of entities that can be dropped from mining a tree
105+
CRAFT_CONFIG_TREE_INGREDIENTS = {
106+
{ "wood", 100 }
107+
}
108+
109+
--List of allowed weapons to be used to mine trees
110+
CRAFT_CONFIG_MINE_WHITELIST_TREE = {
111+
["weapon_crowbar"] = true
112+
}
113+
114+
--Same as above but for rocks
115+
CRAFT_CONFIG_MINE_WHITELIST_ROCK = {
116+
["weapon_crowbar"] = true
117+
}
118+
119+
--Specify weapons to deal specific damage to rocks and trees. Any weapons listed here must be in one of the whitelists to work.
120+
--Any weapons not listed here but are in the whitelist will assume their default damage values
121+
CRAFT_CONFIG_MINE_DAMAGE_OVERRIDE = {
122+
["weapon_crowbar"] = 5
123+
}
124+
125+
126+
--Don't touch anything below this line unless you know what you're doing
127+
128+
--Function to see if part of the entity is outside of the world, not just it's origin
129+
--Only accurate on models with simple geometry
130+
function util.IsAllInWorld( ent )
131+
if IsValid( ent ) and IsEntity( ent ) then
132+
local inworld = ent:IsInWorld()
133+
local vec1, vec2 = ent:GetCollisionBounds()
134+
local realvec1, realvec2 = ent:WorldToLocal( vec1 ), ent:WorldToLocal( vec2 )
135+
if inworld and util.IsInWorld( realvec1 ) and util.IsInWorld( realvec2 ) then
136+
return true
137+
end
138+
end
139+
return false
140+
end
141+
142+
local version = "1.20.3"
143+
MsgC( Color( 0, 0, 255 ), "Universal Crafting System v"..version.." by OPGman successfully loaded.\n" )

0 commit comments

Comments
 (0)