Skip to content
Snippets Groups Projects
Commit 90ac7ced authored by DarkGod's avatar DarkGod
Browse files

unfinished!

parent 3e2bbb64
No related branches found
No related tags found
No related merge requests found
Showing
with 532 additions and 212 deletions
...@@ -2778,6 +2778,14 @@ function _M:checkEncumbrance() ...@@ -2778,6 +2778,14 @@ function _M:checkEncumbrance()
end end
end end
--- Return attachement coords
function _M:attachementSpot(kind, particle)
if not self.attachement_spots or not self.attachement_spots[kind] then return end
local x, y = 0, 0
if particle then x, y = -0.5, -0.5 end
return self.attachement_spots[kind].x + x, self.attachement_spots[kind].y + y
end
--- Update tile for races that can handle it --- Update tile for races that can handle it
function _M:updateModdableTile() function _M:updateModdableTile()
if not self.moddable_tile or Map.tiles.no_moddable_tiles then return end if not self.moddable_tile or Map.tiles.no_moddable_tiles then return end
......
...@@ -127,10 +127,11 @@ newBirthDescriptor{ ...@@ -127,10 +127,11 @@ newBirthDescriptor{
stats = { mag=5, wil=3, cun=1, }, stats = { mag=5, wil=3, cun=1, },
birth_example_particles = { birth_example_particles = {
function(actor) function(actor)
if core.shader.active(4) then actor:addParticles(Particles.new("shader_wings", 1, {infinite=1})) if core.shader.active(4) then local x, y = actor:attachementSpot("back", true) actor:addParticles(Particles.new("shader_wings", 1, {x=y, y=y, infinite=1}))
else actor:addParticles(Particles.new("wildfire", 1)) else actor:addParticles(Particles.new("wildfire", 1))
end end
end, end,
--[[
function(actor) function(actor)
if core.shader.active(4) then actor:addParticles(Particles.new("shader_ring_rotating", 1, {radius=1.1}, {type="flames", hide_center=0, time_factor=1700, zoom=0.3, npow=1, color1={0.6, 0.3, 0.8, 1}, color2={0.8, 0, 0.8, 1}, xy={0,0}})) if core.shader.active(4) then actor:addParticles(Particles.new("shader_ring_rotating", 1, {radius=1.1}, {type="flames", hide_center=0, time_factor=1700, zoom=0.3, npow=1, color1={0.6, 0.3, 0.8, 1}, color2={0.8, 0, 0.8, 1}, xy={0,0}}))
else actor:addParticles(Particles.new("ultrashield", 1, {rm=180, rM=220, gm=10, gM=50, bm=190, bM=220, am=120, aM=200, radius=0.4, density=100, life=8, instop=20})) else actor:addParticles(Particles.new("ultrashield", 1, {rm=180, rM=220, gm=10, gM=50, bm=190, bM=220, am=120, aM=200, radius=0.4, density=100, life=8, instop=20}))
...@@ -154,6 +155,7 @@ newBirthDescriptor{ ...@@ -154,6 +155,7 @@ newBirthDescriptor{
else actor:addParticles(Particles.new("tempest", 1)) else actor:addParticles(Particles.new("tempest", 1))
end end
end, end,
]]
}, },
talents_types = { talents_types = {
["spell/arcane"]={true, 0.3}, ["spell/arcane"]={true, 0.3},
......
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
-- Nicolas Casalini "DarkGod" -- Nicolas Casalini "DarkGod"
-- darkgod@te4.org -- darkgod@te4.org
local Particles = require "engine.Particles"
newBirthDescriptor{ newBirthDescriptor{
type = "class", type = "class",
name = "Warrior", name = "Warrior",
...@@ -231,6 +233,18 @@ newBirthDescriptor{ ...@@ -231,6 +233,18 @@ newBirthDescriptor{
unlockable_talents_types = { unlockable_talents_types = {
["spell/stone"]={false, 0.1, "mage_geomancer"}, ["spell/stone"]={false, 0.1, "mage_geomancer"},
}, },
birth_example_particles = {
function(actor) if core.shader.active(4) then
local slow = rng.percent(50)
local h1x, h1y = actor:attachementSpot("hand1", true) if h1x then actor:addParticles(Particles.new("shader_shield", 1, {img="fireball", a=0.7, size_factor=0.4, x=h1x, y=h1y-0.1}, {type="flamehands", time_factor=slow and 700 or 1000})) end
local h2x, h2y = actor:attachementSpot("hand2", true) if h2x then actor:addParticles(Particles.new("shader_shield", 1, {img="fireball", a=0.7, size_factor=0.4, x=h2x, y=h2y-0.1}, {type="flamehands", time_factor=not slow and 700 or 1000})) end
end end,
function(actor) if core.shader.active(4) then
local slow = rng.percent(50)
local h1x, h1y = actor:attachementSpot("hand1", true) if h1x then actor:addParticles(Particles.new("shader_shield", 1, {img="lightningwings", a=0.7, size_factor=0.4, x=h1x, y=h1y-0.1}, {type="flamehands", time_factor=slow and 700 or 1000})) end
local h2x, h2y = actor:attachementSpot("hand2", true) if h2x then actor:addParticles(Particles.new("shader_shield", 1, {img="lightningwings", a=0.7, size_factor=0.4, x=h2x, y=h2y-0.1}, {type="flamehands", time_factor=not slow and 700 or 1000})) end
end end,
},
talents = { talents = {
[ActorTalents.T_FLAME] = 1, [ActorTalents.T_FLAME] = 1,
[ActorTalents.T_ARCANE_COMBAT] = 1, [ActorTalents.T_ARCANE_COMBAT] = 1,
......
...@@ -50,6 +50,20 @@ newBirthDescriptor{ ...@@ -50,6 +50,20 @@ newBirthDescriptor{
}, },
random_escort_possibilities = { {"tier1.1", 1, 2}, {"tier1.2", 1, 2}, {"daikara", 1, 2}, {"old-forest", 1, 4}, {"dreadfell", 1, 8}, {"reknor", 1, 2}, }, random_escort_possibilities = { {"tier1.1", 1, 2}, {"tier1.2", 1, 2}, {"daikara", 1, 2}, {"old-forest", 1, 4}, {"dreadfell", 1, 8}, {"reknor", 1, 2}, },
moddable_attachement_spots = { base=128,
female = {
head = {x=66, y=19},
back = {x=66, y=51},
hand1 = {x=19, y=78},
hand2 = {x=110, y=78},
},
male = {
head = {x=65, y=20},
back = {x=65, y=51},
hand1 = {x=20, y=78},
hand2 = {x=110, y=78},
},
},
cosmetic_unlock = { cosmetic_unlock = {
cosmetic_race_human_redhead = { cosmetic_race_human_redhead = {
{name="Redhead [donator only]", donator=true, on_actor=function(actor) if actor.moddable_tile then actor.moddable_tile_base = "base_redhead_01.png" actor.moddable_tile_ornament={male="beard_redhead_02"} end end, check=function(birth) return birth.descriptors_by_type.sex == "Male" end}, {name="Redhead [donator only]", donator=true, on_actor=function(actor) if actor.moddable_tile then actor.moddable_tile_base = "base_redhead_01.png" actor.moddable_tile_ornament={male="beard_redhead_02"} end end, check=function(birth) return birth.descriptors_by_type.sex == "Male" end},
......
...@@ -56,6 +56,20 @@ newBirthDescriptor{ ...@@ -56,6 +56,20 @@ newBirthDescriptor{
}, },
random_escort_possibilities = { {"tier1.1", 1, 2}, {"tier1.2", 1, 2}, {"daikara", 1, 2}, {"old-forest", 1, 4}, {"dreadfell", 1, 8}, {"reknor", 1, 2}, }, random_escort_possibilities = { {"tier1.1", 1, 2}, {"tier1.2", 1, 2}, {"daikara", 1, 2}, {"old-forest", 1, 4}, {"dreadfell", 1, 8}, {"reknor", 1, 2}, },
moddable_attachement_spots = { base=128,
female = {
head = {x=64, y=6},
back = {x=66, y=34},
hand1 = {x=38, y=66},
hand2 = {x=90, y=66},
},
male = {
head = {x=60, y=6},
back = {x=64, y=31},
hand1 = {x=31, y=66},
hand2 = {x=95, y=66},
},
},
cosmetic_unlock = { cosmetic_unlock = {
cosmetic_race_human_redhead = { cosmetic_race_human_redhead = {
{name="Redhead [donator only]", donator=true, on_actor=function(actor) if actor.moddable_tile then actor.moddable_tile_base = "base_redhead_01.png" end end}, {name="Redhead [donator only]", donator=true, on_actor=function(actor) if actor.moddable_tile then actor.moddable_tile_base = "base_redhead_01.png" end end},
......
...@@ -24,12 +24,15 @@ if core.shader.active(4) then ...@@ -24,12 +24,15 @@ if core.shader.active(4) then
use_shader = {type="fireball"} use_shader = {type="fireball"}
base_size = 64 base_size = 64
local basedir = math.atan2(ty or 1, tx or 0)
local dir = math.deg(basedir)
return { return {
system_rotation = rng.range(0,359), system_rotationv = 3, system_rotation = 0 or dir, system_rotationv = 0,
generator = function() generator = function()
return { return {
life = 1000, life = 1000,
size = 40, sizev = 0, sizea = 0, size = 80, sizev = 0, sizea = 0,
x = 0, xv = 0, xa = 0, x = 0, xv = 0, xa = 0,
y = 0, yv = 0, ya = 0, y = 0, yv = 0, ya = 0,
...@@ -45,7 +48,7 @@ end, }, ...@@ -45,7 +48,7 @@ end, },
function(self) function(self)
self.ps:emit(1) self.ps:emit(1)
end, end,
1 1, "particles_images/fireball"
-------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------
......
...@@ -21,13 +21,12 @@ ...@@ -21,13 +21,12 @@
-- Advanced shaders -- Advanced shaders
-------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------
if core.shader.active(4) then if core.shader.active(4) then
use_shader = {type="fireball"} use_shader = {type="fireboom"}
base_size = 64 base_size = 64
local nb = 0 local nb = 0
return { return {
system_rotation = rng.range(0,359), system_rotationv = 5,
generator = function() generator = function()
return { return {
life = 16, life = 16,
...@@ -50,7 +49,7 @@ function(self) ...@@ -50,7 +49,7 @@ function(self)
end end
nb = nb + 1 nb = nb + 1
end, end,
1 1, "particles_images/fireboom"
-------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------
......
...@@ -44,9 +44,11 @@ use_shader = {type="fireball"} ...@@ -44,9 +44,11 @@ use_shader = {type="fireball"}
base_size = 64 base_size = 64
local nb = 0 local nb = 0
local basedir = math.atan2(ty or 1, tx or 0)
local dir = math.deg(basedir)
return { return {
system_rotation = rng.range(0,359), system_rotationv = 3, system_rotation = 0 or dir, system_rotationv = 0,
generator = function() generator = function()
return { return {
life = 10, life = 10,
...@@ -69,7 +71,7 @@ function(self) ...@@ -69,7 +71,7 @@ function(self)
end end
nb = nb + 1 nb = nb + 1
end, end,
1 1, "particles_images/fireball"
-------------------------------------------------------------------------------------- --------------------------------------------------------------------------------------
......
...@@ -22,7 +22,7 @@ base_size = 64 ...@@ -22,7 +22,7 @@ base_size = 64
local r = 1 local r = 1
local g = 1 local g = 1
local b = 1 local b = 1
local a = 1 local a = a or 1
return { generator = function() return { generator = function()
return { return {
...@@ -30,8 +30,8 @@ return { generator = function() ...@@ -30,8 +30,8 @@ return { generator = function()
life = 10, life = 10,
size = 2*38 * (size_factor or 1), sizev = 0, sizea = 0, size = 2*38 * (size_factor or 1), sizev = 0, sizea = 0,
x = (x or 0) * engine.Map.tile_w, xv = 0, xa = 0, x = (x or 0) * 64, xv = 0, xa = 0,
y = (y or 0) * engine.Map.tile_h, yv = 0, ya = 0, y = (y or 0) * 64, yv = 0, ya = 0,
dir = 0, dirv = dirv, dira = 0, dir = 0, dirv = dirv, dira = 0,
vel = 0, velv = 0, vela = 0, vel = 0, velv = 0, vela = 0,
......
...@@ -33,8 +33,8 @@ return { generator = function() ...@@ -33,8 +33,8 @@ return { generator = function()
life = life or 10, life = life or 10,
size = 64 * (size_factor or 1), sizev = 0, sizea = 0, size = 64 * (size_factor or 1), sizev = 0, sizea = 0,
x = x or 0, xv = 0, xa = 0, x = (x or 0) * 32, xv = 0, xa = 0,
y = y or -25, yv = 0, ya = 0, y = (y or -0.781) * 32, yv = 0, ya = 0,
dir = 0, dirv = dirv, dira = 0, dir = 0, dirv = dirv, dira = 0,
vel = 0, velv = 0, vela = 0, vel = 0, velv = 0, vela = 0,
......
game/modules/tome/data/gfx/particles_images/fireball.png

10.3 KiB

// Fireball uniform sampler2D tex;
// Awd uniform float tick;
// @AlexWDunn uniform float time_factor;
#ifdef GL_ES
precision highp float; vec4 permute( vec4 x ) {
#endif
uniform float tick; return mod( ( ( x * 34.0 ) + 1.0 ) * x, 289.0 );
#define saturate(oo) clamp(oo, 0.0, 1.0) }
// Quality Settings vec4 taylorInvSqrt( vec4 r ) {
#define MarchSteps 6
return 1.79284291400159 - 0.85373472095314 * r;
// Scene Settings
#define ExpPosition vec3(0.0) }
#define Radius 2.0
#define Background vec4(0.0, 0.0, 0.0, 0.0) float snoise( vec3 v ) {
// Noise Settings const vec2 C = vec2( 1.0 / 6.0, 1.0 / 3.0 );
#define NoiseSteps 4 const vec4 D = vec4( 0.0, 0.5, 1.0, 2.0 );
#define NoiseAmplitude 0.15
#define NoiseFrequency 1.0
#define Animation vec3(0.0, -3.0, 0.5)
uniform float speed;
// Colour Gradient
uniform vec4 color1;
uniform vec4 color2;
uniform vec4 color3;
uniform vec4 color4;
/*
#define color1 vec4(0.0, 0.0, 0.0, 0.0)
#define color2 vec4(0.5, 0.2, 0.0, 0.5)
#define color3 vec4(0.7, 0.2, 0.0, 0.7)
#define color4 vec4(1.0, 0.8, 0.0, 1.0)
//*/
/*
#define color1 vec4(0.0, 0.0, 0.0, 0.0)
#define color2 vec4(.0, .0, 1.0, 0.3)
#define color3 vec4(0.0, 1.03, 1.0, 0.5)
#define color4 vec4(0.05, 0.02, 0.2, 0.8)
*/
/* Bright fel-green
#define color1 vec4(1.0, 1.0, 1.0, 1.0)
#define color2 vec4(1.0, 0.8, 0.2, 1.0)
#define color3 vec4(1.0, 0.8, 0.0, 1.0)
#define color4 vec4(0.6, 0.6, 0.1, 1.0)
*/
// Description : Array and textureless GLSL 2D/3D/4D simplex
// noise functions.
// Author : Ian McEwan, Ashima Arts.
// Maintainer : ijm
// Lastmod : 20110822 (ijm)
// License : Copyright (C) 2011 Ashima Arts. All rights reserved.
// Distributed under the MIT License. See LICENSE file.
// https://github.com/ashima/webgl-noise
//
vec3 mod289(vec3 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
vec4 mod289(vec4 x) { return x - floor(x * (1.0 / 289.0)) * 289.0; }
vec4 permute(vec4 x) { return mod289(((x*34.0)+1.0)*x); }
vec4 taylorInvSqrt(vec4 r){ return 1.79284291400159 - 0.85373472095314 * r; }
float snoise(vec3 v)
{
const vec2 C = vec2(1.0/6.0, 1.0/3.0);
const vec4 D = vec4(0.0, 0.5, 1.0, 2.0);
// First corner // First corner
vec3 i = floor(v + dot(v, C.yyy));
vec3 x0 = v - i + dot(i, C.xxx); vec3 i = floor( v + dot( v, C.yyy ) );
vec3 x0 = v - i + dot( i, C.xxx );
// Other corners // Other corners
vec3 g = step(x0.yzx, x0.xyz);
vec3 g = step( x0.yzx, x0.xyz );
vec3 l = 1.0 - g; vec3 l = 1.0 - g;
vec3 i1 = min(g.xyz, l.zxy); vec3 i1 = min( g.xyz, l.zxy );
vec3 i2 = max(g.xyz, l.zxy); vec3 i2 = max( g.xyz, l.zxy );
vec3 x1 = x0 - i1 + C.xxx;
vec3 x2 = x0 - i2 + C.yyy; // 2.0*C.x = 1/3 = C.y vec3 x1 = x0 - i1 + 1.0 * C.xxx;
vec3 x3 = x0 - D.yyy; // -1.0+3.0*C.x = -0.5 = -D.y vec3 x2 = x0 - i2 + 2.0 * C.xxx;
vec3 x3 = x0 - 1. + 3.0 * C.xxx;
// Permutations // Permutations
i = mod289(i);
vec4 p = permute( permute( permute( i.z + vec4(0.0, i1.z, i2.z, 1.0)) + i.y + vec4(0.0, i1.y, i2.y, 1.0 )) + i.x + vec4(0.0, i1.x, i2.x, 1.0 ));
// Gradients: 7x7 points over a square, mapped onto an octahedron. i = mod( i, 289.0 );
// The ring size 17*17 = 289 is close to a multiple of 49 (49*6 = 294) vec4 p = permute( permute( permute(
float n_ = 0.142857142857; // 1.0/7.0 i.z + vec4( 0.0, i1.z, i2.z, 1.0 ) )
vec3 ns = n_ * D.wyz - D.xzx; + i.y + vec4( 0.0, i1.y, i2.y, 1.0 ) )
vec4 j = p - 49.0 * floor(p * ns.z * ns.z); // mod(p,7*7) + i.x + vec4( 0.0, i1.x, i2.x, 1.0 ) );
// Gradients
// ( N*N points uniformly over a square, mapped onto an octahedron.)
float n_ = 1.0 / 7.0; // N=7
vec4 x_ = floor(j * ns.z); vec3 ns = n_ * D.wyz - D.xzx;
vec4 y_ = floor(j - 7.0 * x_); // mod(j,N)
vec4 j = p - 49.0 * floor( p * ns.z *ns.z ); // mod(p,N*N)
vec4 x_ = floor( j * ns.z );
vec4 y_ = floor( j - 7.0 * x_ ); // mod(j,N)
vec4 x = x_ *ns.x + ns.yyyy; vec4 x = x_ *ns.x + ns.yyyy;
vec4 y = y_ *ns.x + ns.yyyy; vec4 y = y_ *ns.x + ns.yyyy;
vec4 h = 1.0 - abs( x ) - abs( y );
vec4 h = 1.0 - abs(x) - abs(y); vec4 b0 = vec4( x.xy, y.xy );
vec4 b0 = vec4(x.xy, y.xy); vec4 b1 = vec4( x.zw, y.zw );
vec4 b1 = vec4(x.zw, y.zw);
vec4 s0 = floor(b0) * 2.0 + 1.0;
vec4 s1 = floor(b1) * 2.0 + 1.0; vec4 s0 = floor( b0 ) * 2.0 + 1.0;
vec4 sh = -step(h, vec4(0.0)); vec4 s1 = floor( b1 ) * 2.0 + 1.0;
vec4 sh = -step( h, vec4( 0.0 ) );
vec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy; vec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;
vec4 a1 = b1.xzyw + s1.xzyw * sh.zzww; vec4 a1 = b1.xzyw + s1.xzyw * sh.zzww;
vec3 p0 = vec3(a0.xy, h.x); vec3 p0 = vec3( a0.xy, h.x );
vec3 p1 = vec3(a0.zw, h.y); vec3 p1 = vec3( a0.zw, h.y );
vec3 p2 = vec3(a1.xy, h.z); vec3 p2 = vec3( a1.xy, h.z );
vec3 p3 = vec3(a1.zw, h.w); vec3 p3 = vec3( a1.zw, h.w );
//Normalise gradients // Normalise gradients
vec4 norm = taylorInvSqrt(vec4(dot(p0,p0), dot(p1,p1), dot(p2, p2), dot(p3,p3)));
vec4 norm = taylorInvSqrt( vec4( dot( p0, p0 ), dot( p1, p1 ), dot( p2, p2 ), dot( p3, p3 ) ) );
p0 *= norm.x; p0 *= norm.x;
p1 *= norm.y; p1 *= norm.y;
p2 *= norm.z; p2 *= norm.z;
p3 *= norm.w; p3 *= norm.w;
// Mix final noise value // Mix final noise value
vec4 m = max(0.6 - vec4(dot(x0,x0), dot(x1,x1), dot(x2,x2), dot(x3,x3)), 0.0);
vec4 m = max( 0.6 - vec4( dot( x0, x0 ), dot( x1, x1 ), dot( x2, x2 ), dot( x3, x3 ) ), 0.0 );
m = m * m; m = m * m;
return 42.0 * dot( m*m, vec4( dot( p0, x0 ), dot( p1, x1 ),
dot( p2, x2 ), dot( p3, x3 ) ) );
return 42.0 * dot( m*m, vec4( dot(p0,x0), dot(p1,x1), dot(p2,x2), dot(p3,x3))); }
}
float Turbulence(vec3 position, float minFreq, float maxFreq, float qWidth) vec2 snoise2(vec3 pos)
{ {
float value = 0.0; return vec2(snoise(pos), snoise(pos + vec3(0.0, 0.0, 1.0)));
float cutoff = clamp(0.5/qWidth, 0.0, maxFreq);
float fade;
float fOut = minFreq;
for(int i=NoiseSteps ; i>=0 ; i++)
{
if(fOut >= 0.5 * cutoff) break;
fOut *= 2.0;
value += abs(snoise(position * fOut))/fOut;
}
fade = clamp(2.0 * (cutoff-fOut)/cutoff, 0.0, 1.0);
value += fade * abs(snoise(position * fOut))/fOut;
return 1.0-value;
} }
float SphereDist(vec3 position) float GetFireDelta(float currTime, vec2 pos, float freqMult, float stretchMult, float scrollSpeed, float evolutionSpeed)
{ {
return length(position - ExpPosition) - Radius; //firewall
} float delta = 0;
// pos.y += (1.0 - pos.y) * 0.5;
//pos.y += 0.5;
pos.y /= stretchMult;
pos *= freqMult;
pos.y += currTime * scrollSpeed;
// pos.y -= currTime * 3.0;
vec4 Shade(float distance)
{
float c1 = saturate(distance*5.0 + 0.5);
float c2 = saturate(distance*5.0);
float c3 = saturate(distance*3.4 - 0.5);
vec4 a = mix(color1,color2, c1); delta += snoise(vec3(pos * 1.0, currTime * 1.0 * evolutionSpeed)) * 1.5;
vec4 b = mix(a, color3, c2); delta += snoise(vec3(pos * 2.0, currTime * 2.0 * evolutionSpeed)) * 1.5;
return mix(b, color4, c3); delta += snoise(vec3(pos * 4.0, currTime * 4.0 * evolutionSpeed)) * 1.5;
} delta += snoise(vec3(pos * 8.0, currTime * 8.0 * evolutionSpeed)) * 1.5;
delta += snoise(vec3(pos * 16.0, currTime * 16.0 * evolutionSpeed)) * 0.5;
// Draws the scene return delta;
float RenderScene(vec3 position, out float distance) }
vec4 GetFireColor(float currTime, vec2 pos, float freqMult, float stretchMult, float ampMult)
{ {
float time = tick / speed; float delta = GetFireDelta(currTime, pos, freqMult, stretchMult, 3.0, 0.5);
float noise = Turbulence(position * NoiseFrequency + Animation*time, 0.1, 1.5, 0.03) * NoiseAmplitude; delta *= min(1.0, max(0.0, 1.0 * (1.0 - pos.y)));
noise = saturate(abs(noise)); delta *= min(1.0, max(0.0, 1.0 * (0.0 + pos.y)));
distance = SphereDist(position) - noise; vec2 displacedPoint = pos + vec2(0, delta * ampMult);
displacedPoint.y = min(0.99, displacedPoint.y);
return noise; displacedPoint.y = max(0.01, displacedPoint.y);
return texture2D(tex, displacedPoint);
} }
// Basic ray marching method. vec4 GetCheckboardColor(vec2 pos)
vec4 March(vec3 rayOrigin, vec3 rayStep)
{ {
vec3 position = rayOrigin; vec4 col = vec4(0.0, 0.0, 0.0, 0.0);
if(pos.x > 0.0 && pos.x < 1.0 && pos.y > 0.0 && pos.y < 1.0)
float distance;
float displacement;
for(int step = MarchSteps; step >=0 ; --step)
{ {
displacement = RenderScene(position, distance); if(mod(pos.x, 0.1) < 0.05 ^^ mod(pos.y, 0.1) < 0.05)
col = vec4(pos.x, pos.y, 0.0, 1.0);
if(distance < 0.05) break; else
col = vec4(0.0, 0.0, 0.0, 1.0);
position += rayStep * distance;
} }
return mix(Shade(displacement), Background, float(distance >= 0.5)); return col;
} }
bool IntersectSphere(vec3 ro, vec3 rd, vec3 pos, float radius, out vec3 intersectPoint) vec4 GetFireBallColor(float currTime, vec2 pos, float freqMult, float stretchMult, float ampMult, float power, float radius1, float radius2, vec2 velocity, float paletteCoord)
{ {
vec3 relDistance = (ro - pos); float pi = 3.141593;
vec2 velocityDir = vec2(1, 0);
float b = dot(relDistance, rd); if(length(velocity) > 0)
float c = dot(relDistance, relDistance) - radius*radius; velocityDir = velocity / length(velocity);
float d = b*b - c; vec2 velocityPerp = vec2(-velocityDir.y, velocityDir.x);
intersectPoint = ro + rd*(-b - sqrt(d)); float ang = atan(dot(pos, velocityPerp), dot(pos, velocityDir));
vec4 fireballColor = vec4(0.0, 0.0, 0.0, 0.0);
return d >= 0.0; if(length(pos) < radius1)
{
float sinAlpha = length(pos) / radius1;
float alpha = 0.0;
alpha = asin(sinAlpha);
vec2 sphericalProjectedCoord = vec2(0.5, 0.5) + pos * (alpha / (3.141592 / 2.0)) / length(pos);
//fireballColor = GetCheckboardColor(sphericalProjectedCoord);
float delta = GetFireDelta(currTime, sphericalProjectedCoord, freqMult * 0.1, 1.0, 0.0, 1.5) * (1.0 - pow(length(pos) / radius1, 3.0)) * 0.5;
float verticalPos = 0.99 - delta * delta;
verticalPos = min(0.99, verticalPos);
verticalPos = max(0.01, verticalPos);
fireballColor = texture2D(tex, vec2(0.75, verticalPos));
fireballColor.a = 1.0;
}else
{
float dist = (length(pos) - radius1) / (radius2 - radius1);
vec2 polarPos = vec2(ang, dist);
float dstAng = (1.0 - pow(1.0 - abs(polarPos.x / pi), 4.0)) * pi;
if(polarPos.x < 0.0) dstAng = -dstAng;
polarPos.x = dstAng + (polarPos.x - dstAng) * exp(-polarPos.y * 2.0);
polarPos.y *= 0.15 + 1.4 * pow(abs(polarPos.x) / pi, 2.0);
//polarPos.y *= exp(-(1.0 - pow(abs(polarPos.x) / pi, 2.0)) * 2.0);
//polarPos.x = (1.0 - pow(1.0 - abs(polarPos.x / pi), 1.0)) * pi;
//polarPos.x *= 2.0 - 1.0 * exp(-(1.0 - pow(1.0 - abs(polarPos.x) / pi, 3.0)) * 5.0 * polarPos.y);
//polarPos.x *= 1.0 + 1.0 * exp(-abs(polarPos.x));//0.1 + 0.9 * (1.0 - pow(1.0 - abs(polarPos.x) / pi, 0.5));
vec2 planarPos = vec2((polarPos.x + pi) / (2.0 * pi), 1.0 - polarPos.y * 1.0);
if(planarPos.y > 0.0)
{
//return GetCheckboardColor(planarPos);
float delta =
GetFireDelta(currTime, planarPos, freqMult, stretchMult, 2.5, 0.5) * (1.0 - planarPos.x) +
GetFireDelta(currTime, vec2(planarPos.x - 1.0, planarPos.y), freqMult, stretchMult, 2.5, 0.5) * planarPos.x;
delta *= min(1.0, max(0.0, 1.0 * (1.0 - planarPos.y)));
delta *= min(1.0, max(0.0, 1.0 * (0.0 + planarPos.y)));
float verticalPos = planarPos.y + delta * ampMult;
verticalPos = min(0.99, verticalPos);
verticalPos = max(0.01, verticalPos);
fireballColor = texture2D(tex, vec2(0.25, verticalPos));
}
}
return fireballColor;
} }
void main(void) void main(void)
{ {
vec2 resolution = vec2(640.0, 640.0); vec2 radius = gl_TexCoord[0].xy - vec2(0.5, 0.5);
//vec2 p = (gl_FragCoord.xy / resolution.xy) * 2.0 - 1.0;
vec2 p = gl_TexCoord[0].xy - 0.5;
p.x *= resolution.x/resolution.y; //on-hit wobbling effect
float radiusLen = length(radius);
float rotx = 0.00;
float roty = 0.0;
float zoom = 9.0;
// camera
vec3 ro = zoom * normalize(vec3(cos(roty), cos(rotx), sin(roty)));
vec3 ww = normalize(vec3(0.0, 0.0, 0.0) - ro);
vec3 uu = normalize(cross( vec3(0.0, 1.0, 0.0), ww));
vec3 vv = normalize(cross(ww, uu));
vec3 rd = normalize(p.x*uu + p.y*vv + 1.5*ww);
vec4 col = Background;
vec3 origin;
if(IntersectSphere(ro, rd, ExpPosition, Radius + NoiseAmplitude*6.0, origin)) float ballRadius = 0.1;
{ float coronaWidth = 0.05;
col = March(origin, rd);
} vec4 c;
c = GetFireBallColor(tick / time_factor + 0.0 , radius, 6, 15.0, 1, 2, ballRadius, ballRadius + coronaWidth, vec2(1, 0), 0.75);
c.a *= gl_Color.a;
gl_FragColor = col * gl_Color; gl_FragColor = c;
} }
...@@ -21,13 +21,11 @@ return { ...@@ -21,13 +21,11 @@ return {
frag = "fireball", frag = "fireball",
vert = nil, vert = nil,
args = { args = {
resolution = resolution or {128,128}, tex = { texture = 0 },
zoom = zoom or 1, color = color or {0.4, 0.7, 1.0},
speed = 400, time_factor = time_factor or 4000,
color1 = {1.0, 1.0, 1.0, 0.85}, ellipsoidalFactor = ellipsoidalFactor or 1.0, --1 is perfect circle, >1 is ellipsoidal
color2 = {1.0, 0.9, 0.1, 0.85}, oscillationSpeed = oscillationSpeed or 0.0, --oscillation between ellipsoidal and spherical form
color3 = {1.0, 0.4, 0.0, 0.85},
color4 = {0.6, 0.1, 0.0, 0.85},
}, },
clone = false, clone = false,
} }
uniform sampler2D tex;
uniform float tick;
uniform float time_factor;
vec4 permute( vec4 x ) {
return mod( ( ( x * 34.0 ) + 1.0 ) * x, 289.0 );
}
vec4 taylorInvSqrt( vec4 r ) {
return 1.79284291400159 - 0.85373472095314 * r;
}
float snoise( vec3 v ) {
const vec2 C = vec2( 1.0 / 6.0, 1.0 / 3.0 );
const vec4 D = vec4( 0.0, 0.5, 1.0, 2.0 );
// First corner
vec3 i = floor( v + dot( v, C.yyy ) );
vec3 x0 = v - i + dot( i, C.xxx );
// Other corners
vec3 g = step( x0.yzx, x0.xyz );
vec3 l = 1.0 - g;
vec3 i1 = min( g.xyz, l.zxy );
vec3 i2 = max( g.xyz, l.zxy );
vec3 x1 = x0 - i1 + 1.0 * C.xxx;
vec3 x2 = x0 - i2 + 2.0 * C.xxx;
vec3 x3 = x0 - 1. + 3.0 * C.xxx;
// Permutations
i = mod( i, 289.0 );
vec4 p = permute( permute( permute(
i.z + vec4( 0.0, i1.z, i2.z, 1.0 ) )
+ i.y + vec4( 0.0, i1.y, i2.y, 1.0 ) )
+ i.x + vec4( 0.0, i1.x, i2.x, 1.0 ) );
// Gradients
// ( N*N points uniformly over a square, mapped onto an octahedron.)
float n_ = 1.0 / 7.0; // N=7
vec3 ns = n_ * D.wyz - D.xzx;
vec4 j = p - 49.0 * floor( p * ns.z *ns.z ); // mod(p,N*N)
vec4 x_ = floor( j * ns.z );
vec4 y_ = floor( j - 7.0 * x_ ); // mod(j,N)
vec4 x = x_ *ns.x + ns.yyyy;
vec4 y = y_ *ns.x + ns.yyyy;
vec4 h = 1.0 - abs( x ) - abs( y );
vec4 b0 = vec4( x.xy, y.xy );
vec4 b1 = vec4( x.zw, y.zw );
vec4 s0 = floor( b0 ) * 2.0 + 1.0;
vec4 s1 = floor( b1 ) * 2.0 + 1.0;
vec4 sh = -step( h, vec4( 0.0 ) );
vec4 a0 = b0.xzyw + s0.xzyw * sh.xxyy;
vec4 a1 = b1.xzyw + s1.xzyw * sh.zzww;
vec3 p0 = vec3( a0.xy, h.x );
vec3 p1 = vec3( a0.zw, h.y );
vec3 p2 = vec3( a1.xy, h.z );
vec3 p3 = vec3( a1.zw, h.w );
// Normalise gradients
vec4 norm = taylorInvSqrt( vec4( dot( p0, p0 ), dot( p1, p1 ), dot( p2, p2 ), dot( p3, p3 ) ) );
p0 *= norm.x;
p1 *= norm.y;
p2 *= norm.z;
p3 *= norm.w;
// Mix final noise value
vec4 m = max( 0.6 - vec4( dot( x0, x0 ), dot( x1, x1 ), dot( x2, x2 ), dot( x3, x3 ) ), 0.0 );
m = m * m;
return 42.0 * dot( m*m, vec4( dot( p0, x0 ), dot( p1, x1 ),
dot( p2, x2 ), dot( p3, x3 ) ) );
}
vec2 snoise2(vec3 pos)
{
return vec2(snoise(pos), snoise(pos + vec3(0.0, 0.0, 1.0)));
}
float GetFireDelta(float currTime, vec2 pos, float freqMult, float stretchMult, float scrollSpeed, float evolutionSpeed)
{
//firewall
float delta = 0;
// pos.y += (1.0 - pos.y) * 0.5;
//pos.y += 0.5;
pos.y /= stretchMult;
pos *= freqMult;
pos.y += currTime * scrollSpeed;
// pos.y -= currTime * 3.0;
delta += snoise(vec3(pos * 1.0, currTime * 1.0 * evolutionSpeed)) * 1.5;
delta += snoise(vec3(pos * 2.0, currTime * 2.0 * evolutionSpeed)) * 1.5;
delta += snoise(vec3(pos * 4.0, currTime * 4.0 * evolutionSpeed)) * 1.5;
delta += snoise(vec3(pos * 8.0, currTime * 8.0 * evolutionSpeed)) * 1.5;
delta += snoise(vec3(pos * 16.0, currTime * 16.0 * evolutionSpeed)) * 0.5;
return delta;
}
vec4 GetFireColor(float currTime, vec2 pos, float freqMult, float stretchMult, float ampMult)
{
float delta = GetFireDelta(currTime, pos, freqMult, stretchMult, 3.0, 0.5);
delta *= min(1.0, max(0.0, 1.0 * (1.0 - pos.y)));
delta *= min(1.0, max(0.0, 1.0 * (0.0 + pos.y)));
vec2 displacedPoint = pos + vec2(0, delta * ampMult);
displacedPoint.y = min(0.99, displacedPoint.y);
displacedPoint.y = max(0.01, displacedPoint.y);
return texture2D(tex, displacedPoint);
}
vec4 GetCheckboardColor(vec2 pos)
{
vec4 col = vec4(0.0, 0.0, 0.0, 0.0);
if(pos.x > 0.0 && pos.x < 1.0 && pos.y > 0.0 && pos.y < 1.0)
{
if(mod(pos.x, 0.1) < 0.05 ^^ mod(pos.y, 0.1) < 0.05)
col = vec4(pos.x, pos.y, 0.0, 1.0);
else
col = vec4(0.0, 0.0, 0.0, 1.0);
}
return col;
}
vec4 GetFireCandleColor(float currTime, vec2 pos, float freqMult, float stretchMult, float ampMult, float power, float radius, float flameHeight, float paletteCoord)
{
float pi = 3.141593;
vec4 fireballColor = vec4(0.0, 0.0, 0.0, 0.0);
if(length(pos) < radius)
{
float ang = atan(pos.x, pos.y);
float sinAlpha = length(pos) / radius;
float alpha = 0.0;
alpha = asin(sinAlpha);
vec2 sphericalProjectedCoord = vec2(0.5, 0.5) + pos * (alpha / (3.141592 / 2.0)) / length(pos);
//fireballColor = GetCheckboardColor(sphericalProjectedCoord);
float delta = GetFireDelta(currTime, sphericalProjectedCoord, freqMult * 0.3, 1.0, 0.0, 1.5) * (1.0 - pow(length(pos) / radius, 3.0)) * 0.5;
float verticalPos = 0.99 - delta * delta;
verticalPos = min(0.99, verticalPos);
verticalPos = max(0.01, verticalPos);
fireballColor = texture2D(tex, vec2(0.75, verticalPos));
fireballColor.a = 1.0;
}else
{
float bottomPos = 0;
pos.x += cos(pos.y * 20.0 + currTime * 20.0) * 0.05 * (1.0 - pow(1.0 - max(0.0, min((-radius - pos.y) * 2.0, 1.0)), 2.0));
if(abs(pos.x) < radius)
{
bottomPos = -sqrt(radius * radius - pos.x * pos.x);
// float ratio = (pos.y - bottomPos) / (bottomPos * (flameHeight / radius) - bottomPos);
float ratio = (pos.y - bottomPos) / (bottomPos - flameHeight - radius - bottomPos) * (1.0 + 0.5 * pow(abs(pos.x) / radius, 4.0));
vec2 planarPos = vec2(pos.x / radius, 1.0 - ratio);
planarPos.x *= 1.0 + (1.0 - planarPos.y) * 2.5;
planarPos.x = planarPos.x / 2.0 + 0.5;
if(planarPos.x > 0.0 && planarPos.x < 1.0 && planarPos.y > 0.0 && planarPos.y < 1.0)
{
float delta = GetFireDelta(currTime, planarPos, freqMult * 0.2, 0.6, 1.0, 0.2);
delta *= min(1.0, max(0.0, 1.0 * (1.0 - planarPos.y)));
delta *= min(1.0, max(0.0, 1.0 * (0.0 + planarPos.y)));
float verticalPos = pow(planarPos.y, 0.7) + delta * 1.0;
verticalPos = min(0.99, verticalPos);
verticalPos = max(0.01, verticalPos);
//fireballColor = GetCheckboardColor(planarPos);
fireballColor = texture2D(tex, vec2(0.25, verticalPos));
}
}
}
return fireballColor;
}
void main(void)
{
vec2 radius = gl_TexCoord[0].xy - vec2(0.5, 0.8);
//on-hit wobbling effect
float radiusLen = length(radius);
float ballRadius = 0.1;
float flameHeight = 0.6;
vec4 c;
c = GetFireCandleColor(tick / time_factor + 0.0 , radius, 2, 3.0, 1, 2, ballRadius, flameHeight, 0.75);
c.a *= gl_Color.a;
//c.a += 0.5;
gl_FragColor = c;
}
-- ToME - Tales of Maj'Eyal
-- Copyright (C) 2009, 2010, 2011, 2012, 2013 Nicolas Casalini
--
-- This program is free software: you can redistribute it and/or modify
-- it under the terms of the GNU General Public License as published by
-- the Free Software Foundation, either version 3 of the License, or
-- (at your option) any later version.
--
-- This program is distributed in the hope that it will be useful,
-- but WITHOUT ANY WARRANTY; without even the implied warranty of
-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-- GNU General Public License for more details.
--
-- You should have received a copy of the GNU General Public License
-- along with this program. If not, see <http://www.gnu.org/licenses/>.
--
-- Nicolas Casalini "DarkGod"
-- darkgod@te4.org
return {
frag = "flamehands",
vert = nil,
args = {
tex = { texture = 0 },
time_factor = time_factor or 700,
},
clone = false,
}
...@@ -30,13 +30,22 @@ newTalent{ ...@@ -30,13 +30,22 @@ newTalent{
getFireDamageIncrease = function(self, t) return self:combatTalentSpellDamage(t, 5, 14) end, getFireDamageIncrease = function(self, t) return self:combatTalentSpellDamage(t, 5, 14) end,
activate = function(self, t) activate = function(self, t)
game:playSoundNear(self, "talents/fire") game:playSoundNear(self, "talents/fire")
return { local ret = {
particle = particle,
dam = self:addTemporaryValue("melee_project", {[DamageType.FIRE] = t.getFireDamage(self, t)}), dam = self:addTemporaryValue("melee_project", {[DamageType.FIRE] = t.getFireDamage(self, t)}),
per = self:addTemporaryValue("inc_damage", {[DamageType.FIRE] = t.getFireDamageIncrease(self, t)}), per = self:addTemporaryValue("inc_damage", {[DamageType.FIRE] = t.getFireDamageIncrease(self, t)}),
sta = self:addTemporaryValue("stamina_regen_on_hit", self:getTalentLevel(t) / 3), sta = self:addTemporaryValue("stamina_regen_on_hit", self:getTalentLevel(t) / 3),
} }
if core.shader.active(4) then
local slow = rng.percent(50)
local h1x, h1y = self:attachementSpot("hand1", true) if h1x then ret.particle1 = self:addParticles(Particles.new("shader_shield", 1, {img="fireball", a=0.7, size_factor=0.4, x=h1x, y=h1y-0.1}, {type="flamehands", time_factor=slow and 700 or 1000})) end
local h2x, h2y = self:attachementSpot("hand2", true) if h2x then ret.particle2 = self:addParticles(Particles.new("shader_shield", 1, {img="fireball", a=0.7, size_factor=0.4, x=h2x, y=h2y-0.1}, {type="flamehands", time_factor=not slow and 700 or 1000})) end
end
return ret
end, end,
deactivate = function(self, t, p) deactivate = function(self, t, p)
if p.particle1 then self:removeParticles(p.particle1) end
if p.particle2 then self:removeParticles(p.particle2) end
self:removeTemporaryValue("melee_project", p.dam) self:removeTemporaryValue("melee_project", p.dam)
self:removeTemporaryValue("inc_damage", p.per) self:removeTemporaryValue("inc_damage", p.per)
self:removeTemporaryValue("stamina_regen_on_hit", p.sta) self:removeTemporaryValue("stamina_regen_on_hit", p.sta)
...@@ -89,13 +98,21 @@ newTalent{ ...@@ -89,13 +98,21 @@ newTalent{
getIceDamageIncrease = function(self, t) return self:combatTalentSpellDamage(t, 5, 14) end, getIceDamageIncrease = function(self, t) return self:combatTalentSpellDamage(t, 5, 14) end,
activate = function(self, t) activate = function(self, t)
game:playSoundNear(self, "talents/lightning") game:playSoundNear(self, "talents/lightning")
return { local ret = {
dam = self:addTemporaryValue("melee_project", {[DamageType.LIGHTNING_DAZE] = t.getIceDamage(self, t)}), dam = self:addTemporaryValue("melee_project", {[DamageType.LIGHTNING_DAZE] = t.getIceDamage(self, t)}),
per = self:addTemporaryValue("inc_damage", {[DamageType.LIGHTNING] = t.getIceDamageIncrease(self, t)}), per = self:addTemporaryValue("inc_damage", {[DamageType.LIGHTNING] = t.getIceDamageIncrease(self, t)}),
man = self:addTemporaryValue("mana_regen_on_hit", self:getTalentLevel(t) / 3), man = self:addTemporaryValue("mana_regen_on_hit", self:getTalentLevel(t) / 3),
} }
if core.shader.active(4) then
local slow = rng.percent(50)
local h1x, h1y = self:attachementSpot("hand1", true) if h1x then ret.particle1 = self:addParticles(Particles.new("shader_shield", 1, {img="lightningwings", a=0.7, size_factor=0.4, x=h1x, y=h1y-0.1}, {type="flamehands", time_factor=slow and 700 or 1000})) end
local h2x, h2y = self:attachementSpot("hand2", true) if h2x then ret.particle2 = self:addParticles(Particles.new("shader_shield", 1, {img="lightningwings", a=0.7, size_factor=0.4, x=h2x, y=h2y-0.1}, {type="flamehands", time_factor=not slow and 700 or 1000})) end
end
return ret
end, end,
deactivate = function(self, t, p) deactivate = function(self, t, p)
if p.particle1 then self:removeParticles(p.particle1) end
if p.particle2 then self:removeParticles(p.particle2) end
self:removeTemporaryValue("melee_project", p.dam) self:removeTemporaryValue("melee_project", p.dam)
self:removeTemporaryValue("inc_damage", p.per) self:removeTemporaryValue("inc_damage", p.per)
self:removeTemporaryValue("mana_regen_on_hit", p.man) self:removeTemporaryValue("mana_regen_on_hit", p.man)
......
...@@ -124,7 +124,8 @@ newTalent{ ...@@ -124,7 +124,8 @@ newTalent{
local particle local particle
if core.shader.active(4) then if core.shader.active(4) then
particle = self:addParticles(Particles.new("shader_wings", 1, {infinite=1, x=self.wings_x, y=self.wings_y})) local bx, by = self:attachementSpot("back", true)
particle = self:addParticles(Particles.new("shader_wings", 1, {infinite=1, x=bx, y=by}))
else else
particle = self:addParticles(Particles.new("wildfire", 1)) particle = self:addParticles(Particles.new("wildfire", 1))
end end
......
...@@ -94,7 +94,7 @@ newEntity{ define_as = "SUPREME_ARCHMAGE_LINANIIL", ...@@ -94,7 +94,7 @@ newEntity{ define_as = "SUPREME_ARCHMAGE_LINANIIL",
[Talents.T_KEEN_SENSES]=5, [Talents.T_KEEN_SENSES]=5,
[Talents.T_PREMONITION]=5, [Talents.T_PREMONITION]=5,
}, },
wings_x = 2, wings_y = -33, attachement_spots = { back={x=35/64, y=1/64} },
resolvers.sustains_at_birth(), resolvers.sustains_at_birth(),
can_talk = "angolwen-leader", can_talk = "angolwen-leader",
......
...@@ -1035,6 +1035,7 @@ function _M:setTile(f, w, h, last) ...@@ -1035,6 +1035,7 @@ function _M:setTile(f, w, h, last)
self.actor:removeAllMOs() self.actor:removeAllMOs()
if not f then if not f then
if not self.has_custom_tile then if not self.has_custom_tile then
local dbr = self.birth_descriptor_def.race[self.descriptors_by_type.race or "Human"]
local dr = self.birth_descriptor_def.subrace[self.descriptors_by_type.subrace or "Cornac"] local dr = self.birth_descriptor_def.subrace[self.descriptors_by_type.subrace or "Cornac"]
local ds = self.birth_descriptor_def.sex[self.descriptors_by_type.sex or "Female"] local ds = self.birth_descriptor_def.sex[self.descriptors_by_type.sex or "Female"]
self.actor.image = "player/"..(self.descriptors_by_type.subrace or "Cornac"):lower():gsub("[^a-z0-9_]", "_").."_"..(self.descriptors_by_type.sex or "Female"):lower():gsub("[^a-z0-9_]", "_")..".png" self.actor.image = "player/"..(self.descriptors_by_type.subrace or "Cornac"):lower():gsub("[^a-z0-9_]", "_").."_"..(self.descriptors_by_type.sex or "Female"):lower():gsub("[^a-z0-9_]", "_")..".png"
...@@ -1044,10 +1045,24 @@ function _M:setTile(f, w, h, last) ...@@ -1044,10 +1045,24 @@ function _M:setTile(f, w, h, last)
self.actor.moddable_tile = dr.copy.moddable_tile self.actor.moddable_tile = dr.copy.moddable_tile
self.actor.moddable_tile_base = dr.copy.moddable_tile_base self.actor.moddable_tile_base = dr.copy.moddable_tile_base
self.actor.moddable_tile_ornament = dr.copy.moddable_tile_ornament self.actor.moddable_tile_ornament = dr.copy.moddable_tile_ornament
self.actor.attachement_spots = nil
local moddable_attachement_spots = dr.moddable_attachement_spots or dbr.moddable_attachement_spots
if moddable_attachement_spots then
local base = moddable_attachement_spots.base
local b = moddable_attachement_spots.all
if not b then b = self.actor.female and moddable_attachement_spots.female or moddable_attachement_spots.male end
local t = {}
self.actor.attachement_spots = t
for kind, d in pairs(b) do
t[kind] = {}
for o, p in pairs(d) do t[kind][o] = p / base end
end
end
end end
else else
self.actor.make_tile = nil self.actor.make_tile = nil
self.actor.moddable_tile = nil self.actor.moddable_tile = nil
self.actor.attachement_spots = nil
if h > w then if h > w then
self.actor.image = "invis.png" self.actor.image = "invis.png"
self.actor.add_mos = {{image=f, display_h=2, display_y=-1}} self.actor.add_mos = {{image=f, display_h=2, display_y=-1}}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment