Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
M
mob_horse
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Illuna-Minetest
mob_horse
Commits
12e1ca60
Commit
12e1ca60
authored
7 years ago
by
TenPlus1
Browse files
Options
Downloads
Patches
Plain Diff
horses drop shoes when they die or when they are changed
parent
7f5a2723
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
init.lua
+20
-6
20 additions, 6 deletions
init.lua
with
20 additions
and
6 deletions
init.lua
+
20
−
6
View file @
12e1ca60
...
...
@@ -73,6 +73,11 @@ mobs:register_mob("mob_horse:horse", {
mobs
.
detach
(
self
.
driver
,
{
x
=
1
,
y
=
0
,
z
=
1
})
end
-- drop any horseshoes added
if
self
.
shoed
then
minetest
.
add_item
(
pos
,
self
.
shoed
)
end
end
,
on_rightclick
=
function
(
self
,
clicker
)
...
...
@@ -134,8 +139,8 @@ mobs:spawn({
mobs
:
register_egg
(
"mob_horse:horse"
,
"Horse"
,
"wool_brown.png"
,
1
)
-- horseshoe elper function
local
apply_shoes
=
function
(
name
,
itemstack
,
obj
,
speed
,
jump
,
reverse
)
-- horseshoe
h
elper function
local
apply_shoes
=
function
(
name
,
itemstack
,
obj
,
shoes
,
speed
,
jump
,
reverse
)
if
obj
.
type
~=
"object"
then
return
end
...
...
@@ -144,10 +149,15 @@ local apply_shoes = function(name, itemstack, obj, speed, jump, reverse)
if
ent
.
name
and
ent
.
name
==
"mob_horse:horse"
then
if
ent
.
shoed
then
minetest
.
add_item
(
mob
:
getpos
(),
ent
.
shoed
)
end
ent
.
max_speed_forward
=
speed
ent
.
jump_height
=
jump
ent
.
max_speed_reverse
=
reverse
ent
.
accel
=
speed
ent
.
shoed
=
shoes
minetest
.
chat_send_player
(
name
,
"Horse shoes fitted -"
..
" speed: "
..
speed
...
...
@@ -166,7 +176,8 @@ minetest.register_craftitem(":mobs:horseshoe_steel", {
description
=
"Steel HorseShoes (use on horse to apply)"
,
inventory_image
=
"mobs_horseshoe_steel.png"
,
on_use
=
function
(
itemstack
,
user
,
pointed_thing
)
return
apply_shoes
(
user
:
get_player_name
(),
itemstack
,
pointed_thing
,
7
,
4
,
2
)
return
apply_shoes
(
user
:
get_player_name
(),
itemstack
,
pointed_thing
,
"mobs:horseshoe_steel"
,
7
,
4
,
2
)
end
,
})
...
...
@@ -184,7 +195,8 @@ minetest.register_craftitem(":mobs:horseshoe_bronze", {
description
=
"Bronze HorseShoes (use on horse to apply)"
,
inventory_image
=
"mobs_horseshoe_bronze.png"
,
on_use
=
function
(
itemstack
,
user
,
pointed_thing
)
return
apply_shoes
(
user
:
get_player_name
(),
itemstack
,
pointed_thing
,
7
,
4
,
4
)
return
apply_shoes
(
user
:
get_player_name
(),
itemstack
,
pointed_thing
,
"mobs:horseshoe_bronze"
,
7
,
4
,
4
)
end
,
})
...
...
@@ -202,7 +214,8 @@ minetest.register_craftitem(":mobs:horseshoe_mese", {
description
=
"Mese HorseShoes (use on horse to apply)"
,
inventory_image
=
"mobs_horseshoe_mese.png"
,
on_use
=
function
(
itemstack
,
user
,
pointed_thing
)
return
apply_shoes
(
user
:
get_player_name
(),
itemstack
,
pointed_thing
,
9
,
5
,
8
)
return
apply_shoes
(
user
:
get_player_name
(),
itemstack
,
pointed_thing
,
"mobs:horseshoe_mese"
,
9
,
5
,
8
)
end
,
})
...
...
@@ -220,7 +233,8 @@ minetest.register_craftitem(":mobs:horseshoe_diamond", {
description
=
"Diamond HorseShoes (use on horse to apply)"
,
inventory_image
=
"mobs_horseshoe_diamond.png"
,
on_use
=
function
(
itemstack
,
user
,
pointed_thing
)
return
apply_shoes
(
user
:
get_player_name
(),
itemstack
,
pointed_thing
,
10
,
5
,
6
)
return
apply_shoes
(
user
:
get_player_name
(),
itemstack
,
pointed_thing
,
"mobs:horseshoe_diamond"
,
10
,
6
,
6
)
end
,
})
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment