• Content Count

  • Joined

  • Last visited

Community Reputation

2893 Excellent

About DarkXero

  • Rank
    Senior Member


Recent Profile Visitors

14942 profile views
  1. It would help if you posted the mod or more data. AnimState should propagate correctly to clients when changing (using "Show"). As an example, here's the correct usage: -- prefab file local function PlayerFix(inst) if not inst:HasTag("depleted") then inst.extractor.AnimState:Show("salt") end end local function fn() local inst = CreateEntity() inst.entity:AddTransform() inst.entity:AddAnimState() -- ... inst.entity:AddNetwork() -- here inst:ListenForEvent("ms_playerjoined", function(world, player) PlayerFix(inst) end, TheWorld) -- ... inst.entity:SetPristine() if not TheWorld.ismastersim then return inst end -- ... return inst end More interesting would be to see the extractor prefab. It's probably missing a AddNetwork that would solve this without hassle.
  2. I was going to write it but then I realized that I ****** up and I was the one generating the new herds with my debug lines. So yeah, domestication it is. The other way was my fault. My bad for raising hopes. If I figure something out I will post new results.
  3. It's not the only way but it is a valid way. A domesticated beefalo abandons its herd and when it goes feral it creates a new one.
  4. They behave like goats now (kind of). No more exponential growth. No more servers with 40 herds and over 300 beefalo. Or phantom herds. Kill all but one, and lure it with feeding or saddle and ride it to displace the herd. Beefalo herd updates every 8 seconds for members within a 20 units radius (about 3 and a half tiles). Important to not fully domesticate the lone beef, or the herd won't be able to find a feral parent inside the herd to attach the baby. Another way would be the following: 1) Wait until there's baby beefalo. 2) Kill everything but 1 baby beefalo. 3) Relocate the lone baby beefalo with teleportation. When the baby grows, the baby will be deleted. The herd will be empty and removed. The herd will no longer be valid. A new grown beefalo will spawn on its place. Since the herd is no longer valid, a new herd will spawn there. A problem may arise where you teleport the baby, but the beefalo herd was on the mood and spawning babies, so a new baby spawns next to your baby. If your baby grows, the herd will still be valid. Now you will have your grown baby, and the new baby, running against the wall trying to return to the herd that's far away. To avoid this problem you would need to do the herd relocation outside Spring or if they're in the mood. All of this because the herd only updates positions for the members that are nearby. It is truly a conundrum. What's the difference between a herd with a member that's 10 units away from the update range versus a herd with a member that's 50 units away from the update range? Maybe the telelocator staff should make teleported units leave the herd and make their own? But then we could make new herds from a single herd: teleport one goat and one beefalo from a herd to duplicate herds... Would it be balanced to make gigantic meat farms with telelocator staffs and bases? We could also make it so if you have 1 member only, the herd position updates no matter what. This would fix the telelocation issue. But then this means that any herds with 1 single member will wander to zones of the map where they shouldn't be. Beefalo would wander way outside the savannah, since the herd point would keep moving with them. We could also apply the goat treatment: if you have one beefalo, you push it to where you want the herd. -- babybeefalo.lua local function SetFullyGrown(inst) local herd = inst.components.herdmember ~= nil and inst.components.herdmember:GetHerd() or nil local count = herd ~= nil and herd.components.herd ~= nil and herd.components.herd.membercount or nil local grown = SpawnPrefab("beefalo") grown.Transform:SetPosition(inst.Transform:GetWorldPosition()) grown.Transform:SetRotation(inst.Transform:GetRotation()) grown.sg:GoToState("grow_up_pop") if count ~= nil and count == 1 then -- add before removing or herd will be destroyed if herd ~= nil and herd.components.herd ~= nil and herd:IsValid() then herd.components.herd:AddMember(grown) end inst:Remove() else inst:Remove() if herd ~= nil and herd.components.herd ~= nil and herd:IsValid() then herd.components.herd:AddMember(grown) end end end This would turn the beefalo herds into goat herds. So yeah, if you have any ideas or feedback, discuss it.
  5. @Ozzey_Lee @fimmatek Bug is ancient and rare. Back from when domestication appeared. Both client and server logs are useless here. Any chance any of you can provide a cluster_x folder with the world with the bugged beef?
  6. @myxal Thank you very much for the world. I have been tinkering with it. It allowed me to see: Unfortunately, those bugs are the cause of beefalo overpopulation, not the cause for the empty beefaloherds growing. Upon closer inspection of the empty beefaloherds, you can rest assured they do nothing, because they can only spawn a baby beefalo when there's a parent to attach it (which must be a member of the herd). I found half of the cause of the empty beefaloherds. There are special beefalo in your world that have no herd (herd in herdmember component is set to nil), BUT have a herd location saved on the knownlocations component. So basically, every time you log out and log in, more herds appear, because it creates one for itself (it doesn't have one) but it doesn't join it (it fails because it remembers it has one). Also, because of the fail everytime (and how the code works), it creates 3 new empty herds each time. As for why exactly some beefalo could have herd set to nil, but have a herd knownlocation memorized: it's a mystery to me. Technically, this in particular, should be impossible. But I don't know if you may have used any console commands that caused this, or mods that might have interfered, or maybe the bug comes from older versions. Another tidbit, is that the beefalo also remembered a "loiteranchor" knownlocation, which means it was fed or was ridden (presumably to domesticate it). When I pulled all the herdless beefalo to me, I got 2. One that was feral. And one that was domesticated. Both with loiteranchor and herd locations, and both without herd assigned in herdmember. Here are some commands to repair the world: -- 1) clean buggy beef for k, v in pairs(Ents) do if v.prefab == "beefalo" and v.components.herdmember.herd == nil then v:Remove() end end -- 2) clean empty herds for k, v in pairs(Ents) do if v.prefab == "beefaloherd" and v.components.herd.membercount == 0 then v:Remove() end end -- extra) pull buggy beef for inspection for k, v in pairs(Ents) do if v.prefab == "beefalo" and v.components.herdmember.herd == nil then v.Transform:SetPosition(ThePlayer.Transform:GetWorldPosition()) end end Here is a command to spawn a domesticated beef: c_spawn("beefalo"); c_sel().components.hunger:DoDelta(400); c_sel().components.domesticatable:DeltaDomestication(1); c_sel().components.domesticatable:TryBecomeDomesticated(); After that, no more herd spawning on log in. Of course, you still have a massive population to clean. You can kill them all and spawn a lone beefalo every 10 seconds to make herds of size 1 wherever you please. Overpopulation still has to be fixed, of course.
  7. -- babybeefalo.lua local function SetFullyGrown(inst) local grown = SpawnPrefab("beefalo") grown.Transform:SetPosition(inst.Transform:GetWorldPosition() ) grown.Transform:SetRotation(inst.Transform:GetRotation() ) grown.sg:GoToState("grow_up_pop") inst:Remove() end -- herd.lua self.task = self.inst:DoPeriodicTask(math.random() * 2 + 6, _OnUpdate, nil, self) -- herdmember.lua self.task = self.inst:DoTaskInTime(5, OnInit) Assuming that herds never merge, consider the following situation: You have a herd of 1 beefalo, 1 baby beefalo spawns. The baby beefalo is added to the herd. Now you have a herd of 2. The baby beefalo grows until he's fully grown. He gets removed from the herd. Now you got a herd of 1. A beefalo spawns on the baby place. But it isn't linked to the herd. What happens next? The beefalo in 5 seconds will get a herd, if it doesn't have one. Either the herd picks up the beefalo via GatherNearbyMembers, or the beefalo makes its own. If the beefalo makes its own, since herds don't merge, you will end up with a herd of 1 and another herd of 1, and both will grow. And the same might happen to them. This causes beefalo overpopulation. NOTE: This applies to single player Don't Starve as well; I will mention it next patch time comes.
  8. -- herd.lua function Herd:MergeNearbyHerds() if not self.gatherrange or self:IsFull() then return end local x,y,z = self.inst.Transform:GetWorldPosition() local ents = TheSim:FindEntities(x,y,z, self.gatherrange, {"herd"}) for k,v in pairs(ents) do if v ~= self.inst and v.components.herd and v.components.herd.gathertag == self.membertag and v.components.herd.membercount < 4 and (self.membercount + v.components.herd.membercount) <= self.maxsize then for k2,v2 in pairs(v.components.herd.members) do self:AddMember(k2) end v:Remove() end end end Notice the "gathertag". There's no other place in the code where a "gathertag" is mentioned. Therefore, herds never merge. NOTE: This applies to single player Don't Starve as well; I will mention it next patch time comes.
  9. You can c_gonext to items in dropped backpacks. Items in players' inventories are off the charts using FindEntities. You can loop through the global Ents table though (example for axe, and you being the player 1): for k, v in pairs(Ents) do if v.prefab == "axe" then UserToPlayer(1).Transform:SetPosition(v:GetPosition():Get()) end end
  10. I have the same setup. You could zip the folder and upload it here so I can paste it on my mods folder.
  11. You will have to provide the code and what did you do. AddComponentPostInit("age",function(inst) for i = 1,math.huge do local n, v = GLOBAL.debug.getupvalue(inst._ctor,i) if n == nil then break elseif n == "OnSetOwner" then GLOBAL.debug.setupvalue(inst._ctor,i,function(inst) v(inst) print("Hooked!") end) end end end) This prints nothing. Unless you had something different or another player join you. Clean the logs and try again.
  12. The upvalue hacker edits upvalues. What's an upvalue? local something local function fn() return something + 2 end something is an upvalue of fn. In this case, OnSetOwner is an upvalue of the constructor function. Why doesn't it work? Because the constructor function runs before you edit the upvalue from where it will take the value to use for ListenForEvent. local ac = GLOBAL.require("components/age") local fn = UpvalueHacker.FindUpvalue(ac._ctor, "OnSetOwner") local function OnSetOwner(...) print("OnSetOwner") return fn(...) end UpvalueHacker.SetUpvalue(ac._ctor, OnSetOwner, "OnSetOwner")
  13. Fix (modmain): local AllRecipes = GLOBAL.AllRecipes for k, v in pairs(AllRecipes) do v.level.CAVESCIENCE = 0 end Happens to everybody with a bonus. Because the recipes are built before modmain edits AVAILABLE_TECH, that level info is missing.