Jump to content

Recommended Posts

Hello guys!

I have problem with function called OverrideSymbol

I porting from DST character to DS and i don't know what is wrong with that

I have the code:

local function onuse(inst)	inst.AnimState:OverrideSymbol("swap_bedroll", "swap_bedroll_furry", "bedroll_furry")end

But i dont know why isn't work i need the fuction.

Thanks for help.

Of course, please

local assets ={	Asset("ANIM", "anim/swap_bedroll_furry.zip"),}--We don't watch "stopnight" because that would not work in a clock--without night phaselocal function wakeuptest(inst, phase)    if phase ~= "night" then        inst.components.sleepingbag:DoWakeUp()    endendlocal function wakeuptestnoc(inst, phase)    if phase ~= "day" then        inst.components.sleepingbag:DoWakeUp()    endendlocal function onwake(inst, sleeper, nostatechange)    if inst.sleeptask ~= nil then        inst.sleeptask:Cancel()        inst.sleeptask = nil    end	if sleeper:HasTag("player") and not sleeper:HasTag("nocturn") then		inst:StopWatchingWorldState("phase", wakeuptest)	end	if sleeper:HasTag("player") and sleeper:HasTag("nocturn") then		inst:StopWatchingWorldState("phase", wakeuptestnoc)	end    if not nostatechange then        sleeper.sg:GoToState("wakeup")    end    if inst.components.finiteuses ~= nil and inst.components.finiteuses:GetUses() <= 0 then        inst:Remove()        inst.persists = false    endendlocal function onsleeptick(inst, sleeper)    if sleeper.components.hunger ~= nil then        -- Check SGwilson, state "bedroll", if you change this value        sleeper.components.hunger:DoDelta(TUNING.SLEEP_HUNGER_PER_TICK, true, true)    end    if sleeper.components.sanity ~= nil and sleeper.components.sanity:GetPercentWithPenalty() < 1 then        sleeper.components.sanity:DoDelta(TUNING.SLEEP_SANITY_PER_TICK, true)     end    if sleeper.components.health ~= nil and (not sleeper.components.hunger or sleeper.components.hunger:GetPercent() > 0) then        sleeper.components.health:DoDelta(TUNING.SLEEP_HEALTH_PER_TICK, true, "bedroll", true)     end    if sleeper.components.temperature ~= nil then        sleeper.components.temperature:SetTemperature(sleeper.components.temperature:GetCurrent() + TUNING.SLEEP_TEMP_PER_TICK)    endendlocal function onsleep(inst, sleeper)    -- check if we're in an invalid period (i.e. daytime). if so: wakeup	if sleeper:HasTag("player") and sleeper:HasTag("nocturn") then    if phase ~= "day" then        inst.components.sleepingbag:DoWakeUp()    end	else		if phase ~= "night" then        inst.components.sleepingbag:DoWakeUp()		end	end    if inst.sleeptask ~= nil then        inst.sleeptask:Cancel()    end    inst.sleeptask = inst:DoPeriodicTask(TUNING.SLEEP_TICK_PERIOD, onsleeptick, nil, sleeper)endlocal function onuse(inst)	inst.AnimState:OverrideSymbol("swap_bedroll", "swap_bedroll_furry", "bedroll_furry")endlocal function fn()	local inst = CreateEntity()	inst.entity:AddTransform()	inst.entity:AddAnimState()    inst.entity:AddNetwork()    MakeInventoryPhysics(inst)    inst.AnimState:SetBank("swap_bedroll_furry")    inst.AnimState:SetBuild("swap_bedroll_furry")    inst.AnimState:PlayAnimation("idle")    if not TheWorld.ismastersim then        return inst    end    inst.entity:SetPristine()    inst:AddComponent("inspectable")    inst:AddComponent("inventoryitem")    inst:AddComponent("finiteuses")    inst.components.finiteuses:SetConsumption(ACTIONS.SLEEPIN, 1)    inst.components.finiteuses:SetMaxUses(3)    inst.components.finiteuses:SetUses(3)    inst:AddComponent("fuel")    inst.components.fuel.fuelvalue = TUNING.LARGE_FUEL	MakeSmallBurnable(inst, TUNING.LONG_BURNABLE)    MakeSmallPropagator(inst)    inst:AddComponent("sleepingbag")	inst.components.sleepingbag.onsleep = onsleep    inst.components.sleepingbag.onwake = onwake    inst.onuse = onuse    MakeHauntableLaunchAndIgnite(inst)    return instendreturn Prefab("common/inventory/bedroll_furry", fn, assets)

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...