饥荒mod吧 关注:57,828贴子:235,543
  • 3回复贴,共1

求大神指导,为什么这个mod是

只看楼主收藏回复

求大神指导,为什么这个mod是无限耐久,俺小白一个,改了一堆都出错,求大神知道一下怎么弄成非无限耐久,这个一直100%,太影响游戏体验了。
local assets=
{
Asset("ANIM", "anim/wooden_club.zip"),
Asset("ANIM", "anim/swap_wooden_club.zip"),
Asset("ATLAS", "images/inventoryimages/wooden_club.xml"),
Asset("IMAGE", "images/inventoryimages/wooden_club.tex"),
}
local prefabs =
{
"large_bone",
}
local function OnAttack(inst, owner, target)
if target.components.health.currenthealth < 1 and target:HasTag("beefalo") then
local rnd = math.random(0,100)
if rnd < 16 then
target.components.lootdropper:SpawnLootPrefab('large_bone')
end
end
end
local function fn(colour)
local function OnEquip(inst, owner)
owner.AnimState:OverrideSymbol("swap_object", "swap_wooden_club", "wooden_club")
owner.AnimState:Show("ARM_carry")
owner.AnimState:Hide("ARM_normal")
end
local function onfinished(inst)
inst:Remove()
end
local function OnUnequip(inst, owner)
owner.AnimState:Hide("ARM_carry")
owner.AnimState:Show("ARM_normal")
end
local inst = CreateEntity()
local trans = inst.entity:AddTransform()
local anim = inst.entity:AddAnimState()
MakeInventoryPhysics(inst)
anim:SetBank("wooden_club")
anim:SetBuild("wooden_club")
anim:PlayAnimation("idle")
inst.entity:AddNetwork()
if not TheWorld.ismastersim then
return inst
end
inst.entity:SetPristine()
inst:AddComponent("lootdropper")
inst:AddTag("sharp")
inst:AddComponent("weapon")
inst.components.weapon:SetDamage(30)
inst.components.weapon.OnAttack = OnAttack
inst:AddComponent("finiteuses")
inst.components.finiteuses:SetMaxUses(50)
inst.components.finiteuses:SetUses(50)
inst.components.finiteuses:SetOnFinished( onfinished )
inst:AddComponent("inspectable")
inst:AddComponent("inventoryitem")
inst.components.inventoryitem.imagename = "wooden_club"
inst.components.inventoryitem.atlasname = "images/inventoryimages/wooden_club.xml"
inst:AddComponent("equippable")
inst.components.equippable:SetOnEquip( OnEquip )
inst.components.equippable:SetOnUnequip( OnUnequip )
return inst
end
return Prefab("common/inventory/wooden_club", fn, assets, prefabs)


IP属地:内蒙古来自Android客户端1楼2017-08-12 13:43回复







    IP属地:内蒙古来自Android客户端2楼2017-08-12 13:46
    回复
      小姐姐送给大神


      IP属地:内蒙古来自Android客户端3楼2017-08-12 13:47
      回复






        IP属地:内蒙古来自Android客户端4楼2017-08-12 13:49
        回复