Fix a few bugs from the previous commit.

master
Nicole Collings 2020-07-21 19:57:21 -07:00
parent a5e57716ee
commit c00ee72529
3 changed files with 9 additions and 9 deletions

View File

@ -32,13 +32,14 @@ function zepha.get_hit_impact(player, block)
local props = zepha.get_tool_props(player)
local def = (zepha.registered_blocks[block] or {}).tool_props or {}
if def.health == nil then return 0, props.interval end
local damage = 0
for group, tool_damage in pairs(props.damage_groups) do
local mul = def.multipliers[group]
if mul == nil then mul = def.multipliers["_other"] end
local mul = (def.multipliers or {})[group]
if mul == nil then mul = (def.multipliers or {})["_other"] end
if mul == nil then mul = 1 end
damage = math.max(damage, tool_damage * mul)
end

View File

@ -274,10 +274,10 @@ namespace RegisterBlocks {
bool lightPropagates = blockTable.get_or("light_propagates", false);
auto maxStack = blockTable.get_or("stack", 64);
int health = 1, defense = 0;
unsigned int health = INT32_MAX, defense = 0;
auto toolOpt = blockTable.get<sol::optional<sol::table>>("tool_props");
if (toolOpt) {
health = toolOpt->get_or<unsigned int>("health", 1);
health = toolOpt->get_or<unsigned int>("health", INT32_MAX);
defense = toolOpt->get_or<unsigned int>("defense", 0);
}

View File

@ -27,9 +27,8 @@ zepha.register_block("@aurailus:crazyblocks:inventory", {
if zepha.server then
zepha.register_on("new_player", function(player)
player:get_inventory():get_list("hot_wheel_1"):add_stack({"base:hand", 1})
-- player:get_inventory():get_list("hot_wheel_1"):add_stack({"@aurailus:crazyblocks:stacker", 1})
-- player:get_inventory():get_list("hot_wheel_1"):add_stack({"@aurailus:crazyblocks:inventory", 1})
-- player:get_inventory():get_list("hot_wheel_1"):add_stack({"@aurailus:crazyblocks:box", 1})
player:get_inventory():get_list("hot_wheel_1"):add_stack({"@aurailus:crazyblocks:stacker", 1})
player:get_inventory():get_list("hot_wheel_1"):add_stack({"@aurailus:crazyblocks:inventory", 1})
player:get_inventory():get_list("hot_wheel_1"):add_stack({"@aurailus:crazyblocks:box", 1})
end)
end