1
0
Fork 0

Merge remote-tracking branch 'origin/master' into mineclone5

This commit is contained in:
kay27 2021-04-04 10:37:39 +04:00
commit 48286d4ac1
10 changed files with 69 additions and 6 deletions

View File

@ -1,3 +1,24 @@
--these are lua locals, used for higher performance
local minetest,math,vector,ipairs = minetest,math,vector,ipairs
--this is used for the player pool in the sound buffer
local pool = {}
local tick = false
minetest.register_on_joinplayer(function(player)
local name
name = player:get_player_name()
pool[name] = 0
end)
minetest.register_on_leaveplayer(function(player)
local name
name = player:get_player_name()
pool[name] = nil
end)
local has_awards = minetest.get_modpath("awards") local has_awards = minetest.get_modpath("awards")
local mcl_item_entity = {} local mcl_item_entity = {}
@ -77,9 +98,33 @@ end
minetest.register_globalstep(function(dtime) minetest.register_globalstep(function(dtime)
tick = not tick
for _,player in pairs(minetest.get_connected_players()) do for _,player in pairs(minetest.get_connected_players()) do
if player:get_hp() > 0 or not minetest.settings:get_bool("enable_damage") then if player:get_hp() > 0 or not minetest.settings:get_bool("enable_damage") then
local name = player:get_player_name()
local pos = player:get_pos() local pos = player:get_pos()
if tick == true and pool[name] > 0 then
minetest.sound_play("item_drop_pickup", {
pos = pos,
gain = 0.7,
max_hear_distance = 16,
pitch = math.random(70,110)/100
})
if pool[name] > 6 then
pool[name] = 6
else
pool[name] = pool[name] - 1
end
end
local inv = player:get_inventory() local inv = player:get_inventory()
local checkpos = {x=pos.x,y=pos.y + item_drop_settings.player_collect_height,z=pos.z} local checkpos = {x=pos.x,y=pos.y + item_drop_settings.player_collect_height,z=pos.z}
@ -94,11 +139,7 @@ minetest.register_globalstep(function(dtime)
-- Ignore if itemstring is not set yet -- Ignore if itemstring is not set yet
if object:get_luaentity().itemstring ~= "" then if object:get_luaentity().itemstring ~= "" then
inv:add_item("main", ItemStack(object:get_luaentity().itemstring)) inv:add_item("main", ItemStack(object:get_luaentity().itemstring))
minetest.sound_play("item_drop_pickup", {
pos = pos,
max_hear_distance = 16,
gain = 1.0,
}, true)
check_pickup_achievements(object, player) check_pickup_achievements(object, player)
-- Destroy entity -- Destroy entity
@ -111,6 +152,8 @@ minetest.register_globalstep(function(dtime)
object:move_to(checkpos) object:move_to(checkpos)
pool[name] = pool[name] + 1
minetest.after(0.25, function() minetest.after(0.25, function()
--safety check --safety check
if object and object:get_luaentity() then if object and object:get_luaentity() then

View File

@ -0,0 +1 @@
Item_Drop_Pickup - https://freesound.org/people/benniknop/sounds/317848/ (License: CC0)

View File

@ -2819,6 +2819,10 @@ local do_states = function(self, dtime)
local arrow, ent local arrow, ent
local v = 1 local v = 1
if not self.shoot_arrow then if not self.shoot_arrow then
self.firing = true
minetest.after(1, function()
self.firing = false
end)
arrow = minetest.add_entity(p, self.arrow) arrow = minetest.add_entity(p, self.arrow)
ent = arrow:get_luaentity() ent = arrow:get_luaentity()
if ent.velocity then if ent.velocity then
@ -4223,6 +4227,11 @@ function mobs:register_arrow(name, def)
switch = 0, switch = 0,
owner_id = def.owner_id, owner_id = def.owner_id,
rotate = def.rotate, rotate = def.rotate,
on_punch = function(self)
local vel = self.object:get_velocity()
self.object:set_velocity({x=vel.x * -1, y=vel.y * -1, z=vel.z * -1})
end,
collisionbox = def.collisionbox or {0, 0, 0, 0, 0, 0},
automatic_face_movement_dir = def.rotate automatic_face_movement_dir = def.rotate
and (def.rotate - (pi / 180)) or false, and (def.rotate - (pi / 180)) or false,
@ -4285,7 +4294,7 @@ function mobs:register_arrow(name, def)
if self.hit_player or self.hit_mob or self.hit_object then if self.hit_player or self.hit_mob or self.hit_object then
for _,player in pairs(minetest.get_objects_inside_radius(pos, 1.0)) do for _,player in pairs(minetest.get_objects_inside_radius(pos, 1.5)) do
if self.hit_player if self.hit_player
and player:is_player() then and player:is_player() then

View File

@ -63,6 +63,15 @@ mobs:register_mob("mobs_mc:ghast", {
makes_footstep_sound = false, makes_footstep_sound = false,
instant_death = true, instant_death = true,
fire_resistant = true, fire_resistant = true,
do_custom = function(self)
if self.firing == true then
self.base_texture = {"mobs_mc_ghast_firing.png"}
self.object:set_properties({textures=self.base_texture})
else
self.base_texture = {"mobs_mc_ghast.png"}
self.object:set_properties({textures=self.base_texture})
end
end,
}) })
@ -74,6 +83,7 @@ mobs:register_arrow("mobs_mc:fireball", {
visual_size = {x = 1, y = 1}, visual_size = {x = 1, y = 1},
textures = {"mcl_fire_fire_charge.png"}, textures = {"mcl_fire_fire_charge.png"},
velocity = 15, velocity = 15,
collisionbox = {-.5, -.5, -.5, .5, .5, .5},
hit_player = function(self, player) hit_player = function(self, player)
if rawget(_G, "armor") and armor.last_damage_types then if rawget(_G, "armor") and armor.last_damage_types then

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 KiB