Compare commits
10 Commits
847d7454d3
...
00deac97db
Author | SHA1 | Date | |
---|---|---|---|
|
00deac97db | ||
|
3ddf9152f5 | ||
|
4fa1b4635d | ||
|
2d13976dd7 | ||
|
ce32169b93 | ||
|
bf902ec843 | ||
|
f9911958f5 | ||
|
af04b98ade | ||
|
c3556cb526 | ||
|
2b3b92f086 |
2
.mailmap
Normal file
2
.mailmap
Normal file
@ -0,0 +1,2 @@
|
||||
Wuzzy <Wuzzy@disroot.org> <Wuzzy2@mail.ru>
|
||||
Wuzzy <Wuzzy@disroot.org> <almikes@aol.com>
|
@ -1,7 +1,7 @@
|
||||
# Minetest mod: Flying Carpet
|
||||
by Wuzzy
|
||||
|
||||
Version: 1.0.0
|
||||
Version: 1.1.0
|
||||
|
||||
## Introduction
|
||||
Quickly explore the vast terrain with the magical flying carpet. But only the skilled users can master its speed, the fools will crash and hurt themselves.
|
||||
@ -116,7 +116,7 @@ MIT License
|
||||
- `flying_carpet_inventory.png`: Roman Zacharij and Wuzzy, MIT License
|
||||
- `flying_carpet_slide.ogg`: crcavol, MIT License
|
||||
- `flying_carpet_magic_smoke.png`: Wuzzy, MIT License
|
||||
- `flying_carpet_smoke.png.png`: Wuzzy. MIT License
|
||||
- `flying_carpet_smoke.png`: Wuzzy. MIT License
|
||||
- `flying_carpet_star.png`: Wuzzy, MIT License
|
||||
- `flying_carpet_star_warning.png`: Wuzzy, MIT License
|
||||
- `flying_carpet_star_death_warning.png`: Wuzzy, MIT License
|
||||
@ -124,3 +124,4 @@ MIT License
|
||||
|
||||
### License references
|
||||
* [CC BY-SA 3.0](https://creativecommons.org/licenses/by-sa/3.0/)
|
||||
* [MIT License](https://mit-license.org/)
|
||||
|
35
init.lua
35
init.lua
@ -1,5 +1,7 @@
|
||||
local S = minetest.get_translator("flying_carpet")
|
||||
|
||||
local legacy_selectionbox = minetest.settings:get_bool("flying_carpet_legacy_selectionbox", false)
|
||||
|
||||
--
|
||||
-- Helper functions
|
||||
--
|
||||
@ -95,13 +97,22 @@ local update_velocities = function(velocities, new_value)
|
||||
return velocities
|
||||
end
|
||||
|
||||
local collisionbox = {-1,-0.02,-1, 1,0.02,1}
|
||||
if legacy_selectionbox then
|
||||
selectionbox = collisionbox
|
||||
else
|
||||
selectionbox = {-1,-0.03,-0.69, 1,0.03,0.69,rotate=true}
|
||||
end
|
||||
local carpet = {
|
||||
physical = true,
|
||||
collide_with_objects = false,
|
||||
collisionbox = {-1,-0.02,-1, 1,0.02,1},
|
||||
visual = "mesh",
|
||||
mesh = "flying_carpet_model.obj",
|
||||
textures = {"flying_carpet_surface.png"},
|
||||
initial_properties = {
|
||||
physical = true,
|
||||
collide_with_objects = false,
|
||||
collisionbox = collisionbox,
|
||||
selectionbox = selectionbox,
|
||||
visual = "mesh",
|
||||
mesh = "flying_carpet_model.obj",
|
||||
textures = {"flying_carpet_surface.png"},
|
||||
},
|
||||
|
||||
driver = nil, -- Attached player object
|
||||
v = 0, -- Velocity on the horizontal plane
|
||||
@ -219,7 +230,7 @@ function carpet:on_punch(puncher, time_from_last_punch, tool_capabilities, direc
|
||||
-- Owner of flying carpet punches
|
||||
if (self.driver == puncher and self.flying) then
|
||||
-- Go into falling mode immediately
|
||||
minetest.sound_play("flying_carpet_out_of_energy", {pos = self.object:get_pos(), gain=0.7}, false)
|
||||
minetest.sound_play("flying_carpet_out_of_energy", {pos = self.object:get_pos(), gain=0.7}, true)
|
||||
magic_particle(self.object)
|
||||
if mod_mana then
|
||||
mana.setregen(puncher:get_player_name(), mana.getregen(puncher:get_player_name())+mana_regen_cost)
|
||||
@ -248,7 +259,7 @@ function carpet:on_punch(puncher, time_from_last_punch, tool_capabilities, direc
|
||||
minetest.add_item(self.object:get_pos(), leftover)
|
||||
end
|
||||
end
|
||||
minetest.sound_play("flying_carpet_take", {pos=self.object:get_pos(), gain=0.3}, false)
|
||||
minetest.sound_play("flying_carpet_take", {pos=self.object:get_pos(), gain=0.3}, true)
|
||||
puncher:set_detach()
|
||||
if mod_model then
|
||||
player_api.player_attached[puncher:get_player_name()] = false
|
||||
@ -366,7 +377,7 @@ function carpet:on_step(dtime)
|
||||
|
||||
if mod_mana then
|
||||
if mana.getregen(self.driver:get_player_name()) < 0 and mana.get(self.driver:get_player_name()) == 0 then
|
||||
minetest.sound_play("flying_carpet_out_of_energy", {pos = self.object:get_pos(), gain=0.7}, false)
|
||||
minetest.sound_play("flying_carpet_out_of_energy", {pos = self.object:get_pos(), gain=0.7}, true)
|
||||
magic_particle(self.object)
|
||||
self.falling = true
|
||||
self.flying = false
|
||||
@ -545,7 +556,7 @@ function carpet:on_step(dtime)
|
||||
|
||||
if (self.v < 6 and self.starttimer >= 5) or (self.v < 0.5 and self.starttimer >= 0.5) then
|
||||
if self.falling == false then
|
||||
minetest.sound_play("flying_carpet_out_of_energy", {pos = self.object:get_pos(), gain=0.7}, false)
|
||||
minetest.sound_play("flying_carpet_out_of_energy", {pos = self.object:get_pos(), gain=0.7}, true)
|
||||
self.falling = true
|
||||
self.flying = false
|
||||
if mod_mana and self.driver ~= nil then
|
||||
@ -640,7 +651,7 @@ function carpet:on_step(dtime)
|
||||
self.driver:get_meta():set_int("flying_carpet:mana_cost", 0)
|
||||
end
|
||||
end
|
||||
minetest.sound_play("flying_carpet_out_of_energy", {pos = self.object:get_pos(), gain=0.7}, false)
|
||||
minetest.sound_play("flying_carpet_out_of_energy", {pos = self.object:get_pos(), gain=0.7}, true)
|
||||
self.object:remove()
|
||||
return
|
||||
end
|
||||
@ -729,7 +740,7 @@ minetest.register_tool("flying_carpet:carpet", {
|
||||
if not minetest.settings:get_bool("creative_mode") then
|
||||
itemstack:take_item()
|
||||
end
|
||||
minetest.sound_play("flying_carpet_place", {pos = place_pos, gain = 1}, false)
|
||||
minetest.sound_play("flying_carpet_place", {pos = place_pos, gain = 1}, true)
|
||||
return itemstack
|
||||
end,
|
||||
})
|
||||
|
1
mod.conf
1
mod.conf
@ -1,3 +1,4 @@
|
||||
name = flying_carpet
|
||||
title = Flying Carpet
|
||||
optional_depends = player_api, wool, mana, doc_items, doc_identifier
|
||||
description = Quickly explore the vast terrain with the magical flying carpet. But only the skilled users can master its speed, the fools will crash and hurt themselves.
|
||||
|
8
settingtypes.txt
Normal file
8
settingtypes.txt
Normal file
@ -0,0 +1,8 @@
|
||||
# If enabled, the flying carpet uses an outdated non-rotated
|
||||
# square-shaped selection box.
|
||||
# If disabled, the flying carpet has a selection box that matches
|
||||
# its shape and rotation perfectly.
|
||||
# Rotating selection boxes are supported since Minetest 5.7.0.
|
||||
# If your Minetest version is older, enable this setting.
|
||||
# If not, disable this setting.
|
||||
flying_carpet_legacy_selectionbox (Use legacy selection box) bool false
|
Binary file not shown.
Before Width: | Height: | Size: 360 B After Width: | Height: | Size: 301 B |
Loading…
x
Reference in New Issue
Block a user