Create liquids mod

This commit is contained in:
Van
2025-10-11 16:59:32 +03:00
parent eff948e210
commit 9f4cc443c5
4 changed files with 97 additions and 1 deletions

View File

@@ -1,3 +1,3 @@
name = smc__game__items__items_loader
description = Include this mod in your `depends` to ensure all items are registered
depends = smc__game__items__rocks, smc__game__items__log,
depends = smc__game__items__rocks, smc__game__items__log, smc__game__items__soils, smc__game__items__liquids

View File

@@ -0,0 +1,94 @@
---@type Node.NodeDefinition
local defaultLiquidDef = {
settings = {
name = '',
tiles = {},
waving = 3,
use_texture_alpha = "blend",
paramtype = "light",
walkable = false,
pointable = false,
diggable = false,
buildable_to = true,
is_ground_content = false,
drop = "",
drowning = 1,
liquid_viscosity = 1,
groups = {water = 3, liquid = 3,}
}
}
---@type Node
local defaultLiquid = Core.Node.Class:getExtended(defaultLiquidDef)
local liquidFactory = defaultLiquid:getFactory()
liquidFactory:registerItems({
---@type Node.NodeDefinition
{
settings = {
name = "liquids:water_source",
drawtype = "liquid",
tiles = {
{
name = "liquids_water_source.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0,
},
},
{
name = "liquids_water_source.png",
backface_culling = true,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 2.0,
},
},
},
liquidtype = "source",
liquid_alternative_flowing = "liquids:water_flowing",
liquid_alternative_source = "liquids:water_source",
}
},
---@type Node.NodeDefinition
{
settings = {
name = "liquids:water_flowing",
drawtype = "flowingliquid",
tiles = {"default_water.png"},
special_tiles = {
{
name = "default_water_flowing_animated.png",
backface_culling = false,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 0.5,
},
},
{
name = "default_water_flowing_animated.png",
backface_culling = true,
animation = {
type = "vertical_frames",
aspect_w = 16,
aspect_h = 16,
length = 0.5,
},
},
},
liquidtype = "flowing",
liquid_alternative_flowing = "liquids:water_flowing",
liquid_alternative_source = "liquids:water_source",
paramtype2 = "flowingliquid",
}
}
}, false)

View File

@@ -0,0 +1,2 @@
name = smc__game__items__liquids
depends = smc__core__node

Binary file not shown.

After

Width:  |  Height:  |  Size: 4.2 KiB