diff --git a/README.md b/README.md index 8bbe77d..2f416a5 100644 --- a/README.md +++ b/README.md @@ -13,4 +13,6 @@ This Mod is very WIP. ![alt screenshot] (https://raw.githubusercontent.com/DS-Minetest/mvehicles/master/screenshot.png) **licenses:** look into [license.txt](https://github.com/DS-Minetest/mvehicles/blob/master/license.txt) -[![licensebutton](http://dev.minetest.net/skins/common/images/cc-by-sa.png)](https://creativecommons.org/licenses/by-sa/3.0/) [![licensebutton](http://i.creativecommons.org/l/by/3.0/88x31.png)](https://creativecommons.org/licenses/by/3.0/) [![licensebutton](https://licensebuttons.net/p/zero/1.0/88x31.png)](https://creativecommons.org/publicdomain/zero/1.0/) \ No newline at end of file +[![licensebutton](http://dev.minetest.net/skins/common/images/cc-by-sa.png)](https://creativecommons.org/licenses/by-sa/3.0/) +[![licensebutton](http://i.creativecommons.org/l/by/3.0/88x31.png)](https://creativecommons.org/licenses/by/3.0/) +[![licensebutton](https://licensebuttons.net/p/zero/1.0/88x31.png)](https://creativecommons.org/publicdomain/zero/1.0/) \ No newline at end of file diff --git a/models/mvehicles_tank_shoot.b3d b/models/mvehicles_tank_shoot.b3d new file mode 100644 index 0000000..16da54b Binary files /dev/null and b/models/mvehicles_tank_shoot.b3d differ diff --git a/not used media/tank/mvehicles_tank_shoot.blend b/not used media/tank/mvehicles_tank_shoot.blend index 7dbbf96..9c4dcc7 100644 Binary files a/not used media/tank/mvehicles_tank_shoot.blend and b/not used media/tank/mvehicles_tank_shoot.blend differ diff --git a/not used media/tank/mvehicles_tank_shoot.1.ogg b/sounds/mvehicles_tank_shoot.1.ogg similarity index 100% rename from not used media/tank/mvehicles_tank_shoot.1.ogg rename to sounds/mvehicles_tank_shoot.1.ogg diff --git a/not used media/tank/mvehicles_tank_shoot.2.ogg b/sounds/mvehicles_tank_shoot.2.ogg similarity index 100% rename from not used media/tank/mvehicles_tank_shoot.2.ogg rename to sounds/mvehicles_tank_shoot.2.ogg diff --git a/not used media/tank/mvehicles_tank_shoot.3.ogg b/sounds/mvehicles_tank_shoot.3.ogg similarity index 100% rename from not used media/tank/mvehicles_tank_shoot.3.ogg rename to sounds/mvehicles_tank_shoot.3.ogg diff --git a/not used media/tank/mvehicles_tank_shoot.4.ogg b/sounds/mvehicles_tank_shoot.4.ogg similarity index 100% rename from not used media/tank/mvehicles_tank_shoot.4.ogg rename to sounds/mvehicles_tank_shoot.4.ogg diff --git a/tank.lua b/tank.lua index f4b119b..af9ac6c 100644 --- a/tank.lua +++ b/tank.lua @@ -15,15 +15,20 @@ minetest.register_entity( collide_with_objects = true, weight = 5, collisionbox = {-0.1,-0.1,-0.1, 0.1,0.1,0.1}, - visual ="sprite", --"cube"/"sprite"/"upright_sprite"/"mesh"/"wielditem", - visual_size = {x=0.5, y=0.5}, - textures = {"heart.png"}, + visual ="mesh", --"cube"/"sprite"/"upright_sprite"/"mesh"/"wielditem", + visual_size = {x=5, y=5}, + mesh = "mvehicles_tank_shoot.b3d", + textures = {"mvehicles_tank_shoot.png"}, colors = {}, spritediv = {x=1, y=1}, initial_sprite_basepos = {x=0, y=0}, is_visible = true, makes_footstep_sound = false, automatic_rotate = false, + automatic_face_movement_dir = 90.0, + -- ^ automatically set yaw to movement direction; offset in degrees; false to disable + automatic_face_movement_max_rotation_per_sec = -1, + -- ^ limit automatic rotation to this value in degrees per second. values < 0 no limit on_activate = function(self, staticdata) if staticdata ~= "" then @@ -63,6 +68,9 @@ minetest.register_entity( end end + local rot = -math.deg(math.atan(self.object:getvelocity().y/(self.object:getvelocity().x^2+self.object:getvelocity().z^2)^0.5)) + self.object:set_animation({x=rot+90, y=rot+90}, 0, 0) + self.oldpos = self.object:getpos() self.oldvel = self.object:getvelocity() self.oldacc = self.object:getacceleration() @@ -451,6 +459,11 @@ minetest.register_entity( z=(math.sin(self.cannon_direction_horizontal + math.rad(90)))*((math.sin(math.rad(-self.cannon_direction_vertical)))*self.shooting_range) }) ) + minetest.sound_play("mvehicles_tank_shoot", { + pos = self.object:getpos(), + gain = 0.5, + max_hear_distance = 32, -- default, uses an euclidean metric + }) self.shootable = false minetest.after( diff --git a/textures/mvehicles_tank_shoot.png b/textures/mvehicles_tank_shoot.png new file mode 100644 index 0000000..e940e39 Binary files /dev/null and b/textures/mvehicles_tank_shoot.png differ