Fancy_Fox_Pers Posted March 17, 2018 Share Posted March 17, 2018 (edited) I have a creature that uses the following code to emit light. In multiplayer, my friend can't see the light on her screen. It has happened that it doesn't show up on mine either. The light does function, since it prevents to get hurt by Darkness. local function lightfn(inst) local light = inst.entity:AddLight() inst.Light:Enable(true) inst.Light:SetFalloff(0.4) inst.Light:SetIntensity(.7) inst.Light:SetRadius(2.5) inst.Light:SetColour(180 / 255, 195 / 255, 150 / 255) return inst end Thanks in advance! Edited March 17, 2018 by Fancy_Fox_Pers Link to comment https://forums.kleientertainment.com/forums/topic/88783-friend-cant-see-light-emitted-by-mob/ Share on other sites More sharing options...
Fancy_Fox_Pers Posted March 18, 2018 Author Share Posted March 18, 2018 (edited) So now that I have a dedicated server I can more freely test things out. On a normal server, the lights show up just fine. On a dedicated server, they don't show up but still "function" (Darkness doesn't hit). I have tried using the same code as other mods but I still get the same bug. It shows up on a normal server, but never on a dedicated server. I am probably just not noticing something in the creature's lua file, so here it is in case it is of any use: Spoiler local prefabs = { "shadow_despawn", "statue_transition_2", "nightmarefuel", } local brain = require "brains/guardian_thibaudbrain" STRINGS.NAMES.GUARDIAN_THIBAUD = "Paper Thibaud" local function onbuilt(inst, builder) local theta = math.random() * 2 * PI local pt = builder:GetPosition() local radius = math.random(3, 6) local offset = FindWalkableOffset(pt, theta, radius, 12, true) if offset ~= nil then pt.x = pt.x + offset.x pt.z = pt.z + offset.z end builder.components.petleash:SpawnPetAt(pt.x, 0, pt.z, inst.pettype) inst:Remove() end local function MakeBuilder(prefab) --These shadows are summoned this way because petleash needs to --be the component that summons the pets, not the builder. local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst:AddTag("CLASSIFIED") --[[Non-networked entity]] inst.persists = false --Auto-remove if not spawned by builder inst:DoTaskInTime(0, inst.Remove) if not TheWorld.ismastersim then return inst end inst.pettype = prefab inst.OnBuiltFn = onbuilt return inst end return Prefab(prefab.."_builder", fn, nil, { prefab }) end local function OnAttacked(inst, data) if data.attacker ~= nil then if data.attacker.components.petleash ~= nil and data.attacker.components.petleash:IsPet(inst) then if inst.components.lootdropper == nil then inst:AddComponent("lootdropper") end inst.components.lootdropper:SpawnLootPrefab("papyrus", inst:GetPosition()) data.attacker.components.petleash:DespawnPet(inst) elseif data.attacker.components.combat ~= nil then inst.components.combat:SuggestTarget(data.attacker) end end end local function retargetfn(inst) --Find things attacking leader local leader = inst.components.follower:GetLeader() return leader ~= nil and FindEntity( leader, TUNING.SHADOWWAXWELL_TARGET_DIST, function(guy) return guy ~= inst and (guy.components.combat:TargetIs(leader) or guy.components.combat:TargetIs(inst)) and inst.components.combat:CanTarget(guy) end, { "_combat" }, -- see entityreplica.lua { "playerghost", "INLIMBO" } ) or nil end local function keeptargetfn(inst, target) --Is your leader nearby and your target not dead? Stay on it. --Match KEEP_WORKING_DIST in brain return inst.components.follower:IsNearLeader(14) and inst.components.combat:CanTarget(target) end local function spearfn(inst) inst.components.health:SetMaxHealth(TUNING.SHADOWWAXWELL_LIFE) inst.components.health:StartRegen(TUNING.SHADOWWAXWELL_HEALTH_REGEN, TUNING.SHADOWWAXWELL_HEALTH_REGEN_PERIOD) inst.components.combat:SetDefaultDamage(TUNING.SPEAR_DAMAGE) inst.components.combat:SetAttackPeriod(TUNING.SHADOWWAXWELL_ATTACK_PERIOD) inst.components.combat:SetRetargetFunction(2, retargetfn) --Look for leader's target. inst.components.combat:SetKeepTargetFunction(keeptargetfn) --Keep attacking while leader is near. return inst end local function lumberfn(inst) inst.AnimState:SetBuild("guardian_thibaud_lumber") return inst end local function lightfn(inst) local light = inst.entity:AddLight() inst.Light:Enable(true) inst.Light:SetFalloff(0.4) inst.Light:SetIntensity(.7) inst.Light:SetRadius(2.5) inst.Light:SetColour(180 / 255, 195 / 255, 150 / 255) inst.AnimState:SetBuild("guardian_thibaud_miner") return inst end local function nodebrisdmg(inst, amount, overtime, cause, ignore_invincible, afflicter, ignore_absorb) return afflicter ~= nil and afflicter:HasTag("quakedebris") end local function MakeMinion(prefab, tool, hat, master_postinit) local assets = { Asset("ANIM", "anim/guardian_thibaud.zip"), Asset("ANIM", "anim/guardian_thibaud_lumber.zip"), Asset("ANIM", "anim/guardian_thibaud_miner.zip"), Asset("SOUND", "sound/maxwell.fsb"), Asset("ANIM", "anim/"..tool..".zip"), } local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() inst.entity:AddSoundEmitter() inst.entity:AddNetwork() inst.entity:AddDynamicShadow() inst.DynamicShadow:Enable(true) inst.DynamicShadow:SetSize(1, 1) MakeGhostPhysics(inst, 1, 0.5) inst.Transform:SetFourFaced(inst) inst.AnimState:SetBank("wilson") inst.AnimState:SetBuild("guardian_thibaud") inst.AnimState:PlayAnimation("idle") -- inst.AnimState:SetMultColour(0, 0, 0, .5) if tool ~= nil then inst.AnimState:OverrideSymbol("swap_object", tool, tool) inst.AnimState:Hide("ARM_normal") else inst.AnimState:Hide("ARM_carry") end if hat ~= nil then inst.AnimState:OverrideSymbol("swap_hat", hat, "swap_hat") inst.AnimState:Hide("HAIR_NOHAT") inst.AnimState:Hide("HAIR") else inst.AnimState:Hide("HAT") inst.AnimState:Hide("HAIR_HAT") end inst:AddTag("scarytoprey") inst:AddTag("shadowminion") inst:AddTag("NOBLOCK") inst:SetPrefabNameOverride("guardian_thibaud") inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end inst:AddComponent("locomotor") inst.components.locomotor.runspeed = TUNING.SHADOWWAXWELL_SPEED inst.components.locomotor.pathcaps = { ignorecreep = true } inst.components.locomotor:SetSlowMultiplier(.6) inst:AddComponent("health") inst.components.health:SetMaxHealth(1) inst.components.health.nofadeout = true inst.components.health.redirect = nodebrisdmg inst:AddComponent("combat") inst.components.combat.hiteffectsymbol = "torso" inst.components.combat:SetRange(2) inst:AddComponent("follower") inst.components.follower:KeepLeaderOnAttacked() inst.components.follower.keepdeadleader = true inst:SetBrain(brain) inst:SetStateGraph("SGguardian_thibaud") inst:ListenForEvent("attacked", OnAttacked) inst.OnBuiltFn = onbuilt if master_postinit ~= nil then master_postinit(inst) end return inst end return Prefab(prefab, fn, assets, prefabs) end return MakeMinion("guardianlumber", "swap_axe", "hat_catcoon", lumberfn), MakeMinion("guardianminer","swap_pickaxe", "hat_miner", lightfn), MakeMinion("guardiandigger", "swap_shovel", "hat_flower"), MakeMinion("guardianduelist", "swap_spear", nil, spearfn), MakeBuilder("guardianlumber"), MakeBuilder("guardianminer"), MakeBuilder("guardiandigger"), MakeBuilder("guardianduelist") PS: The mod that I used for reference was Steampunk DST, that has creatures that emit light. Is there perhaps another mod I should have a look at? guardian_thibaud.lua Edited March 18, 2018 by Fancy_Fox_Pers Link to comment https://forums.kleientertainment.com/forums/topic/88783-friend-cant-see-light-emitted-by-mob/#findComment-1016483 Share on other sites More sharing options...
Aquaterion Posted March 18, 2018 Share Posted March 18, 2018 i dont remember exactly how light works but you could try moving if master_postinit ~= nil then master_postinit(inst) end to before this if not TheWorld.ismastersim then return inst end so it also does it on the clientside Link to comment https://forums.kleientertainment.com/forums/topic/88783-friend-cant-see-light-emitted-by-mob/#findComment-1016495 Share on other sites More sharing options...
Fancy_Fox_Pers Posted March 18, 2018 Author Share Posted March 18, 2018 That fixed it! Thanks! Link to comment https://forums.kleientertainment.com/forums/topic/88783-friend-cant-see-light-emitted-by-mob/#findComment-1016503 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