Jump to content

Recommended Posts

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 by justjasper
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 by Aquaterion
removed first line, wasnt required
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 by justjasper
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 by spideswine

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
  • Create New...