custom tomb wall lantern

Ask for help about creating mods and scripts for Grimrock 2 or share your tips, scripts, tools and assets with other modders here. Warning: forum contains spoilers!
Post Reply
bongobeat
Posts: 1076
Joined: Thu May 16, 2013 5:58 pm
Location: France

custom tomb wall lantern

Post by bongobeat »

Hello,
just wanna ask how to make a custom wall lantern to work exactly like the tomb wall lantern, with the optimization stuff that disable casting light toward walls:

this one doesn't work, the light goes trough wall:
I have just changed the light color in the object definition and the custom particle.
What Is something wrong? Why this is not working?
SpoilerShow

Code: Select all

defineObject{
	name = "skycity_tomb_wall_lantern",
	baseObject = "tomb_wall_lantern",

	components = {
		{
			class = "Light",
			offset = vec(0, 1.55, -0.12),
			range = 10,
			color = vec(1, 0.5, 0.1),
			brightness = 10,
			castShadow = false,
			staticShadows = true,
			onInit = function(self)
				-- optimization: disable casting light behind the wall
				local face
				if self.go.facing == 2 then
					-- disable -Z
					face = 5
				elseif self.go.facing == 3 then
					-- disable -X
					face = 1
				elseif self.go.facing == 0 then
					-- disable +Z
					face = 4
				elseif self.go.facing == 1 then
					-- disable +X
					face = 0
				end
				self:setClipDistance(face, 0)
			end,
		},
		{
			class = "Particle",
			particleSystem = "skycity_wall_lantern",
			offset = vec(0, 1.55, -0.12),
		},
	},
}
Edit:
Work now. It wouldn't work because I ve set the cast shadow to false. Weird!
My asset pack: viewtopic.php?f=22&t=9320

Log1 mod : Toorum Manor: viewtopic.php?f=14&t=5505
Post Reply