Jump to content

Better Warly's QoL mod support and special description improvements


ADM

Recommended Posts

The recent update made it so Warly tells the player if the inspected food has been eaten recently or not. While that is great, there's one thing I would like to suggest so this QoL automatically supports food mods as there are many that may not get updated and also improve the way special description constructions is applied for character cases like that directly on them instead of concerned entities, at least in this case.
And talking from experience this could be useful in other situations where I definitively needed the things in the way I'll be showing.

Simply said so everyone get it, currently the food memory special quote is obtained from the Crock Pot items, using their inspectable.getspecialdescription, meaning mods that so far added more recipes, currently doesn't have the special description integrated to their own scripts, an update here is required just for that.

What I think would be better is to introduce talker.getspecialdescription or something like that so characters can have specific bonus descriptions of a bunch of things to fit their quirks. Here's how it could be done just by updating inspectable.GetDescription :

AND quite important I'm also bringing some adjustments so the description now evolve from one special case to another instead of getting replaced and stop at the first occasion ! I did as many tests as I could and every kinds of examinations seem to be alright with that. :)

function Inspectable:GetDescription(viewer)
	if self.inst == viewer then
		return
	elseif not CanEntitySeeTarget(viewer, self.inst) then
		return GetString(viewer, "DESCRIBE_TOODARK")
	end

	local desc, filter_context, author
	desc = self.description
	if viewer.components.talker ~= nil and viewer.components.talker.getspecialdescription ~= nil then
		-- for cases where the viewer has something peculiar to say before anything (i.e. warly and food)
		desc, filter_context, author = viewer.components.talker.getspecialdescription(viewer, self.inst, desc)
	end
	if self.getspecialdescription ~= nil then
		-- for cases where we need to do additional processing before calling GetDescription (i.e. player skeleton)
		desc, filter_context, author = self.getspecialdescription(self.inst, viewer, desc)
	end
	if self.descriptionfn ~= nil then
		desc = self.descriptionfn(self.inst, viewer, desc)
	end
	
	if desc == nil or viewer:HasTag("playerghost") or viewer:HasTag("mime") then
		-- force the call for ghost/mime
		return GetDescription(viewer, self.inst, self:GetStatus(viewer))
	elseif self.inst.components.burnable ~= nil and self.inst.components.burnable:IsSmoldering() then
		return GetString(viewer, "DESCRIBE_SMOLDERING")
	end
	
	return desc, filter_context, author
end

Demonstrated here on Island Adventures without the recent Warly QoL :

0-.jpg.9736e6b78362da9a35a4143b6b25173e.jpg

It's personally something I've been needing for a while which could benefit mods a lot on top of skipping a Warly change that would outdate them, other options would be using AddPrefabPostInitAny for all possible concerned entities that need to contain a special description, which might already have one, or of course overriding the GetDescription for all specific needs... but the above is what'd be better to go with.

 

Edit : forgot to post Warly's side of the suggestion :

local function getdesc(inst, viewed, desc)
	if viewed ~= nil and inst.components.foodmemory ~= nil and inst.components.foodmemory:GetMemoryCount(viewed.prefab) > 0 then
		return GetString(inst, "ANNOUNCE_FOODMEMORY")
	end
	
	return desc
end

--local function master_postinit(inst)
	inst.components.talker.getspecialdescription = getdesc
--end

 

  • Developer

Doing it like this would restrict the food memory from mods that add food memory component to their player and would like Warly behaviour to replicate. I have added a general function that handles adding onto a string for the now two edge cases for adding stings onto the inspection quote. It will require function hooking for mods but I feel it is a good compromise.

Archived

This topic is now archived and is closed to further replies.

Please be aware that the content of this thread may be outdated and no longer applicable.

×
  • Create New...