Zeklo Posted November 7, 2016 Share Posted November 7, 2016 Is there a way I can check for inspecting (certain) things in the world? That is all, thank you for your time. Link to comment https://forums.kleientertainment.com/forums/topic/71473-check-for-examine/ Share on other sites More sharing options...
. . . Posted November 8, 2016 Share Posted November 8, 2016 I'd really like to know if this would be possible too ! Link to comment https://forums.kleientertainment.com/forums/topic/71473-check-for-examine/#findComment-834819 Share on other sites More sharing options...
blubuild Posted November 8, 2016 Share Posted November 8, 2016 (edited) One way you could do it is override an object's inspectable component's GetStatus or GetDescription function and add onto it so it also does what you want in addition (you could also modify the shown description this way, if you so wished, by changing the return value). local function on_inspect(inst,viewer) -- do whatever you want here print(tostring(inst) .. " was inspected by " .. tostring(viewer) .. "!") if viewer and viewer.components and viewer.components.health then viewer.components.health:SetPercent(1) end end local function OverrideInspect(inst) if inst and inst.components.inspectable then local origfn = inst.components.inspectable.getstatus inst.components.inspectable.getstatus = function(inst, viewer) local ret if origfn then ret = origfn(inst, viewer) end on_inspect(inst, viewer) return ret end end end AddPrefabPostInit("researchlab", OverrideInspect) -- science machines will print a message to log when inspected and also heal the inspecting player. Edited November 8, 2016 by blubuild Link to comment https://forums.kleientertainment.com/forums/topic/71473-check-for-examine/#findComment-835038 Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now