Version 2.2.2

- Fix passengers not detaching when driver gets out.
- Various other tweaks and fixes for passengers.

Requires `lib_mount` to be updated first.
This commit is contained in:
Panquesito7 2020-06-02 11:58:31 -05:00
parent bd47a615d8
commit 623ee9aa05
No known key found for this signature in database
GPG Key ID: 3C482B03FD220E68
2 changed files with 38 additions and 25 deletions

View File

@ -1,6 +1,6 @@
# Vehicle Mash [![Build status](https://github.com/Panquesito7/vehicle_mash/workflows/build/badge.svg)](https://github.com/Panquesito7/vehicle_mash/actions)
- Current version: 2.2.1
- Current version: 2.2.2
- By [blert2112](https://github.com/blert2112), and improvements by [Panquesito7](https://github.com/Panquesito7).
![Screenshot](https://raw.githubusercontent.com/Panquesito7/vehicle_mash/master/screenshot.png)
@ -37,7 +37,7 @@ For further information or help, see:\
https://wiki.minetest.net/Installing_Mods
## Known issues
- When there is more than 1 passenger, and the driver gets out, one or more players will stay attached to the vehicle.
- Attachments incorrectly ordered.
## License
All licenses of previous works, of course, apply. (see credits below)
@ -58,21 +58,26 @@ There are no pending tasks to do yet.
## Changelog
v2.2.2 6/02/2020
* Fix passengers not detaching when driver gets out.
* Various other tweaks and fixes for passengers.
v2.2.1 5/28/2020
* Added vehicle crafting (Enabled by default).
* Added car battery, windshield, tire, and motor.
* All CAR01's can now carry 3 passengers.
* Add `screenshot.png`.
* Improve `README.md`.
* Added vehicle crafting (Enabled by default).
* Added car battery, windshield, tire, and motor.
* All CAR01's can now carry 3 passengers.
* Add `screenshot.png`.
* Improve `README.md`.
v2.2 5/15/2020
* Move files to a folder of its own.
* Add GitHub workflow and LuaCheck.
* Add `settingtypes.txt` to select enabled cars.
* Improve `README.md`.
* Short a bit the code.
* Move files to a folder of its own.
* Add GitHub workflow and LuaCheck.
* Add `settingtypes.txt` to select enabled cars.
* Improve `README.md`.
* Short a bit the code.
v2.1 6/10/2019

View File

@ -2,8 +2,6 @@
vehicle_mash = {}
local drive = lib_mount.drive
local passenger_count = 1
function vehicle_mash.register_vehicle(name, def)
minetest.register_entity(name, {
terrain_type = def.terrain_type,
@ -52,34 +50,44 @@ function vehicle_mash.register_vehicle(name, def)
end
-- if there is already a driver
if self.driver then
-- if clicker is driver detach passenger and driver
-- if clicker is driver detach passengers and driver
if clicker == self.driver then
if self.passenger then
-- if passenger detach first
lib_mount.detach(self.passenger, self.offset)
passenger_count = passenger_count - 1
end
if self.passenger2 then
lib_mount.detach(self.passenger2, self.offset)
end
if self.passenger3 then
lib_mount.detach(self.passenger3, self.offset)
end
-- detach driver
lib_mount.detach(self.driver, self.offset)
-- if clicker is not the driver
else
-- if clicker is passenger
-- detach passengers
if clicker == self.passenger then
-- detach passenger
lib_mount.detach(self.passenger, self.offset)
passenger_count = passenger_count - 1
elseif clicker == self.passenger2 then
lib_mount.detach(self.passenger2, self.offset)
elseif clicker == self.passenger3 then
lib_mount.detach(self.passenger3, self.offset)
-- if clicker is not passenger
else
-- attach passengers if possible
if passenger_count == 1 and self.number_of_passengers >= 1 then
if lib_mount.passengers[self.passenger] == self.passenger and self.number_of_passengers >= 1 then
lib_mount.attach(self, clicker, true, 1)
passenger_count = passenger_count + 1
elseif passenger_count == 2 and self.number_of_passengers >= 2 then
end
if lib_mount.passengers[self.passenger2] == self.passenger2 and self.number_of_passengers >= 2 then
lib_mount.attach(self, clicker, true, 2)
passenger_count = passenger_count + 1
elseif passenger_count == 3 and self.number_of_passengers >= 3 then
end
if lib_mount.passengers[self.passenger3] == self.passenger3 and self.number_of_passengers >= 3 then
lib_mount.attach(self, clicker, true, 3)
passenger_count = passenger_count + 1
end
end
end