-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
15 changed files
with
4,918 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
Hey mod developer! | ||
|
||
Your custom perks, spells, and materials should show up automatically. In the | ||
case of materials, the origin is only deduced correctly when | ||
`ModMaterialFilesGet()` is available. (Only on the beta at the time of writing | ||
this). | ||
|
||
Creatures and items use a hardcoded list. See the items.lua and | ||
creatures.lua file for the kind of data it contains. You can append to | ||
this list in your mod if you want your things to show up in Component Explorer. | ||
|
||
This is what that would look like: | ||
|
||
```lua | ||
-- File: mods/<your mod>/init.lua | ||
ModLuaFileAppend( | ||
"mods/component-explorer/spawn_data/creatures.lua", | ||
"mods/<your mod>/files/ce_creatures.lua" | ||
) | ||
``` | ||
|
||
```lua | ||
-- File: mods/<your mod>/files/ce_creatures.lua | ||
local creatures = dofile_once("mods/component-explorer/spawn_data/creatures.lua") | ||
|
||
table.insert(creatures, | ||
{ | ||
file="mods/<your mod>/files/animals/omega_hamis.xml", | ||
herd="spider", | ||
name="$animal_yourmod_omegahamis", | ||
origin="<Your Mod>", | ||
tags="mortal,teleportable_NOT,friend,hittable_NOT" | ||
}) | ||
``` | ||
|
||
After adding that code into your mod, the creature should show up inside | ||
Component Explorer. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
---@module 'component-explorer.utils.file_util' | ||
local file_util = dofile_once("mods/component-explorer/utils/file_util.lua") | ||
|
||
dofile_once("data/scripts/gun/gun_enums.lua") | ||
|
||
local function register_origins(origin) | ||
for _, action in ipairs(actions) do | ||
if action.origin == nil then | ||
action.origin = origin | ||
end | ||
end | ||
end | ||
|
||
local original_do_mod_appends = do_mod_appends | ||
do_mod_appends = function(appends_for) | ||
if appends_for == "data/scripts/gun/gun_actions.lua" then | ||
register_origins("Vanilla") | ||
else | ||
local mod_id = string.match(appends_for, "mods/([^/]*)") | ||
register_origins(mod_id or "Unknown") | ||
end | ||
|
||
original_do_mod_appends(appends_for) | ||
end | ||
dofile("data/scripts/gun/gun_actions.lua") | ||
do_mod_appends = original_do_mod_appends | ||
|
||
local actions = actions | ||
|
||
for _, action in ipairs(actions) do | ||
action.display_name = GameTextGetTranslatedOrNot(action.name) | ||
action.display_description = GameTextGetTranslatedOrNot(action.description) | ||
end | ||
|
||
local action_types = {} | ||
|
||
local gun_enums_source = file_util.ModTextFileGetContent("data/scripts/gun/gun_enums.lua") | ||
for k, v in string.gmatch(gun_enums_source, "ACTION_TYPE_([%w_]+)%s*=%s*(%d+)") do | ||
action_types[tonumber(v)] = k | ||
end | ||
|
||
local unique_action_types = {} | ||
for i=0,#action_types do | ||
table.insert(unique_action_types, action_types[i]) | ||
end | ||
|
||
---@param act integer | ||
---@return string | ||
local function action_type_to_name(act) | ||
return action_types[act] | ||
end | ||
|
||
return { | ||
actions=actions, | ||
unique_action_types=unique_action_types, | ||
action_type_to_name=action_type_to_name, | ||
} |
Oops, something went wrong.