Jump to content

Clay Lanterns 0.0.1 pre-alpha - Work In Progress (C# needed?)


Recommended Posts

I've been running into some issues with attempting to create this mod, so I figure the best thing is to just get the ball rolling, and see if anyone in the modding community already knows how to finish it.

I'm not sure if it will require any C# coding to do it right, and I know very little about C#, so I wouldn't want to even try, especially if it's not necessary. 

I am only including the current Mod file for someone to start working on, and it is not intended to be run by anyone yet, hence the version number.

Anyway, I love the Oil Lamps, and they are an awesome idea for a simple light source, but naturally, we could use something more in-depth to build that takes it a step farther. The amount of work and progression it takes for a Metal Lantern is a bit too much just for a waterproof light source. Finding Resin is enough of a challenge to make a dimly lit but waterproof torch (See my Resin Renaissance mod). Likewise, these of course will come with the drawback of giving off a dimmer and more orange-reddish light.

I basically just combined the Clay Oil Lamp with a Lantern. In fact, I even did an Import of the Lantern model, so this new model is built in the exact proportion to the metal ones.

claylantern.thumb.png.33eed9e2c91402c1fc580ef3fd785a22.png

The issue that's confusing me is how to handle the need for adding fuel item(s) (Animal Fat, Pine Resin, and Peat), and I don't know whether or not it should also require a Quartz or Glass block the same way as a Lantern. 

I want there to be a Crafting Grid recipe for it as well, much like the Clay Crafting mod I upgraded from NoModeling. The recipe would be a full circle of clay around Animal Fat, Peat, Resin, or Quartz/glass -- just something to indicate that it's a Clay Lantern and not a Storage Vessel.


Besides all the details, though, I almost got it to work. Using the Clay Modeling to build it was an awesome experience. Such a simple file format for laying out a complicated building system. And modeling it to the same scale was effortless too, one block of clay is naturally one unit in modeling space. 

So my attempts at building it and attaching it to a wall worked okay. The major issue was that the Handbook page for the item was causing a game crash. The Stack Trace was giving me "Can't create itemstack without block!", in the GameContent.BlockLantern.OnPickBlock. I tried calling it a BlockTorch instead, and was getting errors in "GetHandbookDropsFromBreakDrops". Not sure if any of that would help anyway because maybe this needs an entirely new Block Class. It won't support upgrading with Metal Plates, and as I said, I don't know if it should need Glass either.

At the very least I know I need Variants system somehow. The confusion is that the Crafting Grid results in an item that already has fuel, but hasn't been fired yet, whereas you cannot add fuel during a Clay Modeling build. And in real life, firing it with fuel in it would burn off the fuel. But then maybe that's the penalty for using the Grid, the fuel you use in the Grid doesn't count, and you need to add extra fuel to it after it's fired. That doesn't feel entirely fair either, except that using Peat in the Grid would make it feasible since Peat is so easy to find.

Anyway, if someone else wants to take this one to the finish line, feel free to do so, and put your name in the Contributors or Authors, whichever feels right for the work it takes you. I'm really hoping it doesn't require C# coding, simply because it's always best to piggy back on existing technology. This entire project revolves around that idea, and it's all the better for it. 

Here's the JSON code so far, mostly copied from the existing Lantern code. And wow, the Code tag supports JavaScript. I wonder how hard it would be to expand it for all the Vintage Story keywords? And to give it some better colors, but it's better than nothing.

The second spoiler is the Clay Modeling Recipe. Pretty sure it's accurate, might need an extra layer of the 4 pillars, but the model itself is exactly the proportions of the Lantern.

Spoiler


{
    code: "claylantern",
    classByType: {
        "*-raw": "Block",
        "*-burned": "BlockLantern",
    },
    entityclassByType: {
        "*-raw": null,
        "*-burned": "Lantern",
    },
    variantgroups: [
        { code:"position", states: ["up", "down"], 
          loadFromProperties: "abstract/horizontalorientation" },
        { code:"materialtype", states: ["raw", "burned"] }
    ],
    behaviorsByType: {
        "*-raw": [ {name: "UnstableFalling"}, {name: "RightClickPickup" } ],
        "*-burned": [ 
            { name: "OmniAttachable", 
            properties: { 
                facingCode: "position",
                attachmentAreas: {
                "down": { x1: 7, y1: 15, z1: 7, x2: 8, y2: 15, z2: 8 },
                "up": { x1: 4, y1: 0, z1: 4, x2: 11, y2: 0, z2: 11 },
                "north": { x1: 7, y1: 11, z1: 0, x2: 8, y2: 13, z2: 1 },
                "east": { x1: 7, y1: 11, z1: 0, x2: 8, y2: 13, z2: 1, rotateY: 90 },
                "south": { x1: 7, y1: 11, z1: 0, x2: 8, y2: 13, z2: 1, rotateY: 180 },
                "west": { x1: 7, y1: 11, z1: 0, x2: 8, y2: 13, z2: 1, rotateY: 270 }
                },
            }
            },
            { name: "RightClickPickup" } 
        ]
    },
    attributesByType: {
        "*": {
            dropSelf: true,
            handbook: { include: false }
        },
        "*-up-*": {
            handbook: { include: false }
        }
    },    
    drops: [],
    storageFlags: 257,
    heldRightTpIdleAnimation: "holdinglanternrighthand",
    heldLeftTpIdleAnimation: "holdinglanternlefthand",
    creativeinventory: { "general": ["*-up-*"], "decorative": ["*-up-*"] },
    combustiblePropsByType: {
        "*-raw": {
            meltingPoint: 600,
            meltingDuration: 45,
            smeltedRatio: 1,
            smeltingType: "bake",
            smeltedStack: { type: "block", code: "claylantern-up-burned" },
            requiresContainer: false
        }
    },
    shapebytype: {
        "claylantern-up-*": { base: "block/clay/claylantern/ground" },
        "claylantern-down-*": { base: "block/clay/claylantern/ceiling" },
        "claylantern-north-*": { base: "block/clay/claylantern/wall", rotateY: 180 },
        "claylantern-east-*": { base: "block/clay/claylantern/wall", rotateY: 90 },
        "claylantern-south-*": { base: "block/clay/claylantern/wall", rotateY: 0 },
        "claylantern-west-*": { base: "block/clay/claylantern/wall", rotateY: 270 }
    },
    "_comment": "Must declare textures so they get added to the block texture atlas",
    texturesByType: {
        "*-raw": {  all: { base: "game:block/clay/blueclay" } },
        "*-burned": {  all: { base: "game:block/clay/ceramic-dark" } }
    },
    blockmaterial: "Ceramic",
    lightAbsorption: 0,
    lightHsvByType:{
        "*-burned": [5, 4, 16]
    },
    sidesolid: {
        all: false
    },
    sideopaque: {
        all: false
    },
    replaceable: 500,
    resistance: 1,
    particlePropertiesByType: {
        "*-burned": [
            {
            hsvaColor: [{ avg: 20, var: 20 }, { avg: 255, var: 50 }, { avg: 255, var: 50 },  { avg: 255, var: 0 }],
            gravityEffect: { avg: 0, var: 0 },
            posOffset: [ { avg: 0, var: 0.1 }, { avg: 0, var: 0 }, { avg: 0, var: 0.1 }],
            velocity: [ { avg: 0, var: 0.025 }, { avg: 0.1, var: 0.1 }, { avg: 0, var: 0.025 }],
            quantity: { avg: 0.015 },
            size: { avg: 0.5, var: 0 },
            sizeEvolve: { transform: "quadratic", factor: -0.7 },
            lifeLength: { avg: 1.5 },
            vertexFlags: 128
        },
        {
            hsvaColor: [{ avg: 0, var: 0 }, { avg: 0, var: 0 }, { avg: 40, var: 30 },  { avg: 220, var: 50 }],
            opacityEvolve: { transform: "quadratic", factor: -16 },
            gravityEffect: { avg: 0, var: 0 },
            posOffset: [ { avg: 0, var: 0.1 }, { avg: 0, var: 0 }, { avg: 0, var: 0.1 }],
            velocity: [ { avg: 0, var: 0.025 }, { avg: 0.05, var: 0.1 }, { avg: 0, var: 0.025 }],
            quantity: { avg: 0.05 },
            size: { avg: 0.3125, var: 0.05 },
            sizeEvolve: { transform: "linear", factor: 0.5 },
            particleModel: "Quad"
        }
        ]
    },
    fpHandTransform: {
        translation: { x: 0.3, y: -0.1, z: 0 },
        rotation: { x: 0, y: -45, z: 0 },
        scale: 1.18
    },
    guiTransform: {
        origin: { x: 0.5, y: 0.3, z: 0.5 },
        scale: 1.5
    },
    tpHandTransform: {
        translation: { x: -0.59, y: -0.89, z: -0.83 },
        rotation: { x: 0, y: -8, z: -96 },
        scale: 0.55
    },
    groundTransform: {
        origin: { x: 0.5, y: 0, z: 0.5 },
        scale: 2
    },
    selectionboxbytype: {
        "*-up-*": { x1: 0.25, y1: 0, z1: 0.25, x2: 0.75, y2: 0.75, z2: 0.75 },
        "*-down-*": { x1: 0.25, y1: 0, z1: 0.25, x2: 0.75, y2: 1, z2: 0.75 },
        "*-east-*": { x1: 0.25, y1: 0, z1: 0.25, x2: 0.75, y2: 0.875, z2: 1, rotateY: 270 },
        "*-south-*": { x1: 0.25, y1: 0, z1: 0.25, x2: 0.75, y2: 0.875, z2: 1, rotateY: 180 },
        "*-west-*": { x1: 0.25, y1: 0, z1: 0.25, x2: 0.75, y2: 0.875, z2: 1, rotateY: 90 },
        "*-north-*": { x1: 0.25, y1: 0, z1: 0.25, x2: 0.75, y2: 0.875, z2: 1, rotateY: 0 }
    },
    collisionboxbytype: {
        "*-up-*": { x1: 0.25, y1: 0, z1: 0.25, x2: 0.6875, y2: 0.75, z2: 0.75 },
        "*-down-*": { x1: 0.25, y1: 0, z1: 0.25, x2: 0.75, y2: 1, z2: 0.75 },
        "*-east-*": { x1: 0.25, y1: 0, z1: 0.25, x2: 0.75, y2: 0.875, z2: 1, rotateY: 270 },
        "*-south-*": { x1: 0.25, y1: 0, z1: 0.25, x2: 0.75, y2: 0.875, z2: 1, rotateY: 180 },
        "*-west-*": { x1: 0.25, y1: 0, z1: 0.25, x2: 0.75, y2: 0.875, z2: 1, rotateY: 90 },
        "*-north-*": { x1: 0.25, y1: 0, z1: 0.25, x2: 0.75, y2: 0.875, z2: 1, rotateY: 0 }
    }
}

 

 

Spoiler

{
	ingredient: { type: "item", code: "game:clay-*", name: "type", allowedVariants: ["blue", "fire"] },
	pattern: [[
		"___________",
		"_____#_____",
		"_____#_____",
		"___#####___",
		"___#####___",
		"_#########_",
		"___#####___",
		"___#####___",
		"_____#_____",
		"_____#_____",
		"___________"
	],
	[
		"___________",
		"_____#_____",
		"___________",
		"___#####___",
		"___#___#___",
		"_#_#___#_#_",
		"___#___#___",
		"___#####___",
		"___________",
		"_____#_____",
		"___________"
	],
	[
		"___________",
		"_____#_____",
		"___________",
		"___________",
		"___________",
		"_#_______#_",
		"___________",
		"___________",
		"___________",
		"_____#_____",
		"___________"
	],
	[
		"___________",
		"_____#_____",
		"___________",
		"___________",
		"___________",
		"_#_______#_",
		"___________",
		"___________",
		"___________",
		"_____#_____",
		"___________"
	],
	[
		"___________",
		"_____#_____",
		"___________",
		"___________",
		"___________",
		"_#_______#_",
		"___________",
		"___________",
		"___________",
		"_____#_____",
		"___________"
	],
	[
		"___________",
		"_____#_____",
		"___________",
		"___________",
		"___________",
		"_#_______#_",
		"___________",
		"___________",
		"___________",
		"_____#_____",
		"___________"
	],
	[
		"___________",
		"_____#_____",
		"___________",
		"___________",
		"___________",
		"_#_______#_",
		"___________",
		"___________",
		"___________",
		"_____#_____",
		"___________"
	],
	[
		"___________",
		"_____#_____",
		"___________",
		"___________",
		"___________",
		"_#_______#_",
		"___________",
		"___________",
		"___________",
		"_____#_____",
		"___________"
	],
	[
		"_____#_____",
		"____###____",
		"___#####___",
		"__#######__",
		"_#########_",
		"###########",
		"_#########_",
		"__#######__",
		"___#####___",
		"____###____",
		"_____#_____"
	],
	[
		"___________",
		"_____#_____",
		"___________",
		"___#####___",
		"___#####___",
		"_#_#####_#_",
		"___#####___",
		"___#####___",
		"___________",
		"_____#_____",
		"___________"
	],
	[
		"___________",
		"___________",
		"___________",
		"___________",
		"____###____",
		"____###____",
		"____###____",
		"___________",
		"___________",
		"___________",
		"___________"
	]
	],
	name: "claylantern",
	output: { type: "block", code: "claylantern-up-raw"  }
}

 

Again, this download link is not intended to be used yet, unless you are going to help develop it.

ClayLantern-0.0.1-pre-alpha.zip

 

Edited by Jobediah Timberman
Link to comment
Share on other sites

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.