mirror of
https://github.com/Mestima/wanda.git
synced 2025-05-03 13:40:15 +00:00
initial commit
This commit is contained in:
parent
1b168019d9
commit
c29915e87e
BIN
data/anim/pocketwatchbox.zip
Normal file
BIN
data/anim/pocketwatchbox.zip
Normal file
Binary file not shown.
BIN
data/anim/pocketwatchpack.zip
Normal file
BIN
data/anim/pocketwatchpack.zip
Normal file
Binary file not shown.
BIN
data/images/inventoryimages/pocketwatchbox.tex
Normal file
BIN
data/images/inventoryimages/pocketwatchbox.tex
Normal file
Binary file not shown.
1
data/images/inventoryimages/pocketwatchbox.xml
Normal file
1
data/images/inventoryimages/pocketwatchbox.xml
Normal file
@ -0,0 +1 @@
|
|||||||
|
<Atlas><Texture filename="pocketwatchbox.tex" /><Elements><Element name="pocketwatchbox.tex" u1="0.0078125" u2="0.9921875" v1="0.0078125" v2="0.9921875" /></Elements></Atlas>
|
BIN
data/images/inventoryimages/pocketwatchpack.tex
Normal file
BIN
data/images/inventoryimages/pocketwatchpack.tex
Normal file
Binary file not shown.
1
data/images/inventoryimages/pocketwatchpack.xml
Normal file
1
data/images/inventoryimages/pocketwatchpack.xml
Normal file
@ -0,0 +1 @@
|
|||||||
|
<Atlas><Texture filename="pocketwatchpack.tex" /><Elements><Element name="pocketwatchpack.tex" u1="0.0078125" u2="0.9921875" v1="0.0078125" v2="0.9921875" /></Elements></Atlas>
|
BIN
data/images/modicon_pocketwatchpack.tex
Normal file
BIN
data/images/modicon_pocketwatchpack.tex
Normal file
Binary file not shown.
1
data/images/modicon_pocketwatchpack.xml
Normal file
1
data/images/modicon_pocketwatchpack.xml
Normal file
@ -0,0 +1 @@
|
|||||||
|
<Atlas><Texture filename="modicon_pocketwatchpack.tex" /><Elements><Element name="modicon_pocketwatchpack.tex" u1="0.001953125" u2="0.748046875" v1="0.251953125" v2="0.998046875" /></Elements></Atlas>
|
38
data/modinfo.lua
Normal file
38
data/modinfo.lua
Normal file
@ -0,0 +1,38 @@
|
|||||||
|
name = "Wanda's pocket watch bag (advanced)"
|
||||||
|
description = "An advanced version of Wanda's pocket watch bag"
|
||||||
|
author = "非自然对数㏑x & Mestima"
|
||||||
|
version = "1.0.0"
|
||||||
|
|
||||||
|
forumthread = ""
|
||||||
|
|
||||||
|
api_version = 6
|
||||||
|
api_version_dst = 10
|
||||||
|
|
||||||
|
dst_compatible = true
|
||||||
|
|
||||||
|
dont_starve_compatible = false
|
||||||
|
reign_of_giants_compatible = false
|
||||||
|
shipwrecked_compatible = false
|
||||||
|
|
||||||
|
all_clients_require_mod = true
|
||||||
|
|
||||||
|
icon_atlas = "images/modicon_pocketwatchpack.xml"
|
||||||
|
icon = "modicon_pocketwatchpack.tex"
|
||||||
|
|
||||||
|
priority = 0
|
||||||
|
|
||||||
|
server_filter_tags = {"Wanda's bag"}
|
||||||
|
|
||||||
|
configuration_options = {
|
||||||
|
{
|
||||||
|
name = "lang",
|
||||||
|
label = "Language",
|
||||||
|
hover = "Choose a language",
|
||||||
|
options = {
|
||||||
|
{ description = "English", data = "eng" },
|
||||||
|
{ description = "Русский", data = "ru" },
|
||||||
|
{ description = "中文", data = "chi" },
|
||||||
|
},
|
||||||
|
default = "eng"
|
||||||
|
}
|
||||||
|
}
|
56
data/modmain.lua
Normal file
56
data/modmain.lua
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
GLOBAL.setmetatable(env,{__index=function(t,k) return GLOBAL.rawget(GLOBAL,k) end})
|
||||||
|
|
||||||
|
local function GetConfig(name, default)
|
||||||
|
local opt = GetModConfigData(name)
|
||||||
|
if (not opt) then
|
||||||
|
opt = default
|
||||||
|
end
|
||||||
|
if (type(opt) == "table") then
|
||||||
|
opt = opt.option_data
|
||||||
|
end
|
||||||
|
return opt
|
||||||
|
end
|
||||||
|
|
||||||
|
local lang = {
|
||||||
|
eng = {
|
||||||
|
name = "Watch bag",
|
||||||
|
desc = "A bag for your watch!",
|
||||||
|
insp = "It contains the power of shadows..."
|
||||||
|
},
|
||||||
|
ru = {
|
||||||
|
name = "Сумка с часами",
|
||||||
|
desc = "Сумка для всех Ваших часов!",
|
||||||
|
insp = "В ней сила теней..."
|
||||||
|
},
|
||||||
|
chi = {
|
||||||
|
name = "怀表工具袋",
|
||||||
|
desc = "收纳时间",
|
||||||
|
insp = "蕴含暗影的力量"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
local language = GetConfig("lang", "eng")
|
||||||
|
|
||||||
|
PrefabFiles = { "pocketwatchpack" }
|
||||||
|
Assets = {
|
||||||
|
Asset("ATLAS", "images/inventoryimages/pocketwatchpack.xml")
|
||||||
|
}
|
||||||
|
|
||||||
|
modimport("scripts/main/lnx_container.lua")
|
||||||
|
AddRecipe("pocketwatchpack",
|
||||||
|
{
|
||||||
|
Ingredient("pocketwatch_dismantler", 1),
|
||||||
|
Ingredient("livinglog", 2),
|
||||||
|
Ingredient("nightmarefuel", 2)
|
||||||
|
},
|
||||||
|
CUSTOM_RECIPETABS.CLOCKMAKER,
|
||||||
|
TECH.NONE,
|
||||||
|
nil, nil, nil, nil,
|
||||||
|
"clockmaker",
|
||||||
|
"images/inventoryimages/pocketwatchpack.xml",
|
||||||
|
"pocketwatchpack.tex"
|
||||||
|
)
|
||||||
|
|
||||||
|
STRINGS.NAMES.POCKETWATCHPACK = lang[language].name
|
||||||
|
STRINGS.RECIPE_DESC.POCKETWATCHPACK = lang[language].desc
|
||||||
|
STRINGS.CHARACTERS.GENERIC.DESCRIBE.POCKETWATCHPACK = lang[language].insp
|
45
data/scripts/main/lnx_container.lua
Normal file
45
data/scripts/main/lnx_container.lua
Normal file
@ -0,0 +1,45 @@
|
|||||||
|
local containers = require("containers")
|
||||||
|
|
||||||
|
local params = {
|
||||||
|
pocketwatchpack = {
|
||||||
|
widget = {
|
||||||
|
slotpos = {},
|
||||||
|
animbank = "ui_piggyback_2x6",
|
||||||
|
animbuild = "ui_piggyback_2x6",
|
||||||
|
pos = Vector3(-5, -50, 0)
|
||||||
|
},
|
||||||
|
issidewidget = true,
|
||||||
|
openlimit = 1,
|
||||||
|
type = "pack"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for y = 0, 5 do
|
||||||
|
table.insert(params.pocketwatchpack.widget.slotpos, Vector3(-162, -75 * y + 170, 0))
|
||||||
|
table.insert(params.pocketwatchpack.widget.slotpos, Vector3(-162 + 75, -75 * y + 170, 0))
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
function params.pocketwatchpack.itemtestfn(container, item, slot)
|
||||||
|
return (item:HasTag("pocketwatch") or (item.prefab == "pocketwatch_parts" or item.prefab == "pocketwatch_dismantler"))
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
for k, v in pairs(params) do
|
||||||
|
containers.MAXITEMSLOTS = math.max(containers.MAXITEMSLOTS, v.widget.slotpos and #v.widget.slotpos or 0)
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local containers_widgetsetup = containers.widgetsetup
|
||||||
|
|
||||||
|
function containers.widgetsetup(container, prefab, data)
|
||||||
|
local t = data or params[prefab or container.inst.prefab]
|
||||||
|
if t ~= nil then
|
||||||
|
for k, v in pairs(t) do
|
||||||
|
container[k] = v
|
||||||
|
end
|
||||||
|
container:SetNumSlots(container.widget.slotpos ~= nil and #container.widget.slotpos or 0)
|
||||||
|
else
|
||||||
|
return containers_widgetsetup(container, prefab, data)
|
||||||
|
end
|
||||||
|
end
|
69
data/scripts/prefabs/pocketwatchpack.lua
Normal file
69
data/scripts/prefabs/pocketwatchpack.lua
Normal file
@ -0,0 +1,69 @@
|
|||||||
|
local assets = {
|
||||||
|
Asset("ANIM", "anim/pocketwatchpack.zip"),
|
||||||
|
Asset("ATLAS", "images/inventoryimages/pocketwatchpack.xml")
|
||||||
|
}
|
||||||
|
|
||||||
|
local prefabs = {}
|
||||||
|
|
||||||
|
|
||||||
|
local function onopen(inst)
|
||||||
|
end
|
||||||
|
|
||||||
|
local function onclose(inst)
|
||||||
|
local owner = inst.components.inventoryitem.owner
|
||||||
|
if owner then
|
||||||
|
local container = owner.components.inventory:GetOverflowContainer()
|
||||||
|
if container then
|
||||||
|
container:Open(owner)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
|
||||||
|
local function ondropped(inst)
|
||||||
|
if inst.components.container then
|
||||||
|
inst.components.container:Close()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
local function fn()
|
||||||
|
local inst = CreateEntity()
|
||||||
|
inst.entity:AddTransform()
|
||||||
|
inst.entity:AddAnimState()
|
||||||
|
inst.entity:AddSoundEmitter()
|
||||||
|
inst.entity:AddNetwork()
|
||||||
|
|
||||||
|
MakeInventoryPhysics(inst)
|
||||||
|
|
||||||
|
inst.AnimState:SetBank("pocketwatchpack")
|
||||||
|
inst.AnimState:SetBuild("pocketwatchpack")
|
||||||
|
inst.AnimState:PlayAnimation("idle")
|
||||||
|
|
||||||
|
MakeInventoryFloatable(inst)
|
||||||
|
|
||||||
|
inst.entity:SetPristine()
|
||||||
|
|
||||||
|
if not TheWorld.ismastersim then
|
||||||
|
return inst
|
||||||
|
end
|
||||||
|
|
||||||
|
inst:AddComponent("inspectable")
|
||||||
|
|
||||||
|
inst:AddComponent("inventoryitem")
|
||||||
|
inst.components.inventoryitem.imagename = "pocketwatchpack"
|
||||||
|
inst.components.inventoryitem.atlasname = "images/inventoryimages/pocketwatchpack.xml"
|
||||||
|
inst.components.inventoryitem.canonlygoinpocket = true -- can't store a pocket watch bag into a backpack etc
|
||||||
|
inst.components.inventoryitem.keepondeath = true
|
||||||
|
inst.components.inventoryitem.keepondrown = true
|
||||||
|
inst.components.inventoryitem:SetOnDroppedFn(ondropped)
|
||||||
|
|
||||||
|
inst:AddComponent("container")
|
||||||
|
inst.components.container:WidgetSetup("pocketwatchpack")
|
||||||
|
--inst.components.container.onopenfn = onopen
|
||||||
|
inst.components.container.onclosefn = onclose
|
||||||
|
|
||||||
|
MakeHauntableLaunchAndDropFirstItem(inst)
|
||||||
|
|
||||||
|
return inst
|
||||||
|
end
|
||||||
|
|
||||||
|
return Prefab("pocketwatchpack", fn, assets, prefabs)
|
Loading…
x
Reference in New Issue
Block a user