. . . Posted November 21, 2016 Share Posted November 21, 2016 (edited) Hello, I need help with something! So, I have a tool which I want it to be able to be used for shaving. So, I went through the razor.lua & all I saw was this if not TheWorld.ismastersim then return inst end inst:AddComponent("shaver") so I added that to my tool & it can shave things on worlds with no caves on, but on worlds with caves on the character just goes up to for example a beefalo & then just does nothing! Not even the shave fail strings comes up! I don't know what i'm doing wrong, does anyone know how to fix this? Because I have no idea ... I really would appreciate any help anyone can offer on what I can do to fix this ! Thanks for reading, have a great day ! Edited November 26, 2016 by SuperDavid Link to comment https://forums.kleientertainment.com/forums/topic/71885-solved-shaver-component-for-mod-tool-doesnt-work-in-world-with-caves-on/ Share on other sites More sharing options...
. . . Posted November 22, 2016 Author Share Posted November 22, 2016 (edited) So, maybe anyone knows what makes the Razor so special that only it can shave things on caves world? This's what my mod item does in a world with caves on Spoiler & this's what it does in a world with caves off Spoiler I don't understand what's wrong because the razor only has shaver component & works fine...? Edited November 22, 2016 by SuperDavid Link to comment https://forums.kleientertainment.com/forums/topic/71885-solved-shaver-component-for-mod-tool-doesnt-work-in-world-with-caves-on/#findComment-840469 Share on other sites More sharing options...
Lumina Posted November 22, 2016 Share Posted November 22, 2016 Maybe it's related to the fact that in one case you aren't the host, and in the other, you are. Because as far as i know, when there are caves in a server, you aren't considered as the host. But you are the host if there aren't cave. So maybe there is a line lacking somewhere or needed in the client part of the code. Link to comment https://forums.kleientertainment.com/forums/topic/71885-solved-shaver-component-for-mod-tool-doesnt-work-in-world-with-caves-on/#findComment-840543 Share on other sites More sharing options...
. . . Posted November 24, 2016 Author Share Posted November 24, 2016 (edited) I tried adding, which obviously didn't work, haha.. inst:AddInherentAction(ACTIONS.SHAVE) So, if anyone can help that would be great cause i'm clueless.. The only other place I see "shaver" referenced in DST files is "actions.lua" & "componentactions.lua" but those don't have anything that is specifically making that only the razor can shave... And shaver.lua is literally just this, nothing saying only the razor can shave.. So, if anyone can help that would be great ! I have no idea what to do anymore.. local Shaver = Class(function(self, inst) self.inst = inst end) --Registered actions in componentactions.lua return Shaver Edited November 24, 2016 by SuperDavid Link to comment https://forums.kleientertainment.com/forums/topic/71885-solved-shaver-component-for-mod-tool-doesnt-work-in-world-with-caves-on/#findComment-841157 Share on other sites More sharing options...
alainmcd Posted November 24, 2016 Share Posted November 24, 2016 Mind sharing the mod so we can take a closer look? Link to comment https://forums.kleientertainment.com/forums/topic/71885-solved-shaver-component-for-mod-tool-doesnt-work-in-world-with-caves-on/#findComment-841255 Share on other sites More sharing options...
. . . Posted November 24, 2016 Author Share Posted November 24, 2016 (edited) 2 hours ago, alainmcd said: Mind sharing the mod so we can take a closer look? Here a go, but most of code is jumbled together, sorry! Edited November 24, 2016 by SuperDavid Link to comment https://forums.kleientertainment.com/forums/topic/71885-solved-shaver-component-for-mod-tool-doesnt-work-in-world-with-caves-on/#findComment-841277 Share on other sites More sharing options...
alainmcd Posted November 24, 2016 Share Posted November 24, 2016 Seems to be working for me. I tried hosting (both overworld-only and overworld+caves) and joining a dedicated (with caves, if that matters), all of them work. Only caveat is that you can't shave beefalos with your weapon equipped. Link to comment https://forums.kleientertainment.com/forums/topic/71885-solved-shaver-component-for-mod-tool-doesnt-work-in-world-with-caves-on/#findComment-841289 Share on other sites More sharing options...
. . . Posted November 24, 2016 Author Share Posted November 24, 2016 1 minute ago, alainmcd said: Seems to be working for me. I tried hosting (both overworld-only and overworld+caves) and joining a dedicated (with caves, if that matters), all of them work. Only caveat is that you can't shave beefalos with your weapon equipped. So, you tested & the shaver works on world with no caves but it doesn't work on world with caves? There is no way to make it work on world with caves? Link to comment https://forums.kleientertainment.com/forums/topic/71885-solved-shaver-component-for-mod-tool-doesnt-work-in-world-with-caves-on/#findComment-841291 Share on other sites More sharing options...
alainmcd Posted November 24, 2016 Share Posted November 24, 2016 (edited) It worked the same regardless of server setup. In all cases I could shave the beefalo by hovering the tool over them, but couldn't shave them when I had the weapon equipped. Maybe you already fixed it and were trying to shave them with your weapon equipped? My guess is that shaving other entities with your tool equipped doesn't work because razors don't have that behaviour (you can't equip it), so you might have to rewrite the shaving action. Edited November 24, 2016 by alainmcd Link to comment https://forums.kleientertainment.com/forums/topic/71885-solved-shaver-component-for-mod-tool-doesnt-work-in-world-with-caves-on/#findComment-841295 Share on other sites More sharing options...
. . . Posted November 24, 2016 Author Share Posted November 24, 2016 (edited) 26 minutes ago, alainmcd said: It worked the same regardless of server setup. In all cases I could shave the beefalo by hovering the tool over them, but couldn't shave them when I had the weapon equipped. Maybe you already fixed it and were trying to shave them with your weapon equipped? My guess is that shaving other entities with your tool equipped doesn't work because razors don't have that behaviour (you can't equip it), so might have to rewrite the shaving action. Oh, how do you shave without equipping the tool? Because whenever I right click on beefalo to shave them with the kunai unequipped it makes me automatically equip it & if I left click it makes me attack the beefalo ? 26 minutes ago, alainmcd said: so you might have to rewrite the shaving action You mean in the componentactions.lua & actions.lua? Do I have to edit those directly or is there something like prefabpostinit? Edited November 24, 2016 by SuperDavid Link to comment https://forums.kleientertainment.com/forums/topic/71885-solved-shaver-component-for-mod-tool-doesnt-work-in-world-with-caves-on/#findComment-841296 Share on other sites More sharing options...
alainmcd Posted November 24, 2016 Share Posted November 24, 2016 (edited) I just mouseover the beefalo with the weapon on the cursor and right-click. The weapon is auto-equipped, but the action is still performed without clicking anymore. If I want to shave another beefalo, I have to left-click the weapon again and hover over the next beefalo with the weapon. I'm in the beta, in case that makes a difference. If I understand it correctly, to be able to right-click on a beefalo to shave it with your weapon equipped, you'd have to add an entry for shaving in COMPONENT_ACTIONS.EQUIPPED (so disregard my previous comment about rewriting the shaving action). Edit: didn't see your edit, but I think I'm sorta answering to it. There's probably something similar to AddPrefabPostInit to register mod actions, I'll have a look. Edited November 24, 2016 by alainmcd Link to comment https://forums.kleientertainment.com/forums/topic/71885-solved-shaver-component-for-mod-tool-doesnt-work-in-world-with-caves-on/#findComment-841304 Share on other sites More sharing options...
alainmcd Posted November 24, 2016 Share Posted November 24, 2016 There's env.AddComponentAction = function(actiontype, component, fn) in modutil.lua. I'm not sure how to use it, I tried adding this to your modmain.lua, but no luck. local function KunaiEquippedAction(inst, doer, actions) if doer:HasTag("bearded") and not (doer.replica.inventory:GetActiveItem() == inst and doer.replica.rider ~= nil and doer.replica.rider:IsRiding()) then table.insert(actions, ACTIONS.SHAVE) end end AddComponentAction("EQUIPPED", "shaver", KunaiEquippedAction) At least it didn't crash. Not sure what else could work. :/ Link to comment https://forums.kleientertainment.com/forums/topic/71885-solved-shaver-component-for-mod-tool-doesnt-work-in-world-with-caves-on/#findComment-841317 Share on other sites More sharing options...
. . . Posted November 24, 2016 Author Share Posted November 24, 2016 (edited) On 11/24/2016 at 6:02 PM, alainmcd said: There's env.AddComponentAction = function(actiontype, component, fn) in modutil.lua. I'm not sure how to use it, I tried adding this to your modmain.lua, but no luck. local function KunaiEquippedAction(inst, doer, actions) if doer:HasTag("bearded") and not (doer.replica.inventory:GetActiveItem() == inst and doer.replica.rider ~= nil and doer.replica.rider:IsRiding()) then table.insert(actions, ACTIONS.SHAVE) end end AddComponentAction("EQUIPPED", "shaver", KunaiEquippedAction) At least it didn't crash. Not sure what else could work. :/ @alainmcd Thanks so much for doing your best ! I appreciate it a lot ! And maybe @DarkXero you know how to make alainmcd's code work ? Thank you very much DarkXero !! It 100% works fine now!! Edited November 26, 2016 by SuperDavid Link to comment https://forums.kleientertainment.com/forums/topic/71885-solved-shaver-component-for-mod-tool-doesnt-work-in-world-with-caves-on/#findComment-841322 Share on other sites More sharing options...
DarkXero Posted November 26, 2016 Share Posted November 26, 2016 This is actually caused by the extremely annoying movement prediction mechanics. local PlayerController = GLOBAL.require("components/playercontroller") local _DoActionAutoEquip = PlayerController.DoActionAutoEquip function PlayerController:DoActionAutoEquip(buffaction, ...) if buffaction.invobject ~= nil and buffaction.invobject.replica.equippable ~= nil and buffaction.invobject.replica.equippable:EquipSlot() == GLOBAL.EQUIPSLOTS.HANDS and buffaction.action == GLOBAL.ACTIONS.SHAVE then return end return _DoActionAutoEquip(self, buffaction, ...) end Put this in modmain to allow your hand-equippable to shave with movement prediction enabled (Lag Compensation: Predictive). Link to comment https://forums.kleientertainment.com/forums/topic/71885-solved-shaver-component-for-mod-tool-doesnt-work-in-world-with-caves-on/#findComment-841878 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