RatherAzure Posted January 14, 2019 Share Posted January 14, 2019 (edited) so i've been trying to allow Willow to extinguish fires. basically exactly like how you'd be able to smother a fire with poop or ice but without the item. i've looked at how smothering and manualextinguishing works in actions.lua and componentactions.lua and attempted to create my own from there. but the option to extinguish does not show up ingame at all. AddAction("ACTIVEEXTINGUISH", "Extinguish", function(act) if act.target.components.burnable and act.target.components.burnable:IsBurning() then local smotherer = act.doer act.target.components.burnable:Extinguish(smotherer) return true end end) local function firefight(inst, doer, target, actions, right) if target:HasTag("fire") then table.insert(actions, ACTIONS.ACTIVEEXTINGUISH) end end AddComponentAction("SCENE", "firefighter", firefight) AddPrefabPostInit("willow", function(inst) inst:AddTag("firefighter") end) the firefighter component has nothing in it other than local Firefighter = Class(function(self, inst) self.inst = inst end) return Firefighter am i on the completely wrong track? anybody got any ideas? Edited January 15, 2019 by RatherAzure Link to comment Share on other sites More sharing options...
RatherAzure Posted January 17, 2019 Author Share Posted January 17, 2019 (edited) Okay so the problem you have here, is that you created a new component and then assigned it to the doer instead of the target. These components are to be added to the target and not the doer. And your new component is completely redundant, since you're targeting all prefabs with the component, "burnable". Why not just attach it to that instead? You're also missing the StategraphActionHandler for "wilson" and "wilson_client". Here's the code. ACTIVEEXTINGUISH_ACTION = AddAction("ACTIVEEXTINGUISH", "Extinguish", function(act) if act.doer:HasTag("player") and act.target.components.burnable and act.target.components.burnable:IsBurning() and act.target:HasTag("fire") then act.target.components.burnable:Extinguish(true, GLOBAL.TUNING.SMOTHERER_EXTINGUISH_HEAT_PERCENT) return true else return false end end) ACTIVEEXTINGUISH_ACTION.priority = 10 AddComponentAction("SCENE", "burnable", function(inst, doer, actions, right) if inst.prefab and inst.components.burnable and inst.components.burnable:IsBurning() and inst:HasTag("fire") and doer.prefab == "willow" then table.insert(actions, GLOBAL.ACTIONS.ACTIVEEXTINGUISH) end end) AddStategraphActionHandler("wilson", GLOBAL.ActionHandler(GLOBAL.ACTIONS.ACTIVEEXTINGUISH, "dolongaction")) AddStategraphActionHandler("wilson_client", GLOBAL.ActionHandler(GLOBAL.ACTIONS.ACTIVEEXTINGUISH, "dolongaction")) Just for the record: AddAction defines what happens when you perform the action. AddComponentAction defines when you should be able to perform the action. AddStategraphActionHandler defines what animation should be used when you perform the action. Edited January 17, 2019 by RatherAzure incorrect code 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