Hey Everyone, sorry for the long delay.
@Relyss, re: the juniper/candyfloss trees:
@RepeatPan is totally right:
So your code was probably adding a model var array above the existing array, and lucky, the new one got read first. The actual version of the model variant that is read (if there are unexpectedly multiple) might be nondeterministic, so that might be why it works sometimes, but not others. I see why you want to do it this way, though–you want variants of the same tree, right? We’ll keep this in mind going forward.
@SteveAdamo is also correct, this is the same design issue he encountered when new personality types.
The short version is: thanks for beating on the API so we can be aware of what your use cases are trying to do that we haven’t thought of yet!
@Avairian, re: [quote=“Avairian, post:147, topic:5229”]
Not quite related to mixintos and overrides but I was wondering if you could explain how animations work with objects?
[/quote]
Right now, the region does indeed determine how close a person can stand to an object, but I don’t yet think that it affects the y (height) axis of interaction. If the y height is >=3, people cannot path over the object but if it’s less than 3 they walk right through.
To get sleeping on the bed to work, we tell the worker to go exactly to where the bed is, plus a unit of “1” and then run the same sleep animation he gets on the ground. Here’s our lua:
--[[
Follow the path to the bed, then play the sleep-related animations.
--]]
function SleepInBedAdjacent:run(ai, entity, args)
local bed = args.bed
ai:execute('stonehearth:run_effect', { effect = 'yawn' })
--When sleeping, we have a small chance of dreaming
radiant.events.trigger(stonehearth.personality,
'stonehearth:journal_event',
{entity = entity, description = 'dreams'})
-- move directly on top of the bed
self._restore_location = radiant.entities.get_world_grid_location(entity)
local bed_location = radiant.entities.get_world_grid_location(bed)
bed_location.y = bed_location.y + 1
radiant.entities.move_to(entity, bed_location)
local q = bed:get_component('mob'):get_rotation()
entity:get_component('mob'):set_rotation(q)
-- goto sleep
radiant.entities.think(entity, '/stonehearth/data/effects/thoughts/sleepy')
radiant.entities.add_buff(entity, 'stonehearth:buffs:sleeping');
ai:execute('stonehearth:run_effect', { effect = 'goto_sleep' })
ai:execute('stonehearth:run_effect_timed', { effect = 'sleep', duration = 1})
radiant.entities.set_attribute(entity, 'sleepiness', 0)
end
So you could try making a lua file that specifies a height of less than 1, and seeing what happens.
Let me know if you guys would like more info about adding/editing actions via lua. It’s rather in flux at the moment, but hey! Exciting!