summaryrefslogtreecommitdiffstats
path: root/crawl-ref/source/dat
diff options
context:
space:
mode:
authorJude Brown <bookofjude@users.sourceforge.net>2009-12-28 00:17:23 +1000
committerJude Brown <bookofjude@users.sourceforge.net>2009-12-28 00:29:40 +1000
commit23929ee3b2452b1c3a133061eff44b31dc70fb09 (patch)
tree438759a7c65a1d57fb97ec39c7a3a0beca99ed06 /crawl-ref/source/dat
parente42132c99bf63b213388404676a54c6610bd613c (diff)
downloadcrawl-ref-23929ee3b2452b1c3a133061eff44b31dc70fb09.tar.gz
crawl-ref-23929ee3b2452b1c3a133061eff44b31dc70fb09.zip
Customisable clouds!
cloud_struct now has members for colour, name, and tile; colour will be used instead of the default colour of the cloud type, and will be used to recolour the tile of the cloud (if it exists). Name will be used to rebrand the cloud's description, and also alter the message generate while standing in a cloud. Finally, tile can be used to completely customise the tile used for the cloud. The value is stored as a string in order to maintain save compatibility across ASCII and tiles. A random tile (found using tile_main_count) from that set will also be used, however, no duration effects will be applied. Recoloured cloud tiles using just the colour code should be possible, though aren't yet fully tested. This commit bumps TAG_MAJOR_VERSION: changing marshalling of the FogMachine Lua code causes nasty crashes on reloading saved games. Otherwise, I don't think I broke anything else. :-)
Diffstat (limited to 'crawl-ref/source/dat')
-rw-r--r--crawl-ref/source/dat/clua/lm_fog.lua21
1 files changed, 18 insertions, 3 deletions
diff --git a/crawl-ref/source/dat/clua/lm_fog.lua b/crawl-ref/source/dat/clua/lm_fog.lua
index 17b80e652e..ace95fec53 100644
--- a/crawl-ref/source/dat/clua/lm_fog.lua
+++ b/crawl-ref/source/dat/clua/lm_fog.lua
@@ -52,6 +52,10 @@
-- start_clouds: The number of clouds to lay when the level containing
-- the cloud machine is entered. This is necessary since clouds
-- are cleared when the player leaves a level.
+-- colour: A string value with which to recolour the cloud.
+-- name: A string value with which to rebrand (specifically, rename) the
+-- cloud in question.
+-- tile: A string value with which to retile the cloud.
-- listener: A table with a function field called 'func'. Will be called
-- whenever the countdown is activated, and whenever the fog
-- machine is reset. It will be called with a reference to the table,
@@ -100,6 +104,9 @@ function FogMachine:new(pars)
m.size_max = pars.size_max or pars.size
m.spread_rate = pars.spread_rate or -1
m.start_clouds = pars.start_clouds or 1
+ m.colour = pars.colour or ""
+ m.name = pars.name or ""
+ m.tile = pars.tile or ""
m.size_buildup_amnt = pars.size_buildup_amnt or 0
m.size_buildup_time = pars.size_buildup_time or 1
@@ -125,9 +132,10 @@ function FogMachine:new(pars)
end
function FogMachine:apply_cloud(point, pow_min, pow_max, pow_rolls,
- size, cloud_type, kill_cat, spread)
+ size, cloud_type, kill_cat, spread, colour,
+ name, tile)
dgn.apply_area_cloud(point.x, point.y, pow_min, pow_max, pow_rolls, size,
- cloud_type, kill_cat, spread)
+ cloud_type, kill_cat, spread, colour, name, tile)
end
function FogMachine:do_fog(point)
@@ -165,7 +173,8 @@ function FogMachine:do_fog(point)
self:apply_cloud(p, self.pow_min, self.pow_max, self.pow_rolls,
crawl.random_range(size_min, size_max, 1),
- self.cloud_type, self.kill_cat, spread)
+ self.cloud_type, self.kill_cat, spread, self.colour,
+ self.name, self.tile)
end
function FogMachine:do_trigger(triggerer, marker, ev)
@@ -225,6 +234,9 @@ function FogMachine:write(marker, th)
file.marshall(th, self.spread_buildup_amnt)
file.marshall(th, self.spread_buildup_time)
file.marshall(th, self.buildup_turns)
+ file.marshall(th, self.colour)
+ file.marshall(th, self.name)
+ file.marshall(th, self.tile)
end
function FogMachine:read(marker, th)
@@ -245,6 +257,9 @@ function FogMachine:read(marker, th)
self.spread_buildup_amnt = file.unmarshall_number(th)
self.spread_buildup_time = file.unmarshall_number(th)
self.buildup_turns = file.unmarshall_number(th)
+ self.colour = file.unmarshall_string(th)
+ self.name = file.unmarshall_string(th)
+ self.tile = file.unmarshall_string(th)
setmetatable(self, FogMachine)