forked from VoxeLibre/VoxeLibre
Fix enchanted crossbows not taking arrows, and locationsless playing as well as some upgraded firework textures.
This commit is contained in:
parent
9ae4fc538d
commit
65bb7877ed
|
@ -24,8 +24,8 @@ local PLAYER_USE_CROSSBOW_SPEED = tonumber(minetest.settings:get("movement_speed
|
|||
-- Currently nerfed because at full speed the arrow would easily get out of the range of the loaded map.
|
||||
local BOW_MAX_SPEED = 68
|
||||
|
||||
local function play_load_sound(id)
|
||||
minetest.sound_play("mcl_bows_crossbow_drawback_"..id, {pos=pos, max_hear_distance=16}, true)
|
||||
local function play_load_sound(id, pos)
|
||||
minetest.sound_play("mcl_bows_crossbow_drawback_"..id, {pos=pos, max_hear_distance=12}, true)
|
||||
end
|
||||
|
||||
--[[ Store the charging state of each player.
|
||||
|
@ -254,7 +254,7 @@ controls.register_on_release(function(player, key, time)
|
|||
if key~="RMB" then return end
|
||||
--local inv = minetest.get_inventory({type="player", name=player:get_player_name()})
|
||||
local wielditem = player:get_wielded_item()
|
||||
if wielditem:get_name()=="mcl_bows:crossbow_2" and get_arrow(player) or wielditem:get_name()=="mcl_bows:crossbow_2" and minetest.is_creative_enabled(player:get_player_name()) then
|
||||
if wielditem:get_name()=="mcl_bows:crossbow_2" and get_arrow(player) or wielditem:get_name()=="mcl_bows:crossbow_2" and minetest.is_creative_enabled(player:get_player_name()) or wielditem:get_name()=="mcl_bows:crossbow_2_enchanted" and get_arrow(player) or wielditem:get_name()=="mcl_bows:crossbow_2_enchanted" and minetest.is_creative_enabled(player:get_player_name()) then
|
||||
local arrow_stack, arrow_stack_id = get_arrow(player)
|
||||
local arrow_itemstring
|
||||
|
||||
|
@ -272,13 +272,13 @@ controls.register_on_release(function(player, key, time)
|
|||
|
||||
wielditem:get_meta():set_string("arrow", arrow_itemstring)
|
||||
|
||||
wielditem:set_name("mcl_bows:crossbow_loaded")
|
||||
if wielditem:get_name()=="mcl_bows:crossbow_2" then
|
||||
wielditem:set_name("mcl_bows:crossbow_loaded")
|
||||
else
|
||||
wielditem:set_name("mcl_bows:crossbow_loaded_enchanted")
|
||||
end
|
||||
player:set_wielded_item(wielditem)
|
||||
minetest.sound_play("mcl_bows_crossbow_load", {pos=pos, max_hear_distance=16}, true)
|
||||
elseif wielditem:get_name()=="mcl_bows:crossbow_2_enchanted" or wielditem:get_name()=="mcl_bows:crossbow_2_enchanted" and minetest.is_creative_enabled(player:get_player_name()) then
|
||||
wielditem:set_name("mcl_bows:crossbow_loaded_enchanted")
|
||||
player:set_wielded_item(wielditem)
|
||||
minetest.sound_play("mcl_bows_crossbow_load", {pos=pos, max_hear_distance=16}, true)
|
||||
minetest.sound_play("mcl_bows_crossbow_load", {pos=player:get_pos(), max_hear_distance=16}, true)
|
||||
else
|
||||
reset_bow_state(player, true)
|
||||
end
|
||||
|
@ -365,10 +365,10 @@ controls.register_on_hold(function(player, key, time)
|
|||
local enchanted = mcl_enchanting.is_enchanted(wielditem:get_name())
|
||||
if enchanted then
|
||||
wielditem:set_name("mcl_bows:crossbow_0_enchanted")
|
||||
play_load_sound(0)
|
||||
play_load_sound(0, player:get_pos())
|
||||
else
|
||||
wielditem:set_name("mcl_bows:crossbow_0")
|
||||
play_load_sound(0)
|
||||
play_load_sound(0, player:get_pos())
|
||||
end
|
||||
player:set_wielded_item(wielditem)
|
||||
if minetest.get_modpath("playerphysics") then
|
||||
|
@ -382,24 +382,24 @@ controls.register_on_hold(function(player, key, time)
|
|||
if type(bow_load[name]) == "number" then
|
||||
if wielditem:get_name() == "mcl_bows:crossbow_0" and minetest.get_us_time() - bow_load[name] >= BOW_CHARGE_TIME_HALF then
|
||||
wielditem:set_name("mcl_bows:crossbow_1")
|
||||
play_load_sound(1)
|
||||
play_load_sound(1, player:get_pos())
|
||||
elseif wielditem:get_name() == "mcl_bows:crossbow_0_enchanted" and minetest.get_us_time() - bow_load[name] >= BOW_CHARGE_TIME_HALF then
|
||||
wielditem:set_name("mcl_bows:crossbow_1_enchanted")
|
||||
play_load_sound(1)
|
||||
play_load_sound(1, player:get_pos())
|
||||
elseif wielditem:get_name() == "mcl_bows:crossbow_1" and minetest.get_us_time() - bow_load[name] >= BOW_CHARGE_TIME_FULL then
|
||||
wielditem:set_name("mcl_bows:crossbow_2")
|
||||
play_load_sound(2)
|
||||
play_load_sound(2, player:get_pos())
|
||||
elseif wielditem:get_name() == "mcl_bows:crossbow_1_enchanted" and minetest.get_us_time() - bow_load[name] >= BOW_CHARGE_TIME_FULL then
|
||||
wielditem:set_name("mcl_bows:crossbow_2_enchanted")
|
||||
play_load_sound(2)
|
||||
play_load_sound(2, player:get_pos())
|
||||
end
|
||||
else
|
||||
if wielditem:get_name() == "mcl_bows:crossbow_0" or wielditem:get_name() == "mcl_bows:crossbow_1" or wielditem:get_name() == "mcl_bows:crossbow_2" then
|
||||
wielditem:set_name("mcl_bows:crossbow")
|
||||
play_load_sound(1)
|
||||
play_load_sound(1, player:get_pos())
|
||||
elseif wielditem:get_name() == "mcl_bows:crossbow_0_enchanted" or wielditem:get_name() == "mcl_bows:crossbow_1_enchanted" or wielditem:get_name() == "mcl_bows:crossbow_2_enchanted" then
|
||||
wielditem:set_name("mcl_bows:crossbow_enchanted")
|
||||
play_load_sound(1)
|
||||
play_load_sound(1, player:get_pos())
|
||||
end
|
||||
end
|
||||
player:set_wielded_item(wielditem)
|
||||
|
|
|
@ -47,6 +47,11 @@ local function damage_explosion(self)
|
|||
end
|
||||
|
||||
local function particle_explosion(self)
|
||||
minetest.sound_play("mcl_bows_firework", {
|
||||
pos = self.object:get_pos(),
|
||||
max_hear_distance = 100,
|
||||
gain = 3.0,
|
||||
}, true)
|
||||
minetest.add_particlespawner({
|
||||
amount = 100,
|
||||
time = 0.0001,
|
||||
|
@ -548,11 +553,11 @@ minetest.register_entity("mcl_bows:rocket_entity", ARROW_ENTITY)
|
|||
|
||||
if minetest.get_modpath("mcl_core") and minetest.get_modpath("mcl_mobitems") then
|
||||
minetest.register_craft({
|
||||
output = "mcl_bows:rocket 4",
|
||||
output = "mcl_bows:rocket 1",
|
||||
recipe = {
|
||||
{"mcl_core:flint"},
|
||||
{"mcl_core:stick"},
|
||||
{"mcl_mobitems:feather"}
|
||||
{"mcl_core:paper"},
|
||||
{"mcl_firewoks:rocket_2"},
|
||||
{"mcl_bows:arrow"},
|
||||
}
|
||||
})
|
||||
end
|
||||
|
|
Binary file not shown.
Binary file not shown.
Before Width: | Height: | Size: 519 B After Width: | Height: | Size: 630 B |
Binary file not shown.
Before Width: | Height: | Size: 519 B After Width: | Height: | Size: 627 B |
Binary file not shown.
Before Width: | Height: | Size: 519 B After Width: | Height: | Size: 622 B |
|
@ -379,8 +379,8 @@ mcl_enchanting.enchantments.mending = {
|
|||
inv_tool_tab = true,
|
||||
}
|
||||
|
||||
-- requires missing MineClone2 feature
|
||||
--[[mcl_enchanting.enchantments.multishot = {
|
||||
|
||||
mcl_enchanting.enchantments.multishot = {
|
||||
name = S("Multishot"),
|
||||
max_level = 1,
|
||||
primary = {crossbow = true},
|
||||
|
@ -396,10 +396,10 @@ mcl_enchanting.enchantments.mending = {
|
|||
power_range_table = {{20, 50}},
|
||||
inv_combat_tab = true,
|
||||
inv_tool_tab = false,
|
||||
}]]--
|
||||
}
|
||||
|
||||
-- requires missing MineClone2 feature
|
||||
--[[mcl_enchanting.enchantments.piercing = {
|
||||
mcl_enchanting.enchantments.piercing = {
|
||||
name = S("Piercing"),
|
||||
max_level = 4,
|
||||
primary = {crossbow = true},
|
||||
|
@ -415,7 +415,7 @@ mcl_enchanting.enchantments.mending = {
|
|||
power_range_table = {{1, 50}, {11, 50}, {21, 50}, {31, 50}},
|
||||
inv_combat_tab = true,
|
||||
inv_tool_tab = false,
|
||||
}]]--
|
||||
}
|
||||
|
||||
-- implemented in mcl_bows
|
||||
mcl_enchanting.enchantments.power = {
|
||||
|
@ -456,7 +456,7 @@ mcl_enchanting.enchantments.punch = {
|
|||
}
|
||||
|
||||
-- requires missing MineClone2 feature
|
||||
--[[mcl_enchanting.enchantments.quick_charge = {
|
||||
mcl_enchanting.enchantments.quick_charge = {
|
||||
name = S("Quick Charge"),
|
||||
max_level = 3,
|
||||
primary = {crossbow = true},
|
||||
|
@ -472,7 +472,7 @@ mcl_enchanting.enchantments.punch = {
|
|||
power_range_table = {{12, 50}, {32, 50}, {52, 50}},
|
||||
inv_combat_tab = true,
|
||||
inv_tool_tab = false,
|
||||
}]]--
|
||||
}
|
||||
|
||||
-- unimplemented
|
||||
--[[mcl_enchanting.enchantments.respiration = {
|
||||
|
|
|
@ -463,4 +463,4 @@ function mcl_potions.register_arrow(name, desc, color, def)
|
|||
if minetest.get_modpath("doc_identifier") then
|
||||
doc.sub.identifier.register_object("mcl_bows:arrow_entity", "craftitems", "mcl_bows:arrow")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Reference in New Issue