mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-25 17:39:33 +01:00
Merge remote-tracking branch 'origin/master' into mineclone5
This commit is contained in:
commit
f28d8632a4
3 changed files with 116 additions and 5 deletions
|
@ -157,8 +157,29 @@ local horse = {
|
||||||
self._regentimer = 0
|
self._regentimer = 0
|
||||||
end
|
end
|
||||||
|
|
||||||
-- if driver present allow control of horse
|
-- Some weird human is riding. Buck them off?
|
||||||
|
if self.driver and not self.tamed and self.buck_off_time <= 0 then
|
||||||
|
if math.random() < 0.2 then
|
||||||
|
mobs.detach(self.driver, {x = 1, y = 0, z = 1})
|
||||||
|
-- TODO bucking animation
|
||||||
|
else
|
||||||
|
-- Nah, can't be bothered. Think about it again in one second
|
||||||
|
self.buck_off_time = 20
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- Tick the timer for trying to buck the player off
|
||||||
|
if self.buck_off_time then
|
||||||
if self.driver then
|
if self.driver then
|
||||||
|
self.buck_off_time = self.buck_off_time - 1
|
||||||
|
else
|
||||||
|
-- Player isn't riding anymore so no need to count
|
||||||
|
self.buck_off_time = nil
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
-- if driver present and horse has a saddle allow control of horse
|
||||||
|
if self.driver and self._saddle then
|
||||||
|
|
||||||
mobs.drive(self, "walk", "stand", false, dtime)
|
mobs.drive(self, "walk", "stand", false, dtime)
|
||||||
|
|
||||||
|
@ -191,6 +212,50 @@ local horse = {
|
||||||
local item = clicker:get_wielded_item()
|
local item = clicker:get_wielded_item()
|
||||||
local iname = item:get_name()
|
local iname = item:get_name()
|
||||||
local heal = 0
|
local heal = 0
|
||||||
|
|
||||||
|
-- Taming
|
||||||
|
self.temper = self.temper or (math.random(1,100))
|
||||||
|
|
||||||
|
if not self.tamed then
|
||||||
|
local temper_increase = 0
|
||||||
|
|
||||||
|
-- Feeding, intentionally not using mobs:feed_tame because horse taming is
|
||||||
|
-- different and more complicated
|
||||||
|
if (iname == mobs_mc.items.sugar) then
|
||||||
|
temper_increase = 3
|
||||||
|
elseif (iname == mobs_mc.items.wheat) then
|
||||||
|
temper_increase = 3
|
||||||
|
elseif (iname == mobs_mc.items.apple) then
|
||||||
|
temper_increase = 3
|
||||||
|
elseif (iname == mobs_mc.items.golden_carrot) then
|
||||||
|
temper_increase = 5
|
||||||
|
elseif (iname == mobs_mc.items.golden_apple) then
|
||||||
|
temper_increase = 10
|
||||||
|
|
||||||
|
-- Trying to ride
|
||||||
|
elseif not self.driver then
|
||||||
|
self.object:set_properties({stepheight = 1.1})
|
||||||
|
mobs.attach(self, clicker)
|
||||||
|
self.buck_off_time = 40 -- TODO how long does it take in minecraft?
|
||||||
|
if self.temper > 100 then
|
||||||
|
self.tamed = true -- NOTE taming can only be finished by riding the horse
|
||||||
|
if not self.owner or self.owner == "" then
|
||||||
|
self.owner = clicker:get_player_name()
|
||||||
|
end
|
||||||
|
end
|
||||||
|
temper_increase = 5
|
||||||
|
|
||||||
|
-- Clicking on the horse while riding ==> unmount
|
||||||
|
elseif self.driver and self.driver == clicker then
|
||||||
|
mobs.detach(clicker, {x = 1, y = 0, z = 1})
|
||||||
|
end
|
||||||
|
|
||||||
|
-- If nothing happened temper_increase = 0 and addition does nothing
|
||||||
|
self.temper = self.temper + temper_increase
|
||||||
|
|
||||||
|
return
|
||||||
|
end
|
||||||
|
|
||||||
if can_breed(self.name) then
|
if can_breed(self.name) then
|
||||||
-- Breed horse with golden apple or golden carrot
|
-- Breed horse with golden apple or golden carrot
|
||||||
if (iname == mobs_mc.items.golden_apple) then
|
if (iname == mobs_mc.items.golden_apple) then
|
||||||
|
@ -202,7 +267,8 @@ local horse = {
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
-- Feed/tame with anything else
|
-- Feed with anything else
|
||||||
|
-- TODO heal amounts don't work
|
||||||
if (iname == mobs_mc.items.sugar) then
|
if (iname == mobs_mc.items.sugar) then
|
||||||
heal = 1
|
heal = 1
|
||||||
elseif (iname == mobs_mc.items.wheat) then
|
elseif (iname == mobs_mc.items.wheat) then
|
||||||
|
@ -212,7 +278,7 @@ local horse = {
|
||||||
elseif (iname == mobs_mc.items.hay_bale) then
|
elseif (iname == mobs_mc.items.hay_bale) then
|
||||||
heal = 20
|
heal = 20
|
||||||
end
|
end
|
||||||
if heal > 0 and mobs:feed_tame(self, clicker, heal, false, true) then
|
if heal > 0 and mobs:feed_tame(self, clicker, heal, false, false) then
|
||||||
return
|
return
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -51,7 +51,6 @@ local spawn_children_on_die = function(child_mob, children_count, spawn_distance
|
||||||
end
|
end
|
||||||
end, children, self.attack)
|
end, children, self.attack)
|
||||||
end
|
end
|
||||||
return true
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
46
tools/remove_end.py
Normal file
46
tools/remove_end.py
Normal file
|
@ -0,0 +1,46 @@
|
||||||
|
world_name = "world"
|
||||||
|
path_to_map_sqlite = "../../../worlds/" + world_name + "/map.sqlite"
|
||||||
|
|
||||||
|
import sqlite3, sys
|
||||||
|
|
||||||
|
try:
|
||||||
|
conn = sqlite3.connect(path_to_map_sqlite)
|
||||||
|
except Error as e:
|
||||||
|
print(e)
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
def unsignedToSigned(i, max_positive):
|
||||||
|
if i < max_positive:
|
||||||
|
return i
|
||||||
|
else:
|
||||||
|
return i - 2*max_positive
|
||||||
|
|
||||||
|
cursor = conn.cursor()
|
||||||
|
cursor.execute("SELECT pos FROM blocks")
|
||||||
|
poses = cursor.fetchall()
|
||||||
|
end_blocks = []
|
||||||
|
for i0 in (poses):
|
||||||
|
i = int(i0[0])
|
||||||
|
blockpos = i
|
||||||
|
x = unsignedToSigned(i % 4096, 2048)
|
||||||
|
i = int((i - x) / 4096)
|
||||||
|
y = unsignedToSigned(i % 4096, 2048)
|
||||||
|
i = int((i - y) / 4096)
|
||||||
|
z = unsignedToSigned(i % 4096, 2048)
|
||||||
|
|
||||||
|
node_pos_y = y * 16
|
||||||
|
if node_pos_y > -28811 and node_pos_y + 15 < -67:
|
||||||
|
end_blocks.append(blockpos)
|
||||||
|
|
||||||
|
if len(end_blocks) < 1:
|
||||||
|
print ("End blocks not found")
|
||||||
|
sys.exit()
|
||||||
|
|
||||||
|
counter = 0
|
||||||
|
for blockpos in end_blocks:
|
||||||
|
print("Deleting ", blockpos)
|
||||||
|
cursor.execute("DELETE FROM blocks WHERE pos=" + str(blockpos))
|
||||||
|
counter += 1
|
||||||
|
conn.commit()
|
||||||
|
|
||||||
|
print(counter, " block(s) deleted")
|
Loading…
Reference in a new issue