Sign in to follow this  
. . .

[Solved] How to allow character to preform action on custom structure by clicking on it with a feather pencil?

Recommended Posts

. . .    4059

Hello, if someone can help me with this that would really help me out a lot since I have no idea what to do :)..

 

So, basically I want my structure to change it's appearance when action "On Drawn" or a if a feather pencil's used on it (the pencil wouldn't be consumed). Right now I'm using "drawable" component & seems that can't work without an item on the ground & still doesn't work even when there is one (which even if it did I don't want it like that)..

So the OnDrawnFn never gets called allowing my structure to change symbols :(..  Drawable component only works for minisign unfortunately :(..  

Here is code of my structure thing if somebody can help me out with this that'd be a huge help :D!!

 

Spoiler

local assets =
{
	Asset("ANIM", "anim/canvas.zip"),
	Asset("ANIM", "anim/canvas_art1.zip"),
}

local prefabs = 
{
}

SetSharedLootTable('canvas',
{
    {'boards',		1.00},
    {'papyrus',		1.00},
})

local function onbuilt(inst)
    inst.AnimState:PlayAnimation("idle")
	inst.SoundEmitter:PlaySound("dontstarve/common/sign_craft")
end

local function onhit(inst, worker)
    if not inst:HasTag("burnt") then
        inst.AnimState:PlayAnimation("hit")
        inst.AnimState:PushAnimation("idle", false)
    end
end

local function onhammered(inst, worker)
	if inst.components.burnable ~= nil and inst.components.burnable:IsBurning() then
		inst.components.burnable:Extinguish()
	end
    inst.components.lootdropper:DropLoot()
	local fx = SpawnPrefab("collapse_small")
    fx.Transform:SetPosition(inst.Transform:GetWorldPosition())
    fx:SetMaterial("wood")
    inst:Remove()
end

local function OnDrawnFn(inst, image, src)
    if inst.drawn0 == nil then
		inst.drawn0 = true
		inst.AnimState:OverrideSymbol("art", "canvas_art1", "art")
	else
		inst.drawn0 = nil
		Inst.AnimState:ClearOverrideSymbol("art")
	end
	inst.SoundEmitter:PlaySound("dontstarve/common/together/draw")
end


local function fn()
    local inst = CreateEntity()

    inst.entity:AddTransform()
    inst.entity:AddAnimState()
	inst.entity:AddSoundEmitter()
    inst.entity:AddMiniMapEntity()
    inst.entity:AddNetwork()
    inst.entity:AddLight()
	MakeObstaclePhysics(inst, 1.1)

	--inst.MiniMapEntity:SetPriority(5)
    --inst.MiniMapEntity:SetIcon(name..".png")

    inst.AnimState:SetBank("canvas")
    inst.AnimState:SetBuild("canvas")
    inst.AnimState:PlayAnimation("idle", true)
	
	inst:AddTag("structure")
	--drawable (from drawable component) added to pristine state for optimization
	inst:AddTag("drawable")

    inst.entity:SetPristine()
    --inst.Light:Enable(false)
    --inst.Light:SetRadius(0.9)
    --inst.Light:SetFalloff(0.4)
    --inst.Light:SetIntensity(.75)
    --inst.Light:SetColour(255 / 255, 255 / 255, 236 / 255)
    --inst.Light:EnableClientModulation(true)

    inst:ListenForEvent("onbuilt", onbuilt)

    if not TheWorld.ismastersim then
        return inst
    end
	
	inst.drawn0 = nil
	
    MakeLargeBurnable(inst)
    MakeMediumPropagator(inst)
	
    inst:AddComponent("inspectable")
    inst:AddComponent("lootdropper")
	--inst.components.lootdropper:SetChanceLootTable('canvas')

	inst:AddComponent("drawable")
	inst.components.drawable:SetOnDrawnFn(OnDrawnFn)

    inst:AddComponent("workable")
    inst.components.workable:SetWorkAction(ACTIONS.HAMMER)
    inst.components.workable:SetWorkLeft(6)
    inst.components.workable:SetOnFinishCallback(onhammered)
    inst.components.workable:SetOnWorkCallback(onhit)

	inst:AddComponent("hauntable")
	inst.components.hauntable:SetHauntValue(TUNING.HAUNT_TINY)

    return inst
end

return Prefab("canvas", fn, assets, prefabs), 
MakePlacer("canvas_placer", "canvas", "canvas", "idle", false, nil, nil, nil, 0, nil, nil)

 

 

Edited by SuperDavid

Share this post


Link to post
Share on other sites
. . .    4059
5 hours ago, Ricoom said:

you have't called components OnLoad function.

I'm sorry I just started with making things other than character mods so what does this mean, what is "components OnLoad function" mean?

 

5 hours ago, Ricoom said:

Take a look at the component and look how it works,

Okay, so the code in my structure is

inst.components.drawable:SetOnDrawnFn(OnDrawnFn)

what is supposed to happen I assume when something get successfully drawn on since the code doesn't work if the action failed.

I go in the drawable component it has

function Drawable:SetOnDrawnFn(fn)
    self.ondrawnfn = fn
end

which has "ondrawnfn = fn"? I have no idea what that means, in all of drawable.lua there is no code which checks for an object being on floor do allow the action to be preformed or not?

 

I keep looking at drawable.lua but I have no idea what to edit to allow my canvas to trigger SetOnDrawnFn, all I want is the player able to switch between a couple paintings by clicking on the structure with a feather pencil maybe making a custom action for that would be easier than editing drawable.lua?

 

Share this post


Link to post
Share on other sites
Ricoom    15

yes 

function Drawable:SetOnDrawnFn(fn)
    self.ondrawnfn = fn
end

it takes in a function that you have allready provided and sets it to variable that is how it works. fn is just function parameter. The point is that the function self.ondrawfn does not get called unless Drawable:OnDrawn is called. It seems that it is not done magically some where else.you have to invoke it yourself by calling OnDrawn function with parameters. Take a look how prefab minisign works. 

Share this post


Link to post
Share on other sites
. . .    4059

Okay I go in minisign.lua

Here's all reference to drawable component in it

Spoiler

local function ondeploy(inst, pt)--, deployer)
    local ent = SpawnPrefab("minisign")

    if inst.components.stackable ~= nil then
        inst.components.stackable:Get():Remove()
    else
        ent.components.drawable:OnDrawn(inst.components.drawable:GetImage())
        ent._imagename:set(inst._imagename:value())
        inst:Remove()
    end

    ent.Transform:SetPosition(pt:Get())
    ent.SoundEmitter:PlaySound("dontstarve/common/sign_craft")
end


local function dig_up(inst)--, worker)
    local image = inst.components.drawable:GetImage()
    if image ~= nil then
        local item = inst.components.lootdropper:SpawnLootPrefab("minisign_drawn")
        item.components.drawable:OnDrawn(image)
        item._imagename:set(inst._imagename:value())
    else
        inst.components.lootdropper:SpawnLootPrefab("minisign_item")
    end
    inst:Remove()
end

local function onignite(inst)
    DefaultBurnFn(inst)
    inst.components.drawable:SetCanDraw(false)
end

local function onextinguish(inst)
    DefaultExtinguishFn(inst)
    if inst.components.drawable:GetImage() == nil then
        inst.components.drawable:SetCanDraw(true)
    end
end






 

basically the drawable code in minisign.lua all has to do with setting a image for it, but my structure doesn't get image from items the entire drawable.lua is based around minisign's item icons that appear on it, so maybe it's better to just make a new action for my structure :(..

 

Does anyone know a tutorial for how to add a custom action for your structure? Or can someone tell me where I can look in dst code to make a new action for my structure :)?

 

Share this post


Link to post
Share on other sites
. . .    4059

Okay, so somehow I made something like an action I think?? And it crashes, I have no idea what I'm doing, I'm just doing random stuff and hoping it works... would someone be kind enough to help make sense of all these stuff I did & maybe help me get them work?

crash "attempt to call method 'HasTag' (a nil value)"

modmain.lua

Spoiler

local DRAW_ART = AddAction("DRAW_ART", "Draw Art", function(act)
	if act.doer.components.inventory then	
		if act.target.components.burnable ~= nil then
			if act.target.components.burnable:IsBurning() or act.target.components.burnable:IsSmoldering() then
				return false
			end
		end
	
		local pencil = act.doer.components.inventory:Has("featherpencil", 1)
        if pencil then
			--pencil:Remove()
			
			if inst.drawn0 == nil then
				inst.drawn0 = true
				inst.AnimState:OverrideSymbol("art", "canvas_art_1", "art")
			else
				inst.drawn0 = nil
				Inst.AnimState:ClearOverrideSymbol("art")
			end
			
			inst.SoundEmitter:PlaySound("dontstarve/common/together/draw")
			inst.components.artable:Draw_Art(act.target)
			return true
        end
    end
end)
DRAW_ART.priority = 10

AddComponentAction("SCENE", "artable", function(inst, doer, target, actions)
	if target:HasTag("canvas") then -- LINE THAT CAUSED CRASH
		table.insert(actions, GLOBAL.ACTIONS.DRAW_ART)
	end
end)

AddStategraphActionHandler("wilson", GLOBAL.ActionHandler(DRAW_ART, "dolongaction"))
AddStategraphActionHandler("wilson_client", GLOBAL.ActionHandler(DRAW_ART, "dolongaction"))

 

artable.lua component or if you prefer the lua file artable.lua

Spoiler

local function oncanart(self, canart)
    if canart then
        self.inst:AddTag("artable")
    else
        self.inst:RemoveTag("artable")
    end
end

local Artable = Class(function(self, inst)
    self.inst = inst
	
	self.canart = true
	self.onartfn = nil
	self.art = nil
	--self.onchange = nil

end,
nil,
{
	canart = oncanart,
})

function Artable:OnRemoveFromEntity()
    self.inst:RemoveTag("artable")
end

function Artable:SetCanArt(canart)
    self.canart = canart
end

function Artable:CanArt()
    return self.canart
end

function Artable:SetOnArtFn(fn)
    self.onartfn = fn
end

function Artable:OnArt(art)

	
    if self.art ~= art then
        self.art = art
        if self.onartfn ~= nil then
            self.onartfn(self.inst, art)
        end
    end
	
end

--[[
function Artable:SetOnChangeFn(fn)
    self.onchange = fn
end
--]]

--[[
function Artable:OnSave()
    
end

function Artable:LoadPostPass(savedata)
    
end
--]]

return Artable


	

 

canvas.lua (my structure prefab)

Spoiler

local assets =
{
	Asset("ANIM", "anim/canvas.zip"),
	Asset("ANIM", "anim/canvas_art_1.zip"),
}

local prefabs = 
{
}

SetSharedLootTable('canvas',
{
    {'boards',		1.00},
    {'papyrus',		1.00},
})

local function onbuilt(inst)
    inst.AnimState:PlayAnimation("idle")
	inst.SoundEmitter:PlaySound("dontstarve/common/sign_craft")
end

local function onhit(inst, worker)
    if not inst:HasTag("burnt") then
        inst.AnimState:PlayAnimation("hit")
        inst.AnimState:PushAnimation("idle", false)
    end
end

local function onhammered(inst, worker)
	if inst.components.burnable ~= nil and inst.components.burnable:IsBurning() then
		inst.components.burnable:Extinguish()
	end
    inst.components.lootdropper:DropLoot()
	local fx = SpawnPrefab("collapse_small")
    fx.Transform:SetPosition(inst.Transform:GetWorldPosition())
    fx:SetMaterial("wood")
    inst:Remove()
end

--[[
local function OnDrawnFn(inst, src)
    if inst.drawn0 == nil then
		inst.drawn0 = true
		inst.AnimState:OverrideSymbol("art", "canvas_art_1", "art")
	else
		inst.drawn0 = nil
		Inst.AnimState:ClearOverrideSymbol("art")
	end
	inst.SoundEmitter:PlaySound("dontstarve/common/together/draw")
end
--]]

--local function OnSave(inst, data)  
--end

--local function OnLoad(inst, data)
--end

local function fn()
    local inst = CreateEntity()

    inst.entity:AddTransform()
    inst.entity:AddAnimState()
	inst.entity:AddSoundEmitter()
    inst.entity:AddMiniMapEntity()
    inst.entity:AddNetwork()
	MakeObstaclePhysics(inst, 1.1)

	--inst.MiniMapEntity:SetPriority(5)
    --inst.MiniMapEntity:SetIcon(name..".png")

    inst.AnimState:SetBank("canvas")
    inst.AnimState:SetBuild("canvas")
    inst.AnimState:PlayAnimation("idle", true)
	
	inst:AddTag("collider")
	inst:AddTag("structure")
	inst:AddTag("canvas")
	
	inst:ListenForEvent("onbuilt", onbuilt)

    inst.entity:SetPristine()

    if not TheWorld.ismastersim then
        return inst
    end
	
	--inst:AddComponent("named")
	
	--[[
	local _random = math.random(1,2)
	if _random == 1 then
		--inst.components.named:SetName("Art 1")
		inst.drawn0 = nil
	elseif _random == 2 then
		inst.AnimState:OverrideSymbol("art", "canvas_art_1", "art")
		--inst.components.named:SetName("Art 2")
		inst.drawn0 = true
	end
	--]]
	
    MakeLargeBurnable(inst)
    MakeMediumPropagator(inst)
	inst.components.burnable:SetBurnTime(15)
	
    inst:AddComponent("inspectable")
    inst:AddComponent("lootdropper")

	--inst:AddComponent("drawable")
	--inst.components.drawable:SetOnDrawnFn(OnDrawnFn)
	
	inst:AddComponent("artable")

    inst:AddComponent("workable")
    inst.components.workable:SetWorkAction(ACTIONS.HAMMER)
    inst.components.workable:SetWorkLeft(6)
    inst.components.workable:SetOnFinishCallback(onhammered)
    inst.components.workable:SetOnWorkCallback(onhit)

	inst:AddComponent("hauntable")
	inst.components.hauntable:SetHauntValue(TUNING.HAUNT_TINY)
	
	--inst.OnSave = OnSave
	--inst.OnLoad = OnLoad

    return inst
end

return Prefab("canvas", fn, assets, prefabs), 
MakePlacer("canvas_placer", "canvas", "canvas", "idle", false, nil, nil, nil, 0, nil, nil)

 

Share this post


Link to post
Share on other sites
. . .    4059

thanks! so now it doesn't crash anymore, making progress! Though, when I hover over my structure it only gives option to "walk to" or "examine" so does anyone know how I can make my action be possible to preform when I hover over my structure (preferably while holding a feather pencil and clicking with that on it)?

Share this post


Link to post
Share on other sites
. . .    4059
12 hours ago, Aquaterion said:

maybe its because you're missing STRINGS.ACTIONS.DRAW_ART = "Draw"

Added it & still nothing, welp :(.

Spoiler

STRINGS.ACTIONS.DRAW_ART = "Draw"

local DRAW_ART = AddAction("DRAW_ART", "Draw Art", function(act)
	if act.doer.components.inventory then	
		if act.target.components.burnable ~= nil then
			if act.target.components.burnable:IsBurning() or act.target.components.burnable:IsSmoldering() then
				return false
			end
		end
	
		local pencil = act.doer.components.inventory:Has("featherpencil", 1)
        if pencil then
			--pencil:Remove()
			
			if inst.drawn0 == nil then
				inst.drawn0 = true
				inst.AnimState:OverrideSymbol("art", "canvas_art_1", "art")
			else
				inst.drawn0 = nil
				Inst.AnimState:ClearOverrideSymbol("art")
			end
			
			inst.SoundEmitter:PlaySound("dontstarve/common/together/draw")
			inst.components.artable:Draw_Art(act.target)
			return true
        end
    end
end)
DRAW_ART.priority = 10

AddComponentAction("USEITEM", "artable", function(inst, doer, target, actions)
	if target:HasTag("canvas") then
		table.insert(actions, GLOBAL.ACTIONS.DRAW_ART)
	end
end)

AddStategraphActionHandler("wilson", GLOBAL.ActionHandler(DRAW_ART, "dolongaction"))
AddStategraphActionHandler("wilson_client", GLOBAL.ActionHandler(DRAW_ART, "dolongaction"))

 

 

Does anyone know a mod which adds a structure which has a custom action then I can take a look at how that mod adds action for structure :)? Because I have no idea what I'm doing wrong, hahaha..

Share this post


Link to post
Share on other sites
Aquaterion    821

Hmm other than that all I can see that is maybe wrong is that in AddAction, you suddenly start using inst instead of act.doer/act.target

Try changing

table.insert(actions, GLOBAL.ACTIONS.DRAW_ART)

to

table.insert(actions, DRAW_ART)

Share this post


Link to post
Share on other sites
. . .    4059
25 minutes ago, Aquaterion said:

Hmm other than that all I can see that is maybe wrong is that in AddAction, you suddenly start using inst instead of act.doer/act.target

Hahaha, thanks I didn't notice that, I fixed those and replaced inst with act.target

Spoiler

STRINGS.ACTIONS.DRAW_ART = "Draw"

local DRAW_ART = AddAction("DRAW_ART", "Draw Art", function(act)
	if act.doer.components.inventory then	
		if act.target.components.burnable ~= nil then
			if act.target.components.burnable:IsBurning() or act.target.components.burnable:IsSmoldering() then
				return false
			end
		end
	
		local pencil = act.doer.components.inventory:Has("featherpencil", 1)
        if pencil then
			--pencil:Remove()
			
			if act.target.drawn0 == nil then
				act.target.drawn0 = true
				act.target.AnimState:OverrideSymbol("art", "canvas_art_1", "art")
			else
				act.target.drawn0 = nil
				act.target.AnimState:ClearOverrideSymbol("art")
			end
			
			act.target.SoundEmitter:PlaySound("dontstarve/common/together/draw")
			act.target.components.artable:Draw_Art(act.target)
			return true
        end
    end
end)
DRAW_ART.priority = 10

AddComponentAction("USEITEM", "artable", function(inst, doer, target, actions)
	if target:HasTag("canvas") then
		table.insert(actions, DRAW_ART)
	end
end)

AddStategraphActionHandler("wilson", GLOBAL.ActionHandler(DRAW_ART, "dolongaction"))
AddStategraphActionHandler("wilson_client", GLOBAL.ActionHandler(DRAW_ART, "dolongaction"))

 

and changed the table.insert to what you said, but still nothing :(..

Maybe nothing happens because my action doesn't have a specific way to be activated? Maybe I need make my action appear when hover over canvas and right click & make it into RMB action or something?

This is so complicated, it would be easier for me to add key press for all players to swap texture of canvas when near one but that would be such dumb way :(..

Though, thanks for trying to help me Aquaterion :D!!

Share this post


Link to post
Share on other sites
Aquaterion    821

Whenever I get stuck I put a bunch of prints everywhere to see where the code is failing to continue.

Since the inst thing didn't make you crash, I think the AddAction thing never got used

Share this post


Link to post
Share on other sites
. . .    4059
1 hour ago, Aquaterion said:

Whenever I get stuck I put a bunch of prints everywhere to see where the code is failing to continue.

Since the inst thing didn't make you crash, I think the AddAction thing never got used

Okay, so I put prints all in that code in modmain.lua

Spoiler

STRINGS.ACTIONS.DRAW_ART = "Draw"

local DRAW_ART = AddAction("DRAW_ART", "Draw Art", function(act)
						print("Print message 1")

	if act.doer.components.inventory then	
		if act.target.components.burnable ~= nil then
			if act.target.components.burnable:IsBurning() or act.target.components.burnable:IsSmoldering() then
				return false
			end
		end
							print("Print message 2")

		local pencil = act.doer.components.inventory:Has("featherpencil", 1)
        if pencil then
			--pencil:Remove()
									print("Print message 3")

			if act.target.drawn0 == nil then
									print("Print message 4")

				act.target.drawn0 = true
				act.target.AnimState:OverrideSymbol("art", "canvas_art_1", "art")
			else
									print("Print message 5")

				act.target.drawn0 = nil
				act.target.AnimState:ClearOverrideSymbol("art")
			end

			act.target.SoundEmitter:PlaySound("dontstarve/common/together/draw")
			act.target.components.artable:OnArt(act.target)
			return true
        end
    end
end)
DRAW_ART.priority = 10

AddComponentAction("USEITEM", "artable", function(inst, doer, target, actions)
	if target:HasTag("canvas") then
		table.insert(actions, DRAW_ART)
								print("Print message DRAW_ART")

	end
end)

AddStategraphActionHandler("wilson", GLOBAL.ActionHandler(DRAW_ART, "dolongaction"))
AddStategraphActionHandler("wilson_client", GLOBAL.ActionHandler(DRAW_ART, "dolongaction"))

 

none of them where in the log, that means none of this code is working :shock:?

Where did it all go wrong :wilson_dead:....

Edited by SuperDavid

Share this post


Link to post
Share on other sites
. . .    4059

nobody knows of a mod which adds a structure with unique action for it or why this action isn't working :(?

Edited by SuperDavid

Share this post


Link to post
Share on other sites
Aquaterion    821

Ok yea I thought it was the reason. What is wrong is that normally for these kind of functionalites, you have 2 components.

 

A component for ART TOOL and a component for ART TARGET.

you're adding the action on the artable entity, which is the canvas, so at the moment, you would need to use a canvas on a canvas.

GLOBAL.STRINGS.ACTIONS.DRAW_ART = "Draw"

local DRAW_ART = AddAction("DRAW_ART", "Draw Art", function(act)

	if act.doer.components.inventory then	
		if act.target.components.burnable ~= nil then
			if act.target.components.burnable:IsBurning() or act.target.components.burnable:IsSmoldering() then
				return false
			end
		end

		local pencil = act.doer.components.inventory:Has("featherpencil", 1)
        if pencil and pencil.components.artable then
			--pencil:Remove()

			if act.target.drawn0 == nil then
				act.target.drawn0 = true
				act.target.AnimState:OverrideSymbol("art", "canvas_art_1", "art")
			else
				act.target.drawn0 = nil
				act.target.AnimState:ClearOverrideSymbol("art")
			end

			act.target.SoundEmitter:PlaySound("dontstarve/common/together/draw")
			pencil.components.artable:OnArt(act.target)
			return true
        end
    end
end)
DRAW_ART.priority = 0

AddComponentAction("USEITEM", "artable", function(inst, doer, target, actions, right)
	if target:HasTag("canvas") then
		table.insert(actions, DRAW_ART)
	end
end)

AddStategraphActionHandler("wilson", GLOBAL.ActionHandler(DRAW_ART, "dolongaction"))
AddStategraphActionHandler("wilson_client", GLOBAL.ActionHandler(DRAW_ART, "dolongaction"))

I adjusted it to work, but in this case, you need to add the component to the featherpencil and remove it from the canvas.

 

Oh and instead of declaring pencil, you should be able to use act.invobject

Edited by Aquaterion

Share this post


Link to post
Share on other sites
. . .    4059

Thank you so much Aquaterion it's so close to working now :D!!

I added artable component to featherpencil (though I should probably copypaste drawingtool and make a artingtool component) and with your code action now shows up on structure :D!!

Though, when I draw to draw on the canvas now the game crashes it says "attempt to index local 'pencil' (a boolean value)"

  or if I change the code like this

Spoiler


local DRAW_ART = AddAction("DRAW_ART", "Draw Art", function(act)

	if act.doer.components.inventory then	
		if act.target.components.burnable ~= nil then
			if act.target.components.burnable:IsBurning() or act.target.components.burnable:IsSmoldering() then
				return false
			end
		end

		local pencil = act.doer.components.inventory:Has(act.invobject)
        if pencil and pencil.components.artable then
			--pencil:Remove()

			if act.target.drawn0 == nil then
				act.target.drawn0 = true
				act.target.AnimState:OverrideSymbol("art", "canvas_art_1", "art")
			else
				act.target.drawn0 = nil
				act.target.AnimState:ClearOverrideSymbol("art")
			end

			act.target.SoundEmitter:PlaySound("dontstarve/common/together/draw")
			pencil.components.artable:OnArt(act.target)
			return true
        end
    end
end)

 

the game still crashes and says "[string "scripts/components/inventory.lua"]:986: attempt to compare nil with number"

thank you very much for your help @Aquaterion without your help I couldn't get this far I barely understand what I'm doing hahaha :wilson_resigned:..

Edited by SuperDavid

Share this post


Link to post
Share on other sites
Aquaterion    821

If you see the last line in my last post, I told you that you should probably replace "pencil" variable with act.invobject

GLOBAL.STRINGS.ACTIONS.DRAW_ART = "Draw"

local DRAW_ART = AddAction("DRAW_ART", "Draw Art", function(act)

	if act.doer.components.inventory then	
		if act.target.components.burnable ~= nil then
			if act.target.components.burnable:IsBurning() or act.target.components.burnable:IsSmoldering() then
				return false
			end
		end

        if act.invobject then

			if act.target.drawn0 == nil then
				act.target.drawn0 = true
				act.target.AnimState:OverrideSymbol("art", "canvas_art_1", "art")
			else
				act.target.drawn0 = nil
				act.target.AnimState:ClearOverrideSymbol("art")
			end

			act.target.SoundEmitter:PlaySound("dontstarve/common/together/draw")
			act.invobject.components.artable:OnArt(act.target)
			return true
        end
    end
end)
DRAW_ART.priority = 0

AddComponentAction("USEITEM", "artable", function(inst, doer, target, actions, right)
	if target:HasTag("canvas") then
		table.insert(actions, DRAW_ART)
	end
end)

AddStategraphActionHandler("wilson", GLOBAL.ActionHandler(DRAW_ART, "dolongaction"))
AddStategraphActionHandler("wilson_client", GLOBAL.ActionHandler(DRAW_ART, "dolongaction"))

 

And no problem for the help. Helped me understand things better as well

Edited by Aquaterion

Share this post


Link to post
Share on other sites

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
Sign in to follow this