Pop Guy Posted May 11, 2025 Share Posted May 11, 2025 (edited) Hi! For a few days I've been trying to get the new iron, cobalt and tungsten ores to be stolen by moles and fall into the water when they end up in the sea. NOTHING, despite all my attempts, I can't get these three new ores to interact with the game world as I would like. If some kind soul could check the files and tell me what I did wrong... Iron and cobalt: function MakeOre(name) local fname = "ore_"..name local bank = fname local build = fname local assets= {--[[ASSETS]] Asset("ANIM", "anim/"..fname..".zip"), } local function shine(inst) inst.task = nil inst.AnimState:PlayAnimation("sparkle") inst.AnimState:PushAnimation("idle") inst.task = inst:DoTaskInTime(4 + math.random() * 5, shine) end local function ore() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst.entity:AddSoundEmitter() inst:AddTag("stone") inst:AddTag("rocks") inst:AddTag("molebait") inst:AddTag("molebait_any") inst:AddTag("cattoy") inst:AddTag("aquatic_sink") inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end inst:DoTaskInTime(0, function(inst) local x, y, z = inst.Transform:GetWorldPosition() if TheWorld.Map:IsOceanAtPoint(x, 0, z) then SpawnPrefab("splash_sink").Transform:SetPosition(x, y, z) inst:Remove() end end) -- Tradable inst:AddComponent("tradable") -- Edible inst:AddComponent("edible") inst.components.edible.foodtype = FOODTYPE.ELEMENTAL inst.components.edible.hungervalue = 5 inst.AnimState:SetRayTestOnBB(true); inst.AnimState:SetBank(bank) inst.AnimState:SetBuild(build) inst.AnimState:PlayAnimation("idle") inst:AddComponent("stackable") inst.components.stackable.maxsize = TUNING.STACK_SIZE_SMALLITEM inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst.components.inventoryitem.atlasname = "inventoryimages/"..fname..".xml" inst:AddComponent("repairer") MakeHauntableLaunchAndSmash(inst) shine(inst) return inst end return Prefab(fname, ore, assets) end return MakeOre("iron"), MakeOre("cobalt") Tungsten: local assets= { Asset("ANIM", "anim/tungstenore.zip"), Asset("ATLAS", "images/inventoryimages/tungstenore.xml"), Asset("IMAGE", "images/inventoryimages/tungstenore.tex") } local function shine(inst) inst.task = nil inst.AnimState:PlayAnimation("sparkle") inst.AnimState:PushAnimation("idle") inst.task = inst:DoTaskInTime(4 + math.random() * 5, shine) end local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddNetwork() MakeInventoryPhysics(inst) inst.entity:AddSoundEmitter() inst:AddTag("stone") inst:AddTag("rocks") inst:AddTag("molebait") inst:AddTag("molebait_any") inst:AddTag("cattoy") inst:AddTag("aquatic_sink") inst:AddTag("antlion_trinket") inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end inst:DoTaskInTime(0, function(inst) local x, y, z = inst.Transform:GetWorldPosition() if TheWorld.Map:IsOceanAtPoint(x, 0, z) then SpawnPrefab("splash_sink").Transform:SetPosition(x, y, z) inst:Remove() end end) -- Tradable inst:AddComponent("tradable") -- Edible inst:AddComponent("edible") inst.components.edible.foodtype = FOODTYPE.ELEMENTAL inst.components.edible.hungervalue = 15 inst.AnimState:SetRayTestOnBB(true); inst.AnimState:SetBank("flint") inst.AnimState:SetBuild("tungstenore") inst.AnimState:PlayAnimation("idle") inst:AddComponent("tradable") inst:AddComponent("stackable") inst.components.stackable.maxsize = TUNING.STACK_SIZE_SMALLITEM inst:AddComponent("inspectable") inst:AddComponent("inventoryitem") inst.components.inventoryitem.atlasname = "images/inventoryimages/tungstenore.xml" inst:AddComponent("repairer") inst.components.repairer.repairmaterial = "tungsten" inst.components.repairer.workrepairvalue = 1 inst.components.repairer.healthrepairvalue = 75 MakeHauntableLaunchAndSmash(inst) shine(inst) return inst end return Prefab("common/inventory/tungstenore", fn, assets) Edited May 11, 2025 by Pop Guy Link to comment https://forums.kleientertainment.com/forums/topic/165671-unsolvable-problem/ Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now