Ok.. this is getting wierd

The code below will work fine, as long as you DONT unlock it with a lockpick.. then it bug's out (as the lock-Component doesn't get removed, and then you cant click stuff in the chest)... If you use a key its fine, but the native click-event still fires, and types "Locked." on the hud.
It's basically the same as my first one (where i dont override the "lock") but here i remove the LockComponent after it has triggered.
Problem is the click-event can't be replaced, because it does things that are not available through the modding-script-Engine at this time. (onBeginMouseLook etc)
Code: Select all
defineObject {
name = "chest_padlocked",
baseObject = "chest",
components = {
{
class = "Lock",
name = "keylock",
openedBy = "iron_key",
onActivate = function(self)
self.go.chest:setLocked(false)
self.go.animation:stop()
self.go:removeComponent("keylock")
end,
},
{
class = "Animation",
animations = {
lock = "assets/animations/env/treasure_chest_open.fbx",
open = "assets/animations/env/treasure_chest_open.fbx",
close = "assets/animations/env/treasure_chest_close.fbx",
}
},
}
}
tbh... if i was to implement it, i would prob. use scotty's version of just putting a custom click-event after the original one.