3 Commits c2fa3e300c ... 97f2e47288

Auteur SHA1 Bericht Datum
  tenplus1 97f2e47288 update translation checks 2 jaren geleden
  tenplus1 3e15456bce fix intllib return 3 jaren geleden
  tenplus1 99ca850018 simplify baby chicken from egg (thanks MoNTE48) 3 jaren geleden
10 gewijzigde bestanden met toevoegingen van 40 en 40 verwijderingen
  1. 1 1
      bee.lua
  2. 1 1
      bunny.lua
  3. 8 25
      chicken.lua
  4. 1 1
      cow.lua
  5. 26 5
      init.lua
  6. 0 2
      intllib.lua
  7. 1 1
      kitten.lua
  8. 1 2
      panda.lua
  9. 1 2
      penguin.lua
  10. 0 0
      rat.lua

+ 1 - 1
bee.lua

@@ -1,5 +1,5 @@
 
-local S = mobs.intllib
+local S = mobs.intllib_animal
 
 -- Bee by KrupnoPavel (.b3d model by sirrobzeroone)
 

+ 1 - 1
bunny.lua

@@ -1,5 +1,5 @@
 
-local S = mobs.intllib
+local S = mobs.intllib_animal
 
 
 -- Bunny by ExeterDad

+ 8 - 25
chicken.lua

@@ -1,5 +1,5 @@
 
-local S = mobs.intllib
+local S = mobs.intllib_animal
 
 
 -- Chicken by JK Murray and Sirrobzeroone
@@ -146,7 +146,7 @@ mobs:register_arrow("mobs_animal:egg_entity", {
 
 	hit_node = function(self, pos, node)
 
-		if math.random(1, 10) > 1 then
+		if math.random(10) > 1 then
 			return
 		end
 
@@ -160,28 +160,10 @@ mobs:register_arrow("mobs_animal:egg_entity", {
 			return
 		end
 
-		local mob = minetest.add_entity(pos, "mobs_animal:chicken")
-		local ent2 = mob:get_luaentity()
-
-		mob:set_properties({
-			textures = ent2.child_texture[1],
-			visual_size = {
-				x = ent2.base_size.x / 2,
-				y = ent2.base_size.y / 2
-			},
-			collisionbox = {
-				ent2.base_colbox[1] / 2,
-				ent2.base_colbox[2] / 2,
-				ent2.base_colbox[3] / 2,
-				ent2.base_colbox[4] / 2,
-				ent2.base_colbox[5] / 2,
-				ent2.base_colbox[6] / 2
-			},
-		})
+		local staticdata = minetest.serialize(
+			{child = true, tamed = true, owner = self.playername})
 
-		ent2.child = true
-		ent2.tamed = true
-		ent2.owner = self.playername
+		minetest.add_entity(pos, "mobs_animal:chicken", staticdata)
 	end
 })
 
@@ -215,13 +197,13 @@ local mobs_shoot_egg = function (item, player, pointed_thing)
 	ent.switch = 1 -- needed so that egg doesn't despawn straight away
 	ent._is_arrow = true -- tell advanced mob protection this is an arrow
 
-	obj:setvelocity({
+	obj:set_velocity({
 		x = dir.x * egg_VELOCITY,
 		y = dir.y * egg_VELOCITY,
 		z = dir.z * egg_VELOCITY
 	})
 
-	obj:setacceleration({
+	obj:set_acceleration({
 		x = dir.x * -3,
 		y = -egg_GRAVITY,
 		z = dir.z * -3
@@ -229,6 +211,7 @@ local mobs_shoot_egg = function (item, player, pointed_thing)
 
 	-- pass player name to egg for chick ownership
 	local ent2 = obj:get_luaentity()
+
 	ent2.playername = player:get_player_name()
 
 	item:take_item()

+ 1 - 1
cow.lua

@@ -1,5 +1,5 @@
 
-local S = mobs.intllib
+local S = mobs.intllib_animal
 
 
 -- Cow by sirrobzeroone

+ 26 - 5
init.lua

@@ -1,11 +1,31 @@
-
 local path = minetest.get_modpath(minetest.get_current_modname()) .. "/"
 
-local S = minetest.get_translator and minetest.get_translator("mobs_animal") or
-		dofile(path .. "intllib.lua")
+local S
+
+-- Check for translation method
+local S
+if minetest.get_translator ~= nil then
+	S = minetest.get_translator("mobs_animal") -- 5.x translation function
+else
+	if minetest.get_modpath("intllib") then
+		dofile(minetest.get_modpath("intllib") .. "/init.lua")
+		if intllib.make_gettext_pair then
+			gettext, ngettext = intllib.make_gettext_pair() -- new gettext method
+		else
+			gettext = intllib.Getter() -- old text file method
+		end
+		S = gettext
+	else -- boilerplate function
+		S = function(str, ...)
+			local args = {...}
+			return str:gsub("@%d+", function(match)
+				return args[tonumber(match:sub(2))]
+			end)
+		end
+	end
+end
 
-mobs.intllib = S
+mobs.intllib_animal = S
 
 
 -- Check for custom mob spawn file
@@ -41,4 +61,4 @@ end
 dofile(path .. "lucky_block.lua")
 
 
-print (S("[MOD] Mobs Redo Animals loaded"))
+print ("[MOD] Mobs Redo Animals loaded")

+ 0 - 2
intllib.lua

@@ -1,3 +0,0 @@
-dofile(minetest.get_modpath("intllib").."/init.lua")
-

+ 1 - 1
kitten.lua

@@ -1,5 +1,5 @@
 
-local S = mobs.intllib
+local S = mobs.intllib_animal
 local hairball = minetest.settings:get("mobs_hairball")
 
 -- Kitten by Jordach / BFD

+ 1 - 2
panda.lua

@@ -1,6 +1,5 @@
 
-local S = mobs.intllib
-
+local S = mobs.intllib_animal
 
 -- Panda by AspireMint (CC BY-SA 3.0)
 

+ 1 - 2
penguin.lua

@@ -1,6 +1,5 @@
 
-local S = mobs.intllib
-
+local S = mobs.intllib_animal
 
 -- Penguin by D00Med
 

+ 0 - 0
rat.lua


Some files were not shown because too many files changed in this diff