Files
Leviathan/Client/Game/resource/weather_script.lua
T
2026-06-01 12:46:52 +02:00

444 lines
10 KiB
Lua

-- weather effect configuration script
-- by sonador
-- 2007.03.26 : created
-- 2007.04.18 : thunder_config added
-- 2007.05.04 : lightning_config added
-- ===============================================================================
-- weather theme configuration
-- ===============================================================================
weather_theme = { fine, cloudy, foggy, rainy, snowy }
-- ===============================================================================
-- resource table
-- ===============================================================================
-- 리소스 목록. 각 theme 에서 선택된다.
resource_table = {
-- low
{
texture = "raindrop03.dds",
width = 2,
height = 40,
count = 1,
row = 1,
col = 1
},
{
nx3 = "raindrop_1.nx3"
},
{
texture = "Snowflake01.dds",
width = 1,
height = 1,
count = 1,
row = 1,
col = 1
},
-- normal
{
texture = "raindrop02.dds",
width = 120,
height = 160,
count = 1,
row = 1,
col = 1
},
{
nx3 = "raindrop.nx3"
},
{
texture = "Snowflake03.dds",
width = 50,
height = 50,
count = 1,
row = 1,
col = 1
},
-- heavy
{
texture = "raindrop01.dds",
width = 160,
height = 160,
count = 1,
row = 1,
col = 1
},
{
nx3 = "raindrop_12.nx3"
},
{
texture = "Snowflake02.dds",
width = 50,
height = 50,
count = 1,
row = 1,
col = 1
}
}
-- -------------------------------------------------------------------------------
-- fine state
-- -------------------------------------------------------------------------------
weather_theme.fine = {
id = 0,
state_fade_duration = 0,
sound = "",
sky = {
type = 0,
thunder = false,
lightning = false
},
fx1 = {
area = {
swap = false,
width = 0,
height = 0
},
particle = {
capacity = 0,
emit_per_millisec = 0,
vert_density = 0,
hori_density = 0,
life = 0,
destroy_duration = 0,
direction = { x = { min = 0.0 , max = 0.0 },
y = { min = 0.0 , max = 0.0 },
z = { min = 0.0 , max = 0.0 } },
velocity = 0,
visibility_min = 0,
visibility_mid = 0,
visibility_max = 0,
visible_range_mid = 0,
visible_range_end = 0,
rotation_unit = 0,
rotation_speed = 0,
collision_max = 0,
collision_factor = 0,
}
}
}
-- -------------------------------------------------------------------------------
-- cloudy state
-- -------------------------------------------------------------------------------
weather_theme.cloudy = {
id = 1,
state_fade_duration = 0,
sound = "",
sky = {
type = 0,
thunder = false,
lightning = false
},
fx1 = {
area = {
swap = false,
width = 0,
height = 0
},
particle = {
capacity = 0,
emit_per_millisec = 0,
vert_density = 0,
hori_density = 0,
life = 0,
destroy_duration = 0,
direction = { x = { min = 0.0 , max = 0.0 },
y = { min = 0.0 , max = 0.0 },
z = { min = 0.0 , max = 0.0 } },
velocity = 0,
visibility_min = 0,
visibility_mid = 0,
visibility_max = 0,
visible_range_mid = 0,
visible_range_end = 0,
rotation_unit = 0,
rotation_speed = 0,
collision_max = 0,
collision_factor = 0,
}
}
}
-- -------------------------------------------------------------------------------
-- foggy state
-- -------------------------------------------------------------------------------
weather_theme.foggy = {
id = 2,
state_fade_duration = 0,
sound = "",
sky = {
type = 0,
thunder = false,
lightning = false
},
fx1 = {
area = {
swap = false,
width = 0,
height = 0
},
particle = {
capacity = 0,
emit_per_millisec = 0,
vert_density = 0,
hori_density = 0,
life = 0,
destroy_duration = 0,
direction = { x = { min = 0.0 , max = 0.0 },
y = { min = 0.0 , max = 0.0 },
z = { min = 0.0 , max = 0.0 } },
velocity = 0,
visibility_min = 0,
visibility_mid = 0,
visibility_max = 0,
visible_range_mid = 0,
visible_range_end = 0,
rotation_unit = 0,
rotation_speed = 0,
collision_max = 0,
collision_factor = 0,
}
}
}
-- -------------------------------------------------------------------------------
-- rainy
-- -------------------------------------------------------------------------------
weather_theme.rainy = {
id = 3,
state_fade_duration = 10000,
sound = "",
sky = {
type = 1,
thunder = false,
lightning = false
},
-- 1st fx
fx1 = {
area = {
swap = true,
width = 500,
height = 500
},
particle = {
capacity = 1000,
emit_per_millisec = 0.83,
vert_density = 8,
hori_density = 8,
life = 1200,
destroy_duration = 200,
direction = { x = { min = -0.00 , max = 0.00 },
y = { min = -0.00 , max = 0.00 },
z = { min = -1.0 , max = -1.0 } },
velocity = 250,
visibility_min = 0.3,
visibility_mid = 0.8,
visibility_max = 0.3,
visible_range_mid = 150,
visible_range_end = 500,
rotation_unit = 0,
rotation_speed = 0,
collision_max = 100,
collision_factor = 1
},
resource = resource_table[ 1 ]
},
-- 2nd fx
fx2 = {
area = {
swap = false,
width = 200,
height = 200
},
particle = {
capacity = 10,
emit_per_millisec = 0.02,
vert_density = 2,
hori_density = 2,
life = 500,
destroy_duration = 0,
direction = { x = { min = 0.0 , max = 0.0 },
y = { min = 0.0 , max = 0.0 },
z = { min = 0.0 , max = 0.0 } },
velocity = 0,
visibility_min = 0.5,
visibility_mid = 0.8,
visibility_max = 1,
visible_range_mid = 250,
visible_range_end = 500,
rotation_unit = 0,
rotation_speed = 0,
collision_max = 0,
collision_factor = 1
},
resource = resource_table[ 2 ]
}
}
-- -------------------------------------------------------------------------------
-- snowy state
-- -------------------------------------------------------------------------------
weather_theme.snowy = {
id = 4,
state_fade_duration = 10000,
sound = "",
sky = {
type = 2,
thunder = false,
lightning = false
},
-- 1st fx
fx1 = {
area = {
swap = true,
width = 500,
height = 500
},
particle = {
capacity = 1000,
emit_per_millisec = 0.08,
vert_density = 16,
hori_density = 8,
life = 13500,
destroy_duration = 1000,
direction = { x = { min = 0.0 , max = 0.0 },
y = { min = 0.0 , max = 0.0 },
z = { min = -1.0 , max = -1.0 } },
velocity = 20,
visibility_min = 1,
visibility_mid = 1,
visibility_max = 1,
visible_range_mid = 125,
visible_range_end = 500,
rotation_unit = 0.1,
rotation_speed = 0.01,
collision_max = 10,
collision_factor = 0.1
},
resource = resource_table[ 3 ]
},
--[[ 2nd fx
fx2 = {
area = {
swap = false,
width = 300,
height = 300
},
particle = {
capacity = 250,
emit_per_millisec = 0.01,
vert_density = 1,
hori_density = 4,
life = 1000,
destroy_duration = 0,
direction = { x = { min = 0.0 , max = 0.0 },
y = { min = 0.0 , max = 0.0 },
z = { min = 0.0 , max = 0.0 } },
velocity = 0,
visibility_min = 0.01,
visibility_mid = 0.7,
visibility_max = 1,
visible_range_mid = 260,
visible_range_end = 300,
rotation_unit = 0,
rotation_speed = 0,
collision_max = 0,
collision_factor = 1
},
resource = resource_table[ 3 ]
}
--]]
}
-- ===============================================================================
-- function change_weather_theme : 날씨를 바꾼다.
-- ===============================================================================
-- state [ 0:맑음, 1:흐림, 2:안개, 3:비, 4:눈 ]
-- get_current_weather_theme()
-- set_current_weather_theme( theme_id, theme_property )
function change_weather_theme( theme )
if theme == 0 then
set_current_weather_theme( theme, weather_theme.fine )
elseif theme == 1 then
set_current_weather_theme( theme, weather_theme.cloudy )
elseif theme == 2 then
set_current_weather_theme( theme, weather_theme.foggy )
elseif theme == 3 then
set_current_weather_theme( theme, weather_theme.rainy )
elseif theme == 4 then
set_current_weather_theme( theme, weather_theme.snowy )
end
end
-- ===============================================================================
-- configuration : thunder effect
-- ===============================================================================
thunder_cfg = {
factor = 0.01, -- percent
lightning_factor = 10,
duration = 250, -- msec
flash_count = 3,
color = { r = 255, g = 255, b = 255, a = 255 },
sound = "sound_thunder.snd",
speed_of_sound = 500
}
-- ===============================================================================
-- function : set attribute of thunder effect
-- ===============================================================================
function get_thunder_attribute()
set_thunder_attribute( thunder_cfg )
end
-- ===============================================================================
-- configuration : lightning effect
-- ===============================================================================
lightning_cfg = {
visible_distance = 2000,
twinling_duration = 300,
fade_out_duration = 2000,
twinkling_count = 3,
color = { r = 255, g = 255, b = 255, a = 255 },
height = 1000,
width = 1000,
textures = { "lightning_01.dds" }
}
-- ===============================================================================
-- function : set attribute of lightning effect
-- ===============================================================================
function get_lightning_attribute()
set_lightning_attribute( lightning_cfg )
end