Skip to content

Commit

Permalink
fix: custom items job requirement
Browse files Browse the repository at this point in the history
  • Loading branch information
igorsaux authored Sep 4, 2024
1 parent 87f2bfd commit 58a4540
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 8 deletions.
23 changes: 22 additions & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"env": {
"MODE": "dev",
"ONYXBAY__GENERAL__SERVER_ID": "test"
}
},
},
{
"type": "byond",
Expand All @@ -21,6 +21,27 @@
"MODE": "dev",
"ONYXBAY__GENERAL__SERVER_ID": "test"
},
},
{
"type": "byond",
"request": "launch",
"name": "DD Debug",
"dmb": "${workspaceFolder}/${command:CurrentDMB}",
"env": {
"MODE": "dev",
"ONYXBAY__GENERAL__SERVER_ID": "test"
}
},
{
"type": "byond",
"request": "launch",
"name": "Build & DD Debug",
"preLaunchTask": "dm: build - ${command:CurrentDME}",
"dmb": "${workspaceFolder}/${command:CurrentDMB}",
"env": {
"MODE": "dev",
"ONYXBAY__GENERAL__SERVER_ID": "test"
},
"dreamDaemon": true
},
{
Expand Down
10 changes: 4 additions & 6 deletions code/datums/configuration/custom_section.dm
Original file line number Diff line number Diff line change
Expand Up @@ -33,11 +33,9 @@
if(isnull(item_path))
util_crash_with("The given item path, [item_info["path"]], is invalid and does not exist.")

var/character_name = item_info["character_name"]
var/patreon_type = item_info["patreon_type"]
var/req_job = item_info["req_job"]
var/flags = item_info["flags"]
var/list/req_job = item_info["req_job"]
var/list/flags = item_info["flags"]

if(!isnull(req_job))
req_job = text2path(req_job)

items[ckey] += new /datum/custom_item(item_path, patreon_type, req_job, flags)
items[ckey] += new /datum/custom_item(character_name, item_path, patreon_type, req_job, flags)
8 changes: 7 additions & 1 deletion code/modules/customitems/item_spawning.dm
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,14 @@
// spawns, the list is checked and all appropriate datums are spawned.

/datum/custom_item
var/character_name
var/item_path
var/patreon_type
var/list/req_job
var/list/flags = list()

/datum/custom_item/New(item_path, patreon_type, req_job, flags)
/datum/custom_item/New(character_name, item_path, patreon_type, req_job, flags)
src.character_name = character_name
src.item_path = item_path
src.patreon_type = patreon_type
src.req_job = req_job
Expand Down Expand Up @@ -81,6 +83,10 @@
return

for(var/datum/custom_item/citem in key_list)
// Check for requisite character name.
if(lowertext(citem.character_name) != lowertext(M.real_name))
continue

// Check for required job title.
if(length(citem.req_job))
var/has_title
Expand Down

0 comments on commit 58a4540

Please sign in to comment.