Jump to content

Recommended Posts

As some of you know, me and @6480 we did the mod that fixed Wilson Snowfallen's beard. So we liked it so much that we decided to give continuity and release beard skins to the other skins of the Wilson.

But we are in a little trouble, we are not very good programmers. It would not be practical to launch a separate mod, beard by beard, ideally the beard would change automatically depending on the skin

We already have a coder, @IronHunter, thanks for contributing to the mod <3

Mod link: https://steamcommunity.com/sharedfiles/filedetails/?id=1379703510

We already have some concepts ready and we have already started working on the mod, also any suggestion of style of beard is welcome, gradually we will update the images that are here, see some:

 

Update 1: The code part of the Mod in server mode is ready. The beard changes automatically according to the "head" of Wilson used.

Update 2: Concept of triumphant Wilson beard.

Update 3: Mod icon added.

Update 4: Concept of Gladiator Wilson bear.

HwEXjwm.png

GYhFz6g.png

8iFNkmz.png

2RqUlbf.png

teKp5k1.png

ZtJGMoC.png

QfutSOj.png

 

 

Screenshots>

L9ciXWU.png

9vhOFeV.png

Edited by FuriousBr

Hmm wouldn't hooking into the beard components beard growth to change the callback functions to check for your characters headskin then overide the beard symbol with the proper equivalent be the foundation for this type of mod?

What exactly coding wise do you need help with?

32 minutes ago, IronHunter said:

Hmm wouldn't hooking into the beard components beard growth to change the callback functions to check for your characters headskin then overide the beard symbol with the proper equivalent be the foundation for this type of mod?

What exactly coding wise do you need help with?

Yes, the mod will analyze the character's head skin, then replace the texture of the beard. I know this is possible, on account of the mod"essential skins" that added skin to the ghosts according to the skin used ...

39 minutes ago, FuriousBr said:

Yes, the mod will analyze the character's head skin, then replace the texture of the beard. I know this is possible, on account of the mod"essential skins" that added skin to the ghosts according to the skin used ...

Using the skinner component

local skins = inst.components.skinner:GetClothing()
--returns a table of skins
for k, v in pairs(skins) do
	print(tostring(v))
end
--returns a list of all the skins
--can also be accessed via pointing to the table.variables
--local skins = inst.components.skinner:GetClothing() which returns 
--{ 
--   base,
--   body,
--   hand,
--   legs,
--   feet,
--}
--so skins.base returns the head skin for example etc.

Now that you have the way of getting the skin names e.g. wilson_ice

You'll have to inject some code into wilson's beard callbacks and make it so it updates when you change skins.

In continuation of private message,

Spoiler

----------------------------
----< Wilson Beard Fix >----
----< By: Iron_Hunter  >----
----------------------------
local function pairsByKeys (t, f)
	local a = {}
	for n in pairs(t) do table.insert(a, n) end
	table.sort(a, f)
	local i = 0      -- iterator variable
	local iter = function ()   -- iterator function
		i = i + 1
		if a[i] == nil then return nil
		else return a[i], t[a[i]]
		end
	end
	return iter
end
local function OnGrowSkinBeard(inst, beardsize)
	inst.beardsize = beardsize
	print(inst.components.skinner.skin_name)
	if inst.components.skinner.skin_name ~= (inst.prefab .. "_none" or "" or nil)then
		inst.AnimState:OverrideSymbol("beard", "beard_"..inst.components.skinner.skin_name, "beard_"..beardsize)
	end
end
AddPrefabPostInit("wilson", function(inst)
	if GLOBAL.TheWorld.ismastersim then	
		if not inst.components.beard then inst:AddComponent("beard") end
		local beardsize = "short" --this is a temporary variable
		for day, cb in pairsByKeys (inst.components.beard.callbacks) do --despite looking complicated it is sorting them in numerical order so we can provide some compatibility with other mods that change the growth time etc.
			if cb ~= nil then
				if beardsize == "short" then
					inst.components.beard.callbacks[day] = function(inst) 
						cb(inst)--linking to the old OnGrowBeardShort
						OnGrowSkinBeard(inst, "short")
					end
					beardsize = "medium"
				elseif beardsize == "medium" then
					inst.components.beard.callbacks[day] = function(inst) 
						cb(inst)--linking to the old OnGrowBeardMedium
						OnGrowSkinBeard(inst, "medium")
					end
					beardsize = "long"
				elseif beardsize == "long" then
					inst.components.beard.callbacks[day] = function(inst) 
						cb(inst)--linking to the old OnGrowBeardLong
						OnGrowSkinBeard(inst, "long")
					end
					beardsize = nil
				end
			end
			--print(tostring(day).." "..tostring(cb))
		end
	end
end)
AddComponentPostInit("wardrobe", function(self)
	self.OldApplySkins = self.ApplySkins
	function self:ApplySkins(doer, diff)
		self:OldApplySkins(doer, diff)
		if doer.components.beard and doer.beardsize ~= nil then
			if doer.components.skinner.skin_name ~= doer.prefab .. "_none" then
				OnGrowSkinBeard(doer, doer.beardsize)
			else
				if doer.prefab == "wilson" then
					doer.AnimState:OverrideSymbol("beard", "beard", "beard_"..doer.beardsize)
				end
			end
		end
	end
end)

First public version, it is developed to be automatically extendable for all skins for wilson as long as the beards are set up properly.

It is also is currently developed for future characters that could have this feature.

beard_wilson_ice.zip

Edited by IronHunter
attachments
5 hours ago, Aquaterion said:

s it on purpose that the ice beard's blue is not the same as the hair's blue?

The difference in coloring is only sharp because I put the beard externally, but with the game station filters is almost Imperceptible, see ingame: Kvnm4Xs.png

Edited by FuriousBr

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