Luis95R Posted August 6, 2016 Share Posted August 6, 2016 (edited) I'm currently working on a structure and when it comes to making it hauntable, I'm not sure which line to use. Does anyone know the difference between?: AddHauntableDropItemOrWork(inst) and MakeHauntableWork(inst) They both make the structure hauntable but I'm not sure if they cause a different thing to happen when haunting. Thank you. Edited August 6, 2016 by Luis95R Link to comment Share on other sites More sharing options...
DarkXero Posted August 6, 2016 Share Posted August 6, 2016 Those are functions defined in standardcomponents.lua. function MakeHauntableWork(inst, chance, cooldown, haunt_value) if not inst.components.hauntable then inst:AddComponent("hauntable") end inst.components.hauntable.cooldown = cooldown or TUNING.HAUNT_COOLDOWN_SMALL inst.components.hauntable:SetOnHauntFn(function(inst, haunter) --#HAUNTFIX --chance = chance or TUNING.HAUNT_CHANCE_OFTEN --if math.random() <= chance then --if inst.components.workable ~= nil and inst.components.workable:CanBeWorked() then --inst.components.hauntable.hauntvalue = haunt_value or TUNING.HAUNT_SMALL --inst.components.workable:WorkedBy(haunter, 1) --return true --end --end return false end) end function AddHauntableDropItemOrWork(inst) if not inst.components.hauntable then inst:AddComponent("hauntable") end inst.components.hauntable.cooldown = TUNING.HAUNT_COOLDOWN_SMALL inst.components.hauntable:SetOnHauntFn(function(inst, haunter) local ret = false --#HAUNTFIX --if math.random() <= TUNING.HAUNT_CHANCE_OCCASIONAL then --if inst.components.container then --local item = inst.components.container:FindItem(function(item) return not item:HasTag("nosteal") end) --if item then --inst.components.container:DropItem(item) --inst.components.hauntable.hauntvalue = TUNING.HAUNT_MEDIUM --ret = true --end --end --end --if math.random() <= TUNING.HAUNT_CHANCE_VERYRARE then --if inst.components.workable then --inst.components.workable:WorkedBy(haunter, 1) --inst.components.hauntable.hauntvalue = TUNING.HAUNT_MEDIUM --ret = true --end --end return ret end) end Since the effects are commented out, both do nothing. Ghosts will haunt stuff and just light them up. Link to comment Share on other sites More sharing options...
Luis95R Posted August 6, 2016 Author Share Posted August 6, 2016 Thank you for the reply DarkXero. This is the answer I was looking for. Link to comment 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