added tag of owner

This commit is contained in:
Alexsandro Percy 2022-01-26 16:15:03 -03:00
parent b1045907f3
commit 64fa93d8f9
3 changed files with 16 additions and 37 deletions

View File

@ -203,6 +203,20 @@ function automobiles_lib.get_gauge_angle(value, initial_angle)
return angle
end
function automobiles_lib.setText(self, vehicle_name)
local properties = self.object:get_properties()
local formatted = ""
if self.hp_max then
formatted = " Current hp: " .. string.format(
"%.2f", self.hp_max
)
end
if properties then
properties.infotext = "Nice ".. vehicle_name .." of " .. self.owner .. "." .. formatted
self.object:set_properties(properties)
end
end
dofile(minetest.get_modpath("automobiles_lib") .. DIR_DELIM .. "custom_physics.lua")
dofile(minetest.get_modpath("automobiles_lib") .. DIR_DELIM .. "control.lua")
dofile(minetest.get_modpath("automobiles_lib") .. DIR_DELIM .. "fuel_management.lua")

View File

@ -40,6 +40,7 @@ minetest.register_craftitem("automobiles_roadster:roadster", {
car:set_yaw(placer:get_look_horizontal())
itemstack:take_item()
ent.object:set_acceleration({x=0,y=-automobiles_lib.gravity,z=0})
automobiles_lib.setText(ent, "Roadster")
end
end
@ -84,40 +85,3 @@ if minetest.get_modpath("default") then
end
--[[if minetest.get_modpath("default") then
if not minetest.registered_items["hidroplane:wings"] then
minetest.register_craft({
output = "supercub:wings",
recipe = {
{"wool:white", "farming:string", "wool:white"},
{"group:wood", "group:wood", "group:wood"},
{"wool:white", "default:steel_ingot", "wool:white"},
}
})
end
if not minetest.registered_items["hidroplane:fuselage"] then
minetest.register_craft({
output = "supercub:fuselage",
recipe = {
{"default:steel_ingot", "default:diamondblock", "default:steel_ingot"},
{"wool:white", "default:steel_ingot", "wool:white"},
{"default:steel_ingot", "default:mese_block", "default:steel_ingot"},
}
})
end
minetest.register_craft({
output = "supercub:supercub",
recipe = {
{"supercub:wings",},
{"supercub:fuselage",},
}
})
minetest.register_craft({
output = "supercub:supercub",
recipe = {
{"hidroplane:wings",},
{"hidroplane:fuselage",},
}
})
end]]--

View File

@ -270,6 +270,7 @@ minetest.register_entity("automobiles_roadster:roadster", {
self._race_id = data.stored_race_id
self._show_rag = data.stored_rag
self._pitch = data.stored_pitch
automobiles_lib.setText(self, "Roadster")
end
self.object:set_animation({x = 1, y = 8}, 0, 0, true)