Skip to content
Snippets Groups Projects
Commit d89e920d authored by dg's avatar dg
Browse files

fix

git-svn-id: http://svn.net-core.org/repos/t-engine4@3055 51575b47-30f0-44d4-a5cc-537603b46e54
parent 92057ef8
No related branches found
No related tags found
No related merge requests found
......@@ -51,7 +51,7 @@ end
--- Fill the store with goods
-- @param level the level to generate for (instance of type engine.Level)
-- @param zone the zone to generate for
function _M:loadup(level, zone)
function _M:loadup(level, zone, force_nb)
local s = self.store
if not s then error("Store without a store field") end
if not self:canRestock() then return end
......@@ -68,7 +68,7 @@ function _M:loadup(level, zone)
end
local i = 1
local rngfill = rng.range(s.min_fill, s.max_fill) - #inven
local rngfill = force_nb or (rng.range(s.min_fill, s.max_fill) - #inven)
while i <= rngfill do
local filter = util.getval(s.filters)
local e
......
......@@ -906,7 +906,8 @@ function _M:setupCommands()
[{"_g","ctrl"}] = function() if config.settings.cheat then
-- self.nicer_tiles:postProcessLevelTiles(self.level)
-- game:registerDialog(require("mod.dialogs.Donation").new())
self.state:debugRandomZone()
-- self.state:debugRandomZone()
self.state:storesRestock()
end end,
}
......
......@@ -32,6 +32,7 @@ end
function _M:init(t, no_default)
t.store.buy_percent = t.store.buy_percent or function(self, o) if o.type == "gem" then return 40 else return 5 end end
t.store.sell_percent = t.store.sell_percent or function(self, o) return 120 + 3 * (o.__store_level or 0) end -- Stores prices goes up with item level
t.store.nb_fill = t.store.nb_fill or 10
t.store.purse = t.store.purse or 20
Store.init(self, t, no_default)
......@@ -63,7 +64,7 @@ end
-- @param level the level to generate for (instance of type engine.Level)
-- @param zone the zone to generate for
function _M:loadup(level, zone)
if Store.loadup(self, level, zone) then
if Store.loadup(self, level, zone, self.store.nb_fill) then
self.last_filled = game.state.stores_restock
end
end
......
......@@ -19,7 +19,7 @@
newEntity{
define_as = "ARMOR",
name = "armour smith",
name = "heavy armour smith",
display = '2', color=colors.UMBER,
store = {
purse = 25,
......@@ -27,7 +27,38 @@ newEntity{
min_fill = 10,
max_fill = 20,
filters = function()
return {type="armor", id=true, tome_drops="store"}
return {type="armor", subtype="heavy", id=true, tome_drops="store"}
return {type="armor", subtype="massive", id=true, tome_drops="store"}
end,
},
}
newEntity{
define_as = "ARMOR",
name = "tanner",
display = '2', color=colors.LIGHT_UMBER,
store = {
purse = 25,
empty_before_restock = false,
min_fill = 10,
max_fill = 20,
filters = function()
return {type="armor", subtype="light", id=true, tome_drops="store"}
end,
},
}
newEntity{
define_as = "ARMOR",
name = "tailor",
display = '2', color=colors.WHITE,
store = {
purse = 25,
empty_before_restock = false,
min_fill = 10,
max_fill = 20,
filters = function()
return {type="armor", subtype="cloth", id=true, tome_drops="store"}
end,
},
}
......@@ -42,7 +73,7 @@ newEntity{
min_fill = 10,
max_fill = 20,
filters = function()
return {type="weapon", id=true, tome_drops="store"}
return {type="weapon", subtype="sword", id=true, tome_drops="store"}
end,
},
}
......
......@@ -486,7 +486,6 @@ void freeFractArray (float *fa)
}
static int dmnd_2d(lua_State *L)
{
int size = luaL_checknumber(L, 1);
......@@ -503,7 +502,7 @@ static int dmnd_2d(lua_State *L)
lua_createtable(L, size, 0);
for (i = 0; i < size; i++)
{
lua_pushnumber(L, fa[j * size + j]);
lua_pushnumber(L, fa[j * size + i]);
lua_rawseti(L, -2, i + 1);
}
lua_rawseti(L, -2, j + 1);
......@@ -513,8 +512,30 @@ static int dmnd_2d(lua_State *L)
return 1;
}
static int dmnd_1d(lua_State *L)
{
int size = luaL_checknumber(L, 1);
float heightScale = luaL_checknumber(L, 2);
float h = luaL_checknumber(L, 3);
float *fa = alloc1DFractArray(size);
fill1DFractArray(fa, size, heightScale, h);
int i;
lua_createtable(L, size, 0);
for (i = 0; i < size; i++)
{
lua_pushnumber(L, fa[i]);
lua_rawseti(L, -2, i + 1);
}
freeFractArray(fa);
return 1;
}
static const struct luaL_reg dmndlib[] =
{
{"get1D", dmnd_1d},
{"get2D", dmnd_2d},
{NULL, NULL},
};
......
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