Change skydiver achievement

This commit is contained in:
Wuzzy 2019-09-22 04:20:40 +02:00
parent 19a773b648
commit 3cb966ac8d
3 changed files with 18 additions and 4 deletions

View File

@ -81,7 +81,16 @@ minetest.register_entity(
physical = false, physical = false,
pointable = false, pointable = false,
automatic_face_movement_dir = -90, automatic_face_movement_dir = -90,
attached = nil, attached = nil,
start_y = nil,
on_activate = function(self, staticdata, dtime_s)
if dtime_s == 0 then
local pos = self.object:get_pos()
self.start_y = pos.y
end
end,
on_step = function(self, dtime) on_step = function(self, dtime)
local pos = self.object:get_pos() local pos = self.object:get_pos()
local under = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z}) local under = minetest.get_node({x = pos.x, y = pos.y - 1, z = pos.z})
@ -143,6 +152,12 @@ minetest.register_entity(
if self.attached ~= nil then if self.attached ~= nil then
default.player_attached[self.attached] = false default.player_attached[self.attached] = false
local player = minetest.get_player_by_name(self.attached)
if player and self.start_y ~= nil then
if self.start_y - self.object:get_pos().y > 100 then
achievements.trigger_achievement(player, "sky_diver")
end
end
self.object:set_detach() self.object:set_detach()
end end
@ -169,9 +184,8 @@ achievements.register_achievement(
"sky_diver", "sky_diver",
{ {
title = S("Skydiver"), title = S("Skydiver"),
description = S("Craft a parachute."), description = S("Descend over 100 blocks with a parachute."),
times = 1, times = 1,
craftitem = "parachute:parachute",
}) })
default.log("mod:parachute", "loaded") default.log("mod:parachute", "loaded")

View File

@ -1,5 +1,5 @@
# textdomain: parachute # textdomain: parachute
Parachute=Fallschirm Parachute=Fallschirm
Skydiver=Fallschirmspringer Skydiver=Fallschirmspringer
Craft a parachute.=Fertigen Sie einen Fallschirm. Descend over 100 blocks with a parachute.=Sinken Sie über 100 Blöcke mit einem Fallschirm ab.
Cannot open parachute on ground!=Fallschirm kann nicht auf dem Boden geöffnet werden! Cannot open parachute on ground!=Fallschirm kann nicht auf dem Boden geöffnet werden!

View File

@ -1,5 +1,5 @@
# textdomain: parachute # textdomain: parachute
Parachute= Parachute=
Skydiver= Skydiver=
Craft a parachute.= Descend over 100 blocks with a parachute.=
Cannot open parachute on ground!= Cannot open parachute on ground!=