justjasper Posted January 28, 2018 Share Posted January 28, 2018 (edited) A year on since I had no luck getting this mod to work,and I'm back and determined to make another go at it. The mod: craftable gravestones you can write on ("engrave") like signs, for marking locations or deaths etc. Imagine making a graveyard dedicated to all your fallen beefalo mounts, your pigman warriors, your spider pals. Unfortunately, adding the "writeable" component has proved a bit of a nightmare. I thought it would be as simple as adding the "writeable" tag, but of course not. At present the mod contains a lot of frankencode from the (now outdated) Domestication Plus mod, as it's the only mod I've found that makes use of the "writeable" component. If anyone could give me any help, be it actual code, insight, or just ideas to try, please do! Craftable Gravestones (DST).rar Edited January 28, 2018 by justjasper Link to comment https://forums.kleientertainment.com/forums/topic/86862-custom-item-using-writeable-component-solved/ Share on other sites More sharing options...
Aquaterion Posted January 28, 2018 Share Posted January 28, 2018 (edited) local Writeables = GLOBAL.require"writeables" local randomgravetexts = { "Here lies the dead", "Will be missed", "Resting in pieces" } local grave = { prompt = "Write on the grave", animbank = "ui_board_5x3", animbuild = "ui_board_5x3", menuoffset = GLOBAL.Vector3(6, -70, 0), cancelbtn = { text = "Cancel", cb = nil, control = CONTROL_CANCEL }, middlebtn = { text = "Random", cb = function(inst, doer, widget) widget:OverrideText( randomgravetexts[math.random(GLOBAL.GetTableSize(randomgravetexts))] ) end, control = CONTROL_MENU_MISC_2 }, acceptbtn = { text = "Engrave", cb = nil, control = CONTROL_ACCEPT }, } local oldMakeScreen = Writeables.makescreen Writeables.makescreen = function(inst, doer) if inst.prefab == "homesign" or inst.prefab == "arrowsign_panel" or inst.prefab == "arrowsign_post" then--the defaults oldMakeScreen(inst, doer) else if doer and doer.HUD then return doer.HUD:ShowWriteableWidget(inst, grave) end end end This should work(modmain.lua). Should be the only code you need, other than the prefab code. Edited January 28, 2018 by Aquaterion removed first line, wasnt required Link to comment https://forums.kleientertainment.com/forums/topic/86862-custom-item-using-writeable-component-solved/#findComment-996780 Share on other sites More sharing options...
justjasper Posted January 28, 2018 Author Share Posted January 28, 2018 (edited) 10 hours ago, Aquaterion said: This should work(modmain.lua). Should be the only code you need, other than the prefab code. It works, thanks so much! Just got to sort out my build a bit and we're away. EDIT: Craftable Gravestones is now on the Workshop! Edited January 28, 2018 by justjasper Link to comment https://forums.kleientertainment.com/forums/topic/86862-custom-item-using-writeable-component-solved/#findComment-996887 Share on other sites More sharing options...
spideswine Posted January 29, 2018 Share Posted January 29, 2018 (edited) On 1/28/2018 at 5:04 AM, justjasper said: for marking locations or deaths etc. Imagine making a graveyard dedicated to all your fallen beefalo mounts, your pigman warriors, your spider pals. So a fridge? Edited January 29, 2018 by spideswine Link to comment https://forums.kleientertainment.com/forums/topic/86862-custom-item-using-writeable-component-solved/#findComment-997149 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