Tenshin Posted May 31, 2015 Share Posted May 31, 2015 (edited) Hi! I've made a mod a long time ago that I can't play without . Now that DST is coming in a few days I was wondering if this mod is client_only or all_clients_required? Is there any way to know this without actually testing the mod? This is the code. Fairly short, inspired by simplex's "NoMoreWallFing": -- Force attack (CTRL-F) ignores chester/companions/walls -- Thanks to simplex (NoMoreWallFing)local getinfo = GLOBAL.debug.getinfolocal pcall = GLOBAL.pcalllocal function make_no_f_able(inst) local combat = inst.components.combat if not combat then return end combat.canbeattackedfn = (function() local oldfn = combat.canbeattackedfn return function(inst, attacker) if not oldfn or oldfn(inst, attacker) then if attacker:HasTag("player") then local status, info = pcall(getinfo, 4, 'f') return not status or info.func ~= attacker.components.playercontroller.GetAttackTarget else return true end end end end)()endAddComponentPostInit("repairable", function(_, inst) if inst:HasTag("wall") then inst:DoTaskInTime(0, make_no_f_able) endend)AddComponentPostInit("follower", function(_, inst) if inst:HasTag("companion") then inst:DoTaskInTime(0, make_no_f_able) endend)My guess is that it's not client_only, since it changes the "combat" components.Thanks! EDIT: When I was looking for help with the mod Rincevvind posted this:local function DontHitMeWulfe(inst,attacker) return not attacker:HasTag("wulfe") -- return attacker.prefab~="player"end function SomePrefabInit(inst) inst.components.combat.canbeattackedfn=DontHitMeWulfeend AddPrefabPostInit("hound", SomePrefabInit)Is this different? Edited May 31, 2015 by Tenshin Link to comment https://forums.kleientertainment.com/forums/topic/54623-how-can-i-tell-from-the-code-if-mod-is-client-only-or-all-clients-required/ Share on other sites More sharing options...
Maris Posted May 31, 2015 Share Posted May 31, 2015 It must be client side because client chooses which target to attack and then sends this info to server. Link to comment https://forums.kleientertainment.com/forums/topic/54623-how-can-i-tell-from-the-code-if-mod-is-client-only-or-all-clients-required/#findComment-642553 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