Jump to content

Recommended Posts

I thought this was gonna be easy but apparently the current Right Click Use only works on equipped items, is there a way to use an item without equipping it, or change the text of the rightclick? as I think making a new action would require editing base files?

Edited by Aquaterion
Link to comment
https://forums.kleientertainment.com/forums/topic/64801-help-right-click-use/
Share on other sites

Using an item (i.e. item with useableitem component) currently does indeed require the item to be equipped, see componentactions:L835). However, other components usually don't require that.

Changing the display text can be accomplished by setting the the action's strfn field + STRINGS.ACTIONS texts.

48 minutes ago, Muche said:

Using an item (i.e. item with useableitem component) currently does indeed require the item to be equipped, see componentactions:L835). However, other components usually don't require that.

Changing the display text can be accomplished by setting the the action's strfn field + STRINGS.ACTIONS texts.

If you have time, mind providing an example of the action strfn, because I have to go right now, but If can do that, I can easily just put it on another component like sleeping or such.. Thank you for your help again.

Examples from actions.lua:

ACTIONS.RUMMAGE.strfn = function(act)
    local targ = act.target or act.invobject
    return targ ~= nil
        and targ.replica.container ~= nil
        and targ.replica.container:IsOpenedBy(act.doer)
        and "CLOSE"
        or nil
end

ACTIONS.DROP.strfn = function(act)
    if act.invobject ~= nil and not act.invobject:HasActionComponent("deployable") then
        return (act.invobject:HasTag("trap") and "SETTRAP")
            or (act.invobject:HasTag("mine") and "SETMINE")
            or (act.invobject.prefab == "pumpkin_lantern" and "PLACELANTERN")
            or nil
    end
end

ACTIONS.DEPLOY.strfn = function(act)
    return act.invobject ~= nil
        and (   (act.invobject:HasTag("groundtile") and "GROUNDTILE") or
                (act.invobject:HasTag("wallbuilder") and "WALL") or
                (act.invobject:HasTag("eyeturret") and "TURRET")    )
        or nil
end

ACTIONS.REEL.strfn = function(act)
    local fishingrod = act.invobject.replica.fishingrod
    if fishingrod ~= nil and fishingrod:GetTarget() == act.target then
        if fishingrod:HasHookedFish() then
            return "REEL"
        elseif act.doer:HasTag("nibble") then
            return "HOOK"
        else
            return "CANCEL"
        end
    end
end

ACTIONS.STORE.strfn = function(act)
    if act.target ~= nil then
        return (act.target.prefab == "cookpot" and "COOK")
            or (act.target.prefab == "birdcage" and "IMPRISON")
            or nil
    end
end

ACTIONS.HARVEST.strfn = function(act)
    if act.target ~= nil and act.target.prefab == "birdcage" then
        return "FREE"
    end
    if act.target ~= nil and act.target.components.crop and act.target:HasTag("withered") then
        return "WITHERED"
    end
end

ACTIONS.TURNOFF.strfn = function(act)
    local tar = act.target
    return tar ~= nil and tar:HasTag("hasemergencymode") and "EMERGENCY" or nil
end

ACTIONS.TAKEITEM.strfn = function(act)
    return act.target.prefab == "birdcage" and "BIRDCAGE" or "GENERIC"
end

 

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...