Compare commits

..

1 Commits
master ... mff

Author SHA1 Message Date
sys4-fr 202fc3c03a Version MFF. 2018-09-06 21:56:38 +02:00
54 changed files with 557 additions and 775 deletions

View File

@ -1,57 +1,36 @@
Minetest mod: boost_cart
==========================
Minetest mod: carts for MFF
===========================
Based on boost_cart and modified to fully *replace* carts (@Coethium)
- desactivate mesecons
- power_rail: accelerate, max_speed set in init.lua
- brake_rail: deccelerate, min_speed set in init.lua (so the cart doesn't stop and runs at very low speed)
- default:rail / rail_cooper : no friction, keep the current speed
- no collision (avoid the "walled_in" bug)
Boost_cart
==========
Based on (and fully compatible with) the mod "carts" by PilzAdam
and the one contained in the subgame "minetest_game".
Target: Run smoothly as possible, even on laggy servers.
Target: Run smoothly and do not use too much CPU
License of source code:
-----------------------
WTFPL
Features
----------
- A fast cart for your railway or roller coaster
- Easily configurable cart speed using the Advanced Settings
- Boost and brake rails
- By mesecons controlled Start-Stop rails
- Detector rails that send a mesecons signal when the cart drives over them
- Rail junction switching with the 'right/left' walking keys
- Handbrake with the 'back' key
- Support for non-minetest_game subgames
License of media (textures, sounds and models):
-----------------------------------------------
CC-0
Authors of media files:
-----------------------
kddekadenz:
cart_bottom.png
cart_side.png
cart_top.png
Settings
----------
This mod can be adjusted to fit the conditions of a player or server.
Use the Advanced Settings dialog in the main menu or tune your
minetest.conf file manually:
boost_cart.speed_max = 10
^ Possible values: 1 ... 100
^ Maximal speed of the cart in m/s
boost_cart.punch_speed_max = 7
^ Possible values: -1 ... 100
^ Maximal speed to which the driving player can accelerate the cart
by punching from inside the cart. -1 will disable this feature.
License for everything
------------------------
CC-0, if not specified otherwise below
Authors
---------
Various authors
carts_rail_*.png
kddekadenz
cart_bottom.png
cart_side.png
cart_top.png
klankbeeld (CC-BY 3.0)
http://freesound.org/people/klankbeeld/sounds/174042/
cart_rail.*.ogg
Zeg9
cart.x
cart.png
Zeg9:
cart.x
cart.png

View File

@ -1,452 +0,0 @@
local HAVE_MESECONS_ENABLED = minetest.global_exists("mesecon")
function boost_cart:on_rail_step(entity, pos, distance)
-- Play rail sound
if entity.sound_counter <= 0 then
minetest.sound_play("cart_rail", {
pos = pos,
max_hear_distance = 40,
gain = 0.5
})
entity.sound_counter = math.random(4, 15)
end
entity.sound_counter = entity.sound_counter - distance
if HAVE_MESECONS_ENABLED then
boost_cart:signal_detector_rail(pos)
end
end
local cart_entity = {
initial_properties = {
physical = false,
collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
visual = "mesh",
mesh = "cart.x",
visual_size = {x=1, y=1},
textures = {"cart.png"},
},
driver = nil,
punched = false, -- used to re-send velocity and position
velocity = {x=0, y=0, z=0}, -- only used on punch
old_dir = {x=1, y=0, z=0}, -- random value to start the cart on punch
old_pos = nil,
old_switch = 0,
sound_counter = 0,
railtype = nil,
attached_items = {}
}
-- Model and textures
if boost_cart.mtg_compat then
cart_entity.initial_properties.mesh = "carts_cart.b3d"
cart_entity.initial_properties.textures = {"carts_cart.png"}
end
function cart_entity:on_rightclick(clicker)
if not clicker or not clicker:is_player() then
return
end
local player_name = clicker:get_player_name()
if self.driver and player_name == self.driver then
self.driver = nil
boost_cart:manage_attachment(clicker, nil)
elseif not self.driver then
self.driver = player_name
boost_cart:manage_attachment(clicker, self.object)
if default.player_set_animation then
-- player_api(/default) does not update the animation
-- when the player is attached, reset to default animation
default.player_set_animation(clicker, "stand")
end
end
end
function cart_entity:on_activate(staticdata, dtime_s)
self.object:set_armor_groups({immortal=1})
self.sound_counter = math.random(4, 15)
if string.sub(staticdata, 1, string.len("return")) ~= "return" then
return
end
local data = minetest.deserialize(staticdata)
if type(data) ~= "table" then
return
end
self.railtype = data.railtype
self.old_dir = data.old_dir or self.old_dir
self.old_pos = data.old_pos or self.old_pos
-- Correct the position when the cart drives further after the last 'step()'
if self.old_pos and boost_cart:is_rail(self.old_pos, self.railtype) then
self.object:set_pos(self.old_pos)
end
end
function cart_entity:get_staticdata()
return minetest.serialize({
railtype = self.railtype,
old_dir = self.old_dir,
old_pos = self.old_pos
})
end
-- 0.5.x and later: When the driver leaves
function cart_entity:on_detach_child(child)
if child and child:get_player_name() == self.driver then
self.driver = nil
end
end
function cart_entity:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
local pos = self.object:get_pos()
local vel = self.object:get_velocity()
if not self.railtype or vector.equals(vel, {x=0, y=0, z=0}) then
local node = minetest.get_node(pos).name
self.railtype = minetest.get_item_group(node, "connect_to_raillike")
end
if not puncher or not puncher:is_player() then
local cart_dir = boost_cart:get_rail_direction(pos, self.old_dir, nil, nil, self.railtype)
if vector.equals(cart_dir, {x=0, y=0, z=0}) then
return
end
self.velocity = vector.multiply(cart_dir, 3)
self.punched = true
return
end
if puncher:get_player_control().sneak then
-- Pick up cart: Drop all attachments
if self.driver then
if self.old_pos then
self.object:set_pos(self.old_pos)
end
local player = minetest.get_player_by_name(self.driver)
boost_cart:manage_attachment(player, nil)
end
for _, obj_ in pairs(self.attached_items) do
if obj_ then
obj_:set_detach()
end
end
local leftover = puncher:get_inventory():add_item("main", "carts:cart")
if not leftover:is_empty() then
minetest.add_item(pos, leftover)
end
self.object:remove()
return
end
-- Driver punches to accelerate the cart
if puncher:get_player_name() == self.driver then
if math.abs(vel.x + vel.z) > boost_cart.punch_speed_max then
return
end
end
local punch_dir = boost_cart:velocity_to_dir(puncher:get_look_dir())
punch_dir.y = 0
local cart_dir = boost_cart:get_rail_direction(pos, punch_dir, nil, nil, self.railtype)
if vector.equals(cart_dir, {x=0, y=0, z=0}) then
return
end
local punch_interval = 1
if tool_capabilities and tool_capabilities.full_punch_interval then
punch_interval = tool_capabilities.full_punch_interval
end
time_from_last_punch = math.min(time_from_last_punch or punch_interval, punch_interval)
local f = 3 * (time_from_last_punch / punch_interval)
self.velocity = vector.multiply(cart_dir, f)
self.old_dir = cart_dir
self.punched = true
end
local v3_len = vector.length
function cart_entity:on_step(dtime)
local vel = self.object:get_velocity()
if self.punched then
vel = vector.add(vel, self.velocity)
self.object:set_velocity(vel)
self.old_dir.y = 0
elseif vector.equals(vel, {x=0, y=0, z=0}) then
return
end
local pos = self.object:get_pos()
local cart_dir = boost_cart:velocity_to_dir(vel)
local same_dir = vector.equals(cart_dir, self.old_dir)
local update = {}
if self.old_pos and not self.punched and same_dir then
local flo_pos = vector.round(pos)
local flo_old = vector.round(self.old_pos)
if vector.equals(flo_pos, flo_old) then
-- Do not check one node multiple times
return
end
end
local ctrl, player
local distance = 1
-- Get player controls
if self.driver then
player = minetest.get_player_by_name(self.driver)
if player then
ctrl = player:get_player_control()
end
end
local stop_wiggle = false
if self.old_pos and same_dir then
-- Detection for "skipping" nodes (perhaps use average dtime?)
-- It's sophisticated enough to take the acceleration in account
local acc = self.object:get_acceleration()
distance = dtime * (v3_len(vel) + 0.5 * dtime * v3_len(acc))
local new_pos, new_dir = boost_cart:pathfinder(
pos, self.old_pos, self.old_dir, distance, ctrl,
self.old_switch, self.railtype
)
if new_pos then
-- No rail found: set to the expected position
pos = new_pos
update.pos = true
cart_dir = new_dir
end
elseif self.old_pos and self.old_dir.y ~= 1 and not self.punched then
-- Stop wiggle
stop_wiggle = true
end
-- dir: New moving direction of the cart
-- switch_keys: Currently pressed L(1) or R(2) key,
-- used to ignore the key on the next rail node
local dir, switch_keys = boost_cart:get_rail_direction(
pos, cart_dir, ctrl, self.old_switch, self.railtype
)
local dir_changed = not vector.equals(dir, self.old_dir)
local acc = 0
if stop_wiggle or vector.equals(dir, {x=0, y=0, z=0}) then
vel = {x=0, y=0, z=0}
local pos_r = vector.round(pos)
if not boost_cart:is_rail(pos_r, self.railtype)
and self.old_pos then
pos = self.old_pos
elseif not stop_wiggle then
pos = pos_r
else
pos.y = math.floor(pos.y + 0.5)
end
update.pos = true
update.vel = true
else
-- Direction change detected
if dir_changed then
vel = vector.multiply(dir, math.abs(vel.x + vel.z))
update.vel = true
if dir.y ~= self.old_dir.y then
pos = vector.round(pos)
update.pos = true
end
end
-- Center on the rail
if dir.z ~= 0 and math.floor(pos.x + 0.5) ~= pos.x then
pos.x = math.floor(pos.x + 0.5)
update.pos = true
end
if dir.x ~= 0 and math.floor(pos.z + 0.5) ~= pos.z then
pos.z = math.floor(pos.z + 0.5)
update.pos = true
end
-- Calculate current cart acceleration
acc = nil
local acc_meta = minetest.get_meta(pos):get_string("cart_acceleration")
if acc_meta == "halt" and not self.punched then
-- Stop rail
vel = {x=0, y=0, z=0}
acc = false
pos = vector.round(pos)
update.pos = true
update.vel = true
end
if acc == nil then
-- Meta speed modifier
local speed_mod = tonumber(acc_meta)
if speed_mod and speed_mod ~= 0 then
-- Try to make it similar to the original carts mod
acc = speed_mod * 10
end
end
if acc == nil and boost_cart.mtg_compat then
-- MTG Cart API adaption
local rail_node = minetest.get_node(vector.round(pos))
local railparam = carts.railparams[rail_node.name]
if railparam and railparam.acceleration then
acc = railparam.acceleration
end
end
if acc ~= false then
-- Handbrake
if ctrl and ctrl.down then
acc = (acc or 0) - 2
elseif acc == nil then
acc = -0.4
end
end
if acc then
-- Slow down or speed up, depending on Y direction
acc = acc + dir.y * -2.1
else
acc = 0
end
end
-- Limit cart speed
local vel_len = vector.length(vel)
if vel_len > boost_cart.speed_max then
vel = vector.multiply(vel, boost_cart.speed_max / vel_len)
update.vel = true
end
if vel_len >= boost_cart.speed_max and acc > 0 then
acc = 0
end
self.object:set_acceleration(vector.multiply(dir, acc))
self.old_pos = vector.round(pos)
local old_y_dir = self.old_dir.y
if not vector.equals(dir, {x=0, y=0, z=0}) and not stop_wiggle then
self.old_dir = dir
else
-- Cart stopped, set the animation to 0
self.old_dir.y = 0
end
self.old_switch = switch_keys
boost_cart:on_rail_step(self, self.old_pos, distance)
if self.punched then
-- Collect dropped items
for _, obj_ in pairs(minetest.get_objects_inside_radius(pos, 1)) do
if not obj_:is_player() and
obj_:get_luaentity() and
not obj_:get_luaentity().physical_state and
obj_:get_luaentity().name == "__builtin:item" then
obj_:set_attach(self.object, "", {x=0, y=0, z=0}, {x=0, y=0, z=0})
self.attached_items[#self.attached_items + 1] = obj_
end
end
self.punched = false
update.vel = true
end
if not (update.vel or update.pos) then
return
end
-- Re-use "dir", localize self.old_dir
dir = self.old_dir
local yaw = 0
if dir.x < 0 then
yaw = 0.5
elseif dir.x > 0 then
yaw = 1.5
elseif dir.z < 0 then
yaw = 1
end
self.object:set_yaw(yaw * math.pi)
local anim = {x=0, y=0}
if dir.y == -1 then
anim = {x=1, y=1}
elseif dir.y == 1 then
anim = {x=2, y=2}
end
self.object:set_animation(anim, 1, 0)
-- Change player model rotation, depending on the Y direction
if player and dir.y ~= old_y_dir then
local feet = {x=0, y=0, z=0}
local eye = {x=0, y=-4, z=0}
feet.y = boost_cart.old_player_model and 6 or -4
if dir.y ~= 0 then
-- TODO: Find a better way to calculate this
if boost_cart.old_player_model then
feet.y = feet.y + 2
feet.z = -dir.y * 6
else
feet.y = feet.y + 4
feet.z = -dir.y * 2
end
eye.z = -dir.y * 8
end
player:set_attach(self.object, "", feet,
{x=dir.y * -30, y=0, z=0})
player:set_eye_offset(eye, eye)
end
if update.vel then
self.object:set_velocity(vel)
end
if update.pos then
if dir_changed then
self.object:set_pos(pos)
else
self.object:move_to(pos)
end
end
end
minetest.register_entity(":carts:cart", cart_entity)
-- Register item to place the entity
if not boost_cart.mtg_compat then
minetest.register_craftitem(":carts:cart", {
description = "Cart (Sneak+Click to pick up)",
inventory_image = minetest.inventorycube(
"cart_top.png",
"cart_side.png",
"cart_side.png"
),
wield_image = "cart_side.png",
on_place = function(itemstack, placer, pointed_thing)
if not pointed_thing.type == "node" then
return
end
if boost_cart:is_rail(pointed_thing.under) then
minetest.add_entity(pointed_thing.under, "carts:cart")
elseif boost_cart:is_rail(pointed_thing.above) then
minetest.add_entity(pointed_thing.above, "carts:cart")
else
return
end
if not minetest.settings:get_bool("creative_mode") then
itemstack:take_item()
end
return itemstack
end,
})
minetest.register_craft({
output = "carts:cart",
recipe = {
{"default:steel_ingot", "", "default:steel_ingot"},
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
},
})
end

View File

@ -1,4 +1,3 @@
default
mesecons?
moreores?
carts?
moreores?

View File

@ -1 +0,0 @@
This mod offers improved minecarts and a few more rail types.

View File

@ -1,55 +1,55 @@
local mesecons_rules = mesecon.rules.flat
function boost_cart:turnoff_detector_rail(pos)
function carts:turnoff_detector_rail(pos)
local node = minetest.get_node(pos)
if minetest.get_item_group(node.name, "detector_rail") == 1 then
if node.name == "boost_cart:detectorrail_on" then --has not been dug
minetest.swap_node(pos, {name = "boost_cart:detectorrail", param2=node.param2})
if node.name == "carts:detectorrail_on" then --has not been dug
minetest.swap_node(pos, {name = "carts:detectorrail", param2=node.param2})
end
mesecon.receptor_off(pos, mesecons_rules)
end
end
function boost_cart:signal_detector_rail(pos)
function carts:signal_detector_rail(pos)
local node = minetest.get_node(pos)
if minetest.get_item_group(node.name, "detector_rail") ~= 1 then
return
end
if node.name == "boost_cart:detectorrail" then
minetest.swap_node(pos, {name = "boost_cart:detectorrail_on", param2=node.param2})
if node.name == "carts:detectorrail" then
minetest.swap_node(pos, {name = "carts:detectorrail_on", param2=node.param2})
end
mesecon.receptor_on(pos, mesecons_rules)
minetest.after(0.5, boost_cart.turnoff_detector_rail, boost_cart, pos)
minetest.after(0.5, carts.turnoff_detector_rail, carts, pos)
end
boost_cart:register_rail("boost_cart:detectorrail", {
carts:register_rail("carts:detectorrail", {
description = "Detector rail",
tiles = {
"carts_rail_straight_dtc.png", "carts_rail_curved_dtc.png",
"carts_rail_dtc.png", "carts_rail_curved_dtc.png",
"carts_rail_t_junction_dtc.png", "carts_rail_crossing_dtc.png"
},
groups = boost_cart:get_rail_groups({detector_rail = 1}),
groups = carts:get_rail_groups({detector_rail = 1}),
mesecons = {receptor = {state = "off", rules = mesecons_rules}},
})
boost_cart:register_rail("boost_cart:detectorrail_on", {
carts:register_rail("carts:detectorrail_on", {
description = "Detector rail ON (you hacker you)",
tiles = {
"carts_rail_straight_dtc_on.png", "carts_rail_curved_dtc_on.png",
"carts_rail_dtc_on.png", "carts_rail_curved_dtc_on.png",
"carts_rail_t_junction_dtc_on.png", "carts_rail_crossing_dtc_on.png"
},
groups = boost_cart:get_rail_groups({
groups = carts:get_rail_groups({
detector_rail = 1, not_in_creative_inventory = 1
}),
drop = "boost_cart:detectorrail",
drop = "carts:detectorrail",
mesecons = {receptor = {state = "on", rules = mesecons_rules}},
})
minetest.register_craft({
output = "boost_cart:detectorrail 6",
output = "carts:detectorrail 6",
recipe = {
{"default:steel_ingot", "mesecons:wire_00000000_off", "default:steel_ingot"},
{"default:steel_ingot", "group:stick", "default:steel_ingot"},

View File

@ -1,71 +0,0 @@
boost_cart API
==============
This file provides information about the API of boost_cart for the use in
mods. The API might change slightly when the development goes on, so avoid
using internal tables or functions which are not documented here.
Types
-----
* `SwitchIgnore` -> `number/nil`
* Specifies which player control was pressed. This value is used to prefer
straight rails instead of preferring left and right rail checks.
* `1`: Ignore left rail
* `2`: Ignore right rail
* `nil`: Ignore no rail
Entity movement
---------------
These functions are grouped so that they make sense and then sorted alphabetically.
* `boost_cart:manage_attachment(player, obj)`
* Attaches or detaches the player to/from an object, depending on what is
supplied to `obj`.
* `player`: `ObjectRef` of the player
* `obj`: `ObjectRef` (to attach) or `nil` (to detach)
* `boost_cart:get_sign(n)` -> `number`
* Returns the sign for the given number. Values: `-1`, `0`, `1`
* `n`: any `number`
* `boost_cart:velocity_to_dir(vel)` -> `vector`
* Returns the cart direction depending on `vel`. Each coordinate can have
one of the `get_sign()` return values.
* `vel`: velocity as `vector`
* `boost_cart:boost_rail(pos, amount)`
* Sets the rail acceleration for the given position to `amount` and punches
carts which are at the given position.
* `pos`: `vector`, rail position
* `amount`: `number`, negative to brake, positive to boost
* `boost_cart:get_rail_direction(pos, dir, ctrl, old_switch, railtype)`
-> `vector, SwitchIgnore`
* Returns the direction to where the next rail is, and which player control that
should be ignored in the next call.
* `pos`: `vector`, position of the cart
* `dir`: `vector`, movement direction of the cart (see `velocity_to_dir()`)
* `ctrl`: Player controls table or `nil` (no player)
* `old_switch`: `SwitchIgnore`
* `railtype`: (optional) `number`, gets passed indirectly to `is_rail()`
Rail helper functions
---------------------
* `boost_cart:get_rail_groups(groups)` -> `table`
* Returns a group table with preset values for a common rail node
* `groups`: (optional) `table`, additional groups append (or overwrite)
* Hint: To register an incompatible rail type, set the group
`connect_to_raillike` to the value returned by
`minetest.raillike_group(new_rail_type)`
* `boost_cart:is_rail(pos, [railtype])` -> `boolean`
* Returns whether the node at `pos` is a rail. When `railtype` is specified,
`true` is only returned when the node is in the same rail group.
* `pos`: `vector` of the node to check
* `railtype`: (optional) `number`, rail group number
* `boost_cart:register_rail(name, def)`
* Registers a new rail with preset node definition defaults as fallback
* `name`: `string`, node name of the new rail
* `def`: Node definition table, containing at least the following keys:
* `description`
* `groups`
* `tiles`

View File

@ -1,4 +1,4 @@
function boost_cart:get_sign(z)
function carts:get_sign(z)
if z == 0 then
return 0
else
@ -6,11 +6,10 @@ function boost_cart:get_sign(z)
end
end
function boost_cart:manage_attachment(player, obj)
function carts:manage_attachment(player, status, obj)
if not player then
return
end
local status = obj ~= nil
local player_name = player:get_player_name()
if default.player_attached[player_name] == status then
return
@ -18,32 +17,24 @@ function boost_cart:manage_attachment(player, obj)
default.player_attached[player_name] = status
if status then
local y_pos = self.old_player_model and 6 or -4
if player:get_properties().visual == "upright_sprite" then
y_pos = -4
end
player:set_attach(obj, "", {x=0, y=y_pos, z=0}, {x=0, y=0, z=0})
player:set_attach(obj, "", {x=0, y=6, z=0}, {x=0, y=0, z=0})
player:set_eye_offset({x=0, y=-4, z=0},{x=0, y=-4, z=0})
else
player:set_detach()
player:set_eye_offset({x=0, y=0, z=0},{x=0, y=0, z=0})
-- HACK in effect! Force updating the attachment rotation
player:set_properties({})
end
end
function boost_cart:velocity_to_dir(v)
function carts:velocity_to_dir(v)
if math.abs(v.x) > math.abs(v.z) then
return {x=self:get_sign(v.x), y=self:get_sign(v.y), z=0}
return {x=carts:get_sign(v.x), y=carts:get_sign(v.y), z=0}
else
return {x=0, y=self:get_sign(v.y), z=self:get_sign(v.z)}
return {x=0, y=carts:get_sign(v.y), z=carts:get_sign(v.z)}
end
end
local get_node = minetest.get_node
local get_item_group = minetest.get_item_group
function boost_cart:is_rail(pos, railtype)
local node = get_node(pos).name
function carts:is_rail(pos, railtype)
local node = minetest.get_node(pos).name
if node == "ignore" then
local vm = minetest.get_voxel_manip()
local emin, emax = vm:read_from_map(pos, pos)
@ -55,43 +46,43 @@ function boost_cart:is_rail(pos, railtype)
local vi = area:indexp(pos)
node = minetest.get_name_from_content_id(data[vi])
end
if get_item_group(node, "rail") == 0 then
if minetest.get_item_group(node, "rail") == 0 then
return false
end
if not railtype then
return true
end
return get_item_group(node, "connect_to_raillike") == railtype
return minetest.get_item_group(node, "connect_to_raillike") == railtype
end
function boost_cart:check_front_up_down(pos, dir_, check_up, railtype)
function carts:check_front_up_down(pos, dir_, check_up, railtype)
local dir = vector.new(dir_)
local cur = nil
-- Front
dir.y = 0
cur = vector.add(pos, dir)
if self:is_rail(cur, railtype) then
if carts:is_rail(cur, railtype) then
return dir
end
-- Up
if check_up then
dir.y = 1
cur = vector.add(pos, dir)
if self:is_rail(cur, railtype) then
if carts:is_rail(cur, railtype) then
return dir
end
end
-- Down
dir.y = -1
cur = vector.add(pos, dir)
if self:is_rail(cur, railtype) then
if carts:is_rail(cur, railtype) then
return dir
end
return nil
end
function boost_cart:get_rail_direction(pos_, dir, ctrl, old_switch, railtype)
function carts:get_rail_direction(pos_, dir, ctrl, old_switch, railtype)
local pos = vector.round(pos_)
local cur = nil
local left_check, right_check = true, true
@ -107,16 +98,6 @@ function boost_cart:get_rail_direction(pos_, dir, ctrl, old_switch, railtype)
right.z = -dir.x
end
local straight_priority = ctrl and dir.y ~= 0
-- Normal, to disallow rail switching up- & downhill
if straight_priority then
cur = self:check_front_up_down(pos, dir, true, railtype)
if cur then
return cur
end
end
if ctrl then
if old_switch == 1 then
left_check = false
@ -124,14 +105,14 @@ function boost_cart:get_rail_direction(pos_, dir, ctrl, old_switch, railtype)
right_check = false
end
if ctrl.left and left_check then
cur = self:check_front_up_down(pos, left, false, railtype)
cur = carts:check_front_up_down(pos, left, false, railtype)
if cur then
return cur, 1
end
left_check = false
end
if ctrl.right and right_check then
cur = self:check_front_up_down(pos, right, false, railtype)
cur = carts:check_front_up_down(pos, right, false, railtype)
if cur then
return cur, 2
end
@ -140,16 +121,14 @@ function boost_cart:get_rail_direction(pos_, dir, ctrl, old_switch, railtype)
end
-- Normal
if not straight_priority then
cur = self:check_front_up_down(pos, dir, true, railtype)
if cur then
return cur
end
cur = carts:check_front_up_down(pos, dir, true, railtype)
if cur then
return cur
end
-- Left, if not already checked
if left_check then
cur = self:check_front_up_down(pos, left, false, railtype)
cur = carts:check_front_up_down(pos, left, false, railtype)
if cur then
return cur
end
@ -157,7 +136,7 @@ function boost_cart:get_rail_direction(pos_, dir, ctrl, old_switch, railtype)
-- Right, if not already checked
if right_check then
cur = self:check_front_up_down(pos, right, false, railtype)
cur = carts:check_front_up_down(pos, right, false, railtype)
if cur then
return cur
end
@ -165,7 +144,7 @@ function boost_cart:get_rail_direction(pos_, dir, ctrl, old_switch, railtype)
-- Backwards
if not old_switch then
cur = self:check_front_up_down(pos, {
cur = carts:check_front_up_down(pos, {
x = -dir.x,
y = dir.y,
z = -dir.z
@ -178,40 +157,30 @@ function boost_cart:get_rail_direction(pos_, dir, ctrl, old_switch, railtype)
return {x=0, y=0, z=0}
end
function boost_cart:pathfinder(pos_, old_pos, old_dir, distance, ctrl,
pf_switch, railtype)
function carts:pathfinder(pos_, expected_pos, old_dir, ctrl, pf_switch, railtype)
local pos = vector.round(pos_)
if vector.equals(old_pos, pos) then
return
end
local pf_pos = vector.round(old_pos)
local pf_pos = vector.round(expected_pos)
local pf_dir = vector.new(old_dir)
distance = math.min(boost_cart.path_distance_max,
math.floor(distance + 1))
for i = 1, distance do
pf_dir, pf_switch = self:get_rail_direction(
pf_pos, pf_dir, ctrl, pf_switch or 0, railtype)
for i = 1, 3 do
if vector.equals(pf_pos, pos) then
-- Success! Cart moved on correctly
return true
end
pf_dir, pf_switch = carts:get_rail_direction(pf_pos, pf_dir, ctrl, pf_switch, railtype)
if vector.equals(pf_dir, {x=0, y=0, z=0}) then
-- No way forwards
return pf_pos, pf_dir
return false
end
pf_pos = vector.add(pf_pos, pf_dir)
if vector.equals(pf_pos, pos) then
-- Success! Cart moved on correctly
return
end
end
-- Not found. Put cart to predicted position
return pf_pos, pf_dir
-- Cart not found
return false
end
function boost_cart:boost_rail(pos, amount)
function carts:boost_rail(pos, amount)
minetest.get_meta(pos):set_string("cart_acceleration", tostring(amount))
for _,obj_ in ipairs(minetest.get_objects_inside_radius(pos, 0.5)) do
if not obj_:is_player() and
@ -222,23 +191,19 @@ function boost_cart:boost_rail(pos, amount)
end
end
function boost_cart:register_rail(name, def_overwrite)
local sound_func = default.node_sound_metal_defaults
or default.node_sound_defaults
local def = {
function carts:register_rail(name, def)
local def_default = {
drawtype = "raillike",
paramtype = "light",
sunlight_propagates = true,
is_ground_content = false,
is_ground_content = true,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
},
sounds = sound_func()
}
}
for k, v in pairs(def_overwrite) do
for k, v in pairs(def_default) do
def[k] = v
end
if not def.inventory_image then
@ -249,17 +214,9 @@ function boost_cart:register_rail(name, def_overwrite)
minetest.register_node(name, def)
end
function boost_cart:get_rail_groups(additional_groups)
function carts:get_rail_groups(additional_groups)
-- Get the default rail groups and add more when a table is given
local groups = {
dig_immediate = 2,
attached_node = 1,
rail = 1,
connect_to_raillike = 1
}
if minetest.raillike_group then
groups.connect_to_raillike = minetest.raillike_group("rail")
end
local groups = {dig_immediate = 2, attached_node = 1, rail = 1, connect_to_raillike = 1}
if type(additional_groups) == "table" then
for k, v in pairs(additional_groups) do
groups[k] = v

426
init.lua
View File

@ -1,46 +1,410 @@
boost_cart = {}
boost_cart.modpath = minetest.get_modpath("boost_cart")
if not minetest.settings then
error("[boost_cart] Your Minetest version is no longer supported."
.. " (Version <= 0.4.15)")
end
local function getNum(setting)
return tonumber(minetest.settings:get(setting))
end
carts = {}
carts.modpath = minetest.get_modpath("carts")
-- Maximal speed of the cart in m/s
boost_cart.speed_max = getNum("boost_cart.speed_max") or 10
-- Set to -1 to disable punching the cart from inside
boost_cart.punch_speed_max = getNum("boost_cart.punch_speed_max") or 7
-- Maximal distance for the path correction (for dtime peaks)
boost_cart.path_distance_max = 3
carts.speed_max = minetest.setting_get("movement_speed_walk")*3*0.9
-- Minimal speed of the cart on brake rail
carts.brake_speed_min = minetest.setting_get("movement_speed_walk")/2
-- Set to nil to disable punching the cart from inside (min = -1)
carts.punch_speed_min = 7
-- 1 disable mesecons / 0 enable mesecons
carts.mesecon_disabled = 1
if not carts.modpath then
error("\nWrong mod directory name! Please change it to 'carts'.\n" ..
"See also: http://dev.minetest.net/Installing_Mods")
end
function vector.floor(v)
return {
x = math.floor(v.x),
y = math.floor(v.y),
z = math.floor(v.z)
}
end
dofile(carts.modpath.."/functions.lua")
dofile(carts.modpath.."/rails.lua")
if not carts.mesecon_disabled and mesecon then
dofile(carts.modpath.."/detector.lua")
end
-- Support for non-default games
if not default.player_attached then
default.player_attached = {}
end
minetest.after(0, function()
boost_cart.old_player_model = not minetest.global_exists("player_api")
end)
carts.cart = {
physical = false,
collisionbox = {-0.5, -0.5, -0.5, 0.5, 0.5, 0.5},
visual = "mesh",
mesh = "cart.x",
visual_size = {x=1, y=1},
textures = {"cart.png"},
dofile(boost_cart.modpath.."/functions.lua")
dofile(boost_cart.modpath.."/rails.lua")
driver = nil,
punched = false, -- used to re-send velocity and position
velocity = {x=0, y=0, z=0}, -- only used on punch
old_dir = {x=1, y=0, z=0}, -- random value to start the cart on punch
old_pos = nil,
old_switch = 0,
railtype = nil,
attached_items = {}
}
if minetest.global_exists("mesecon") then
dofile(boost_cart.modpath.."/detector.lua")
--else
-- minetest.register_alias("carts:powerrail", "boost_cart:detectorrail")
-- minetest.register_alias("carts:powerrail", "boost_cart:detectorrail_on")
function carts.cart:on_rightclick(clicker)
if not clicker or not clicker:is_player() then
return
end
local player_name = clicker:get_player_name()
if self.driver and player_name == self.driver then
self.driver = nil
carts:manage_attachment(clicker, false)
self.object:setacceleration({x=0, y=0, z=0}) -- Stops the cart when we leave it
self.object:setvelocity({x=0, y=0, z=0})
elseif not self.driver then
self.driver = player_name
carts:manage_attachment(clicker, true, self.object)
end
end
boost_cart.mtg_compat = minetest.global_exists("carts") and carts.pathfinder
if boost_cart.mtg_compat then
minetest.log("action", "[boost_cart] Overwriting definitions of similar carts mod")
function carts.cart:on_activate(staticdata, dtime_s)
self.object:set_armor_groups({immortal=1})
if string.sub(staticdata, 1, string.len("return")) ~= "return" then
return
end
local data = minetest.deserialize(staticdata)
if not data or type(data) ~= "table" then
return
end
self.railtype = data.railtype
if data.old_dir then
self.old_dir = data.old_dir
end
end
dofile(boost_cart.modpath.."/cart_entity.lua")
function carts.cart:get_staticdata()
return minetest.serialize({
railtype = self.railtype,
old_dir = self.old_dir
})
end
function carts.cart:on_punch(puncher, time_from_last_punch, tool_capabilities, direction)
local pos = self.object:getpos()
if not self.railtype then
local bar = vector.floor(vector.add(pos, 0.1))
local node = minetest.get_node(bar).name
self.railtype = minetest.get_item_group(node, "connect_to_raillike")
end
if not puncher or not puncher:is_player() then
local cart_dir = carts:get_rail_direction(pos, self.old_dir, nil, nil, self.railtype)
if vector.equals(cart_dir, {x=0, y=0, z=0}) then
return
end
self.velocity = vector.multiply(cart_dir, 3)
self.old_pos = nil
self.punched = true
return
end
if puncher:get_player_control().sneak then
-- Pick up cart: Drop all attachments
if self.driver then
if self.old_pos then
self.object:setpos(self.old_pos)
end
local player = minetest.get_player_by_name(self.driver)
carts:manage_attachment(player, false)
end
for _,obj_ in ipairs(self.attached_items) do
if obj_ then
obj_:set_detach()
end
end
local leftover = puncher:get_inventory():add_item("main", "carts:cart")
if not leftover:is_empty() then
minetest.add_item(self.object:getpos(), leftover)
end
self.object:remove()
return
end
local vel = self.object:getvelocity()
if puncher:get_player_name() == self.driver then
if math.abs(vel.x + vel.z) > carts.punch_speed_min then
return
end
--end --Only the driver can punch
local punch_dir = carts:velocity_to_dir(puncher:get_look_dir())
punch_dir.y = 0
local cart_dir = carts:get_rail_direction(pos, punch_dir, nil, nil, self.railtype)
if vector.equals(cart_dir, {x=0, y=0, z=0}) then
return
end
local punch_interval = 1
if tool_capabilities and tool_capabilities.full_punch_interval then
punch_interval = tool_capabilities.full_punch_interval
end
time_from_last_punch = math.min(time_from_last_punch or punch_interval, punch_interval)
local f = 3 * (time_from_last_punch / punch_interval)
self.velocity = vector.multiply(cart_dir, f)
self.old_dir = cart_dir
self.old_pos = nil
self.punched = true
end
end
function carts.cart:on_step(dtime)
local vel = self.object:getvelocity()
local update = {}
if self.punched then
vel = vector.add(vel, self.velocity)
self.object:setvelocity(vel)
self.old_dir.y = 0
elseif vector.equals(vel, {x=0, y=0, z=0}) then
return
end
-- dir: New moving direction of the cart
-- last_switch: Currently pressed L/R key, used to ignore the key on the next rail node
local dir, last_switch
local pos = self.object:getpos()
local is_slow = ((vel.x ~= 0 and math.abs(vel.x) <= carts.brake_speed_min) or
(vel.y ~= 0 and math.abs(vel.y) <= carts.brake_speed_min) or
(vel.z ~= 0 and math.abs(vel.z) <= carts.brake_speed_min)) and
string.match(minetest.get_node(pos).name, "brake")
if self.old_pos and not self.punched then
local flo_pos = vector.round(pos)
local flo_old = vector.round(self.old_pos)
if vector.equals(flo_pos, flo_old) and not is_slow then -- Do not check one node multiple times (but check if low speed)
return
end
end
local ctrl, player
-- Get player controls
if self.driver then
player = minetest.get_player_by_name(self.driver)
if player then
ctrl = player:get_player_control()
end
end
if self.old_pos then
-- Detection for "skipping" nodes
local expected_pos = vector.add(self.old_pos, self.old_dir)
local found_path = carts:pathfinder(
pos, expected_pos, self.old_dir, ctrl, self.old_switch, self.railtype
)
if not found_path and not is_slow then
-- No rail found: reset back to the expected position
pos = expected_pos
update.pos = true
end
end
local cart_dir = carts:velocity_to_dir(vel)
local max_vel = carts.speed_max
if not dir then
dir, last_switch = carts:get_rail_direction(
pos, cart_dir, ctrl, self.old_switch, self.railtype
)
end
local new_acc = {x=0, y=0, z=0}
local speed_mod = 0
if vector.equals(dir, {x=0, y=0, z=0}) then
vel = {x=0, y=0, z=0}
pos = vector.round(pos)
update.pos = true
update.vel = true
else
-- If the direction changed
if dir.x ~= 0 and self.old_dir.z ~= 0 then
vel.x = dir.x * math.abs(vel.z)
vel.z = 0
pos.z = math.floor(pos.z + 0.5)
update.pos = true
end
if dir.z ~= 0 and self.old_dir.x ~= 0 then
vel.z = dir.z * math.abs(vel.x)
vel.x = 0
pos.x = math.floor(pos.x + 0.5)
update.pos = true
end
-- Up, down?
if dir.y ~= self.old_dir.y then
vel.y = dir.y * math.abs(vel.x + vel.z)
pos = vector.round(pos)
update.pos = true
end
-- Slow down or speed up in slopes..
local acc = dir.y * -1.8
-- MFF : Some rails have bad acceleration property, reinit them !
-- this code would be commented when all rails will be corrected
local rail = minetest.get_node(pos)
if string.match(rail.name, "power")
then minetest.get_meta(pos):set_string("cart_acceleration", "1")
elseif string.match(rail.name, "brake") then minetest.get_meta(pos):set_string("cart_acceleration", "-1")
else minetest.get_meta(pos):set_string("cart_acceleration", "0")
end
-- Change acceleration by rail (power/brake)
local speed_mod_string = minetest.get_meta(pos):get_string("cart_acceleration")
if speed_mod_string and speed_mod_string ~= ""
then speed_mod = tonumber(speed_mod_string)
else speed_mod = 0
end
if speed_mod > 0 then speed_mod = 2
elseif speed_mod < 0 then speed_mod = -2
else speed_mod = 0
end
--[[if speed_mod_string == "halt" then --stop rail, not used in MFF
vel = {x=0, y=0, z=0}
acc = 0
pos = vector.round(pos)
update.pos = true
update.vel = true
else--]]if speed_mod and speed_mod ~= 0 then
acc = acc + (speed_mod * 10)
else
--acc = acc - 0.4 --No friction (to be set as an option)
-- Handbrake
if ctrl and ctrl.down then
acc = acc - 1.2
end
end
if self.old_dir.y == 0 and not self.punched then
-- Stop the cart swing between two rail parts (handbrake)
if vector.equals(vector.multiply(self.old_dir, -1), dir) then
vel = {x=0, y=0, z=0}
acc = 0
if self.old_pos then
pos = vector.new(self.old_pos)
update.pos = true
end
dir = vector.new(self.old_dir)
update.vel = true
end
end
new_acc = vector.multiply(dir, acc)
end
if not carts.mesecon_disabled and mesecon then
carts:signal_detector_rail(vector.round(pos))
end
-- Limits
for _,v in ipairs({"x","y","z"}) do
if speed_mod > 0 and math.abs(vel[v]) > max_vel then
vel[v] = carts:get_sign(vel[v]) * max_vel
new_acc[v] = 0
update.vel = true
elseif speed_mod < 0 and vel[v] ~= 0 and math.abs(vel[v]) <= carts.brake_speed_min then
vel[v] = carts:get_sign(vel[v]) * carts.brake_speed_min
new_acc[v] = 0
update.vel = true
end
end
self.object:setacceleration(new_acc)
self.old_pos = vector.new(pos)
if not vector.equals(dir, {x=0, y=0, z=0}) then
self.old_dir = vector.new(dir)
end
self.old_switch = last_switch
if self.punched then
-- Collect dropped items
for _,obj_ in ipairs(minetest.get_objects_inside_radius(pos, 1)) do
if not obj_:is_player() and
obj_:get_luaentity() and
not obj_:get_luaentity().physical_state and
obj_:get_luaentity().name == "__builtin:item" then
obj_:set_attach(self.object, "", {x=0, y=0, z=0}, {x=0, y=0, z=0})
self.attached_items[#self.attached_items + 1] = obj_
end
end
self.punched = false
update.vel = true -- update player animation
end
if not (update.vel or update.pos) then
return
end
local yaw = 0
if self.old_dir.x < 0 then
yaw = 0.5
elseif self.old_dir.x > 0 then
yaw = 1.5
elseif self.old_dir.z < 0 then
yaw = 1
end
self.object:setyaw(yaw * math.pi)
local anim = {x=0, y=0}
if dir.y == -1 then
anim = {x=1, y=1}
elseif dir.y == 1 then
anim = {x=2, y=2}
end
self.object:set_animation(anim, 1, 0)
self.object:setvelocity(vel)
if update.pos then
self.object:setpos(pos)
end
update = nil
end
minetest.register_entity(":carts:cart", carts.cart)
minetest.register_craftitem(":carts:cart", {
description = "Cart (Sneak+Click to pick up)",
inventory_image = minetest.inventorycube("cart_top.png", "cart_side.png", "cart_side.png"),
wield_image = "cart_side.png",
on_place = function(itemstack, placer, pointed_thing)
if not pointed_thing.type == "node" then
return
end
if carts:is_rail(pointed_thing.under) then
minetest.add_entity(pointed_thing.under, "carts:cart")
elseif carts:is_rail(pointed_thing.above) then
minetest.add_entity(pointed_thing.above, "carts:cart")
else return end
itemstack:take_item()
return itemstack
end,
})
minetest.register_craft({
output = "carts:cart",
recipe = {
{"default:steel_ingot", "", "default:steel_ingot"},
{"default:steel_ingot", "default:steel_ingot", "default:steel_ingot"},
},
})

View File

@ -1 +0,0 @@
name = boost_cart

132
rails.lua
View File

@ -1,70 +1,73 @@
-- Common rail registrations
local regular_rail_itemname = "default:rail"
if minetest.registered_nodes["carts:rail"] then
-- MTG Compatibility
regular_rail_itemname = "carts:rail"
end
boost_cart:register_rail(":"..regular_rail_itemname, {
minetest.register_node(":default:rail", {
description = "Rail",
drawtype = "raillike",
tiles = {
"carts_rail_straight.png", "carts_rail_curved.png",
"carts_rail_t_junction.png", "carts_rail_crossing.png"
"default_rail.png", "default_rail_curved.png",
"default_rail_t_junction.png", "default_rail_crossing.png"
},
groups = boost_cart:get_rail_groups()
inventory_image = "default_rail.png",
wield_image = "default_rail.png",
paramtype = "light",
sunlight_propagates = true,
is_ground_content = true,
walkable = false,
selection_box = {
type = "fixed",
fixed = {-1/2, -1/2, -1/2, 1/2, -1/2+1/16, 1/2},
},
groups = carts:get_rail_groups(),
})
-- Moreores' copper rail
if minetest.get_modpath("moreores") then
minetest.register_alias("carts:copperrail", "moreores:copper_rail")
if minetest.raillike_group then
-- Ensure that this rail uses the same connect_to_raillike
local new_groups = minetest.registered_nodes["moreores:copper_rail"].groups
new_groups.connect_to_raillike = minetest.raillike_group("rail")
minetest.override_item("moreores:copper_rail", {
groups = new_groups
})
end
-- Copper rail
if minetest.get_modpath("moreores") then
-- Moreores' copper rail
minetest.register_alias("carts:rail_copper", "moreores:copper_rail")
else
boost_cart:register_rail(":carts:copperrail", {
carts:register_rail(":carts:rail_copper", {
description = "Copper rail",
tiles = {
"carts_rail_straight_cp.png", "carts_rail_curved_cp.png",
"carts_rail_cp.png", "carts_rail_curved_cp.png",
"carts_rail_t_junction_cp.png", "carts_rail_crossing_cp.png"
},
groups = boost_cart:get_rail_groups()
groups = carts:get_rail_groups(),
})
minetest.register_craft({
output = "carts:copperrail 12",
output = "carts:rail_copper 16",
recipe = {
{"default:copper_ingot", "", "default:copper_ingot"},
{"default:copper_ingot", "group:stick", "default:copper_ingot"},
{"default:copper_ingot", "", "default:copper_ingot"},
{"default:copper_ingot", "group:stick", "default:copper_ingot"},
{"default:copper_ingot", "group:stick", "default:copper_ingot"},
}
})
end
-- Power rail
boost_cart:register_rail(":carts:powerrail", {
-- Speed up
-- Rail Power
carts:register_rail(":carts:rail_power", {
description = "Powered rail",
tiles = {
"carts_rail_straight_pwr.png", "carts_rail_curved_pwr.png",
"carts_rail_pwr.png", "carts_rail_curved_pwr.png",
"carts_rail_t_junction_pwr.png", "carts_rail_crossing_pwr.png"
},
groups = boost_cart:get_rail_groups(),
groups = carts:get_rail_groups(),
after_place_node = function(pos, placer, itemstack)
if not mesecon then
minetest.get_meta(pos):set_string("cart_acceleration", "0.5")
minetest.get_meta(pos):set_string("cart_acceleration", "1")
end
end,
mesecons = {
effector = {
action_on = function(pos, node)
boost_cart:boost_rail(pos, 0.5)
carts:boost_rail(pos, 1)
end,
action_off = function(pos, node)
minetest.get_meta(pos):set_string("cart_acceleration", "0")
end,
@ -73,32 +76,34 @@ boost_cart:register_rail(":carts:powerrail", {
})
minetest.register_craft({
output = "carts:powerrail 6",
recipe = {
{"default:steel_ingot", "default:mese_crystal_fragment", "default:steel_ingot"},
{"default:steel_ingot", "group:stick", "default:steel_ingot"},
{"default:steel_ingot", "default:mese_crystal_fragment", "default:steel_ingot"},
}
type = "shapeless",
output = "carts:rail_power",
recipe = {"group:rail", "default:mese_crystal_fragment"},
})
-- Brake rail
boost_cart:register_rail(":carts:brakerail", {
-- Rail Brake
carts:register_rail(":carts:rail_brake", {
description = "Brake rail",
tiles = {
"carts_rail_straight_brk.png", "carts_rail_curved_brk.png",
"carts_rail_brk.png", "carts_rail_curved_brk.png",
"carts_rail_t_junction_brk.png", "carts_rail_crossing_brk.png"
},
groups = boost_cart:get_rail_groups(),
groups = carts:get_rail_groups(),
after_place_node = function(pos, placer, itemstack)
if not mesecon then
minetest.get_meta(pos):set_string("cart_acceleration", "-0.3")
minetest.get_meta(pos):set_string("cart_acceleration", "-1")
end
end,
mesecons = {
effector = {
action_on = function(pos, node)
minetest.get_meta(pos):set_string("cart_acceleration", "-0.3")
minetest.get_meta(pos):set_string("cart_acceleration", "-1")
end,
action_off = function(pos, node)
minetest.get_meta(pos):set_string("cart_acceleration", "0")
end,
@ -107,31 +112,33 @@ boost_cart:register_rail(":carts:brakerail", {
})
minetest.register_craft({
output = "carts:brakerail 6",
recipe = {
{"default:steel_ingot", "default:coal_lump", "default:steel_ingot"},
{"default:steel_ingot", "group:stick", "default:steel_ingot"},
{"default:steel_ingot", "default:coal_lump", "default:steel_ingot"},
}
type = "shapeless",
output = "carts:rail_brake",
recipe = {"group:rail", "default:coal_lump"},
})
boost_cart:register_rail("boost_cart:startstoprail", {
-- Start stop rail (temporary removed for mff)
--[[carts:register_rail("carts:startstoprail", {
description = "Start-stop rail",
tiles = {
"carts_rail_straight_ss.png", "carts_rail_curved_ss.png",
"carts_rail_ss.png", "carts_rail_curved_ss.png",
"carts_rail_t_junction_ss.png", "carts_rail_crossing_ss.png"
},
groups = boost_cart:get_rail_groups(),
groups = carts:get_rail_groups(),
after_place_node = function(pos, placer, itemstack)
if not mesecon then
minetest.get_meta(pos):set_string("cart_acceleration", "halt")
end
end,
mesecons = {
effector = {
action_on = function(pos, node)
boost_cart:boost_rail(pos, 0.5)
carts:boost_rail(pos, 0.5)
end,
action_off = function(pos, node)
minetest.get_meta(pos):set_string("cart_acceleration", "halt")
end,
@ -141,6 +148,13 @@ boost_cart:register_rail("boost_cart:startstoprail", {
minetest.register_craft({
type = "shapeless",
output = "boost_cart:startstoprail 2",
output = "carts:startstoprail 2",
recipe = {"carts:powerrail", "carts:brakerail"},
})
})--]]
--Alias
minetest.register_alias("carts:powerrail", "carts:rail_power")
minetest.register_alias("carts:power_rail", "carts:rail_power")
minetest.register_alias("carts:brakerail", "carts:rail_brake")
minetest.register_alias("carts:brake_rail", "carts:rail_brake")

Binary file not shown.

Before

Width:  |  Height:  |  Size: 154 KiB

View File

@ -1,6 +0,0 @@
# Maximal speed of the cart in m/s (min=1, max=100)
boost_cart.speed_max (Maximal speed) int 10 1 100
# Maximal speed to which the driving player can accelerate the cart by punching
# from inside the cart. -1 will disable this feature. (min=-1, max=100)
boost_cart.punch_speed_max (Maximal punch speed) int 7 -1 100

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
textures/carts_rail_brk.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 577 B

BIN
textures/carts_rail_cp.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 522 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 755 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 765 B

After

Width:  |  Height:  |  Size: 549 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 735 B

After

Width:  |  Height:  |  Size: 495 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 823 B

After

Width:  |  Height:  |  Size: 621 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 823 B

After

Width:  |  Height:  |  Size: 654 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 847 B

After

Width:  |  Height:  |  Size: 458 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 813 B

After

Width:  |  Height:  |  Size: 463 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 750 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 738 B

After

Width:  |  Height:  |  Size: 537 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 691 B

After

Width:  |  Height:  |  Size: 488 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 780 B

After

Width:  |  Height:  |  Size: 578 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 780 B

After

Width:  |  Height:  |  Size: 575 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 798 B

After

Width:  |  Height:  |  Size: 443 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 832 B

After

Width:  |  Height:  |  Size: 450 B

BIN
textures/carts_rail_dtc.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 542 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 559 B

BIN
textures/carts_rail_pwr.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 498 B

BIN
textures/carts_rail_ss.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 514 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 785 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 789 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 728 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 830 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 830 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 836 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 843 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 789 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 714 B

After

Width:  |  Height:  |  Size: 538 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 715 B

After

Width:  |  Height:  |  Size: 496 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 752 B

After

Width:  |  Height:  |  Size: 607 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 808 B

After

Width:  |  Height:  |  Size: 621 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 761 B

After

Width:  |  Height:  |  Size: 539 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 813 B

After

Width:  |  Height:  |  Size: 439 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 476 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 368 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 400 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 248 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 323 B