Prevent fake player crossbow shooting (#6)
Fix server crash when fake player attempts to shoot crossbow
This commit is contained in:
parent
d3cf09551a
commit
d89b2519d1
@ -368,6 +368,10 @@ minetest.register_entity("castle_weapons:crossbow_bolt_entity", {
|
||||
inventory_image = "castle_crossbow_loaded.png",
|
||||
groups = {not_in_creative_inventory=1},
|
||||
on_use = function(itemstack, user, pointed_thing)
|
||||
if type(user) ~= "userdata" then
|
||||
-- Do not allow fake players to use crossbow
|
||||
return itemstack
|
||||
end
|
||||
minetest.sound_play("castle_crossbow_click", {object=user})
|
||||
if not minetest.settings:get_bool("creative_mode") then
|
||||
itemstack:add_wear(65535/CROSSBOW_USES)
|
||||
|
Loading…
x
Reference in New Issue
Block a user