update
This commit is contained in:
parent
f95799f554
commit
becb199737
8 changed files with 79 additions and 25 deletions
|
@ -230,6 +230,32 @@ local matchptn={
|
|||
train.door_open = tt[match]*arr
|
||||
return 2
|
||||
end,
|
||||
["K"] = function(id, train)
|
||||
if train.door_open == 0 then
|
||||
atwarn(sid(id), attrans("ATC Kick command warning: Doors closed"))
|
||||
return 1
|
||||
end
|
||||
if train.velocity > 0 then
|
||||
atwarn(sid(id), attrans("ATC Kick command warning: Train moving"))
|
||||
return 1
|
||||
end
|
||||
local tp = train.trainparts
|
||||
for i=1,#tp do
|
||||
local data = advtrains.wagons[tp[i]]
|
||||
local obj = advtrains.wagon_objects[tp[i]]
|
||||
if data and obj then
|
||||
local ent = obj:get_luaentity()
|
||||
if ent then
|
||||
for seatno,seat in pairs(ent.seats) do
|
||||
if data.seatp[seatno] and not ent:is_driver_stand(seat) then
|
||||
ent:get_off(seatno)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
return 1
|
||||
end,
|
||||
}
|
||||
|
||||
eval_conditional = function(command, arrow, speed)
|
||||
|
|
|
@ -252,7 +252,7 @@ function advtrains.hud_train_format(train, flip)
|
|||
ht[#ht+1] = sformat("%d,100=(advtrains_hud_bg.png^[resize\\:11x30^[colorize\\:white)", i*14-3)
|
||||
end
|
||||
for i = max+1, 20, 1 do
|
||||
ht[#ht+1] = sformat("%d,100=(advtrains_hud_bg.png^[resize\\:11x30^[colorize\\:lightgray)", i*14-3)
|
||||
ht[#ht+1] = sformat("%d,100=(advtrains_hud_bg.png^[resize\\:11x30^[colorize\\:darkslategray)", i*14-3)
|
||||
end
|
||||
if res and res > 0 then
|
||||
ht[#ht+1] = sformat("%d,95=(advtrains_hud_bg.png^[resize\\:3x40^[colorize\\:red\\:255)", 8+res*14)
|
||||
|
@ -289,7 +289,7 @@ function advtrains.hud_train_format(train, flip)
|
|||
end
|
||||
|
||||
local _, texture = advtrains.hud_train_format { -- dummy train object to demonstrate the train hud
|
||||
max_speed = 15, speed_restriction = 12, velocity = 12, tarvelocity = 15,
|
||||
max_speed = 15, speed_restriction = 15, velocity = 15, tarvelocity = 12,
|
||||
active_control = true, lever = 3, ctrl = {lzb = true}, is_shunt = true,
|
||||
door_open = 1, lzb = {oncoming = {{spd=6}}}
|
||||
}
|
||||
|
|
|
@ -269,6 +269,15 @@ function wagon:destroy()
|
|||
return true
|
||||
end
|
||||
|
||||
function wagon:is_driver_stand(seat)
|
||||
if self.seat_groups then
|
||||
return (seat.driving_ctrl_access or self.seat_groups[seat.group].driving_ctrl_access)
|
||||
else
|
||||
return seat.driving_ctrl_access
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
function wagon:on_step(dtime)
|
||||
return advtrains.pcall(function()
|
||||
if not self:ensure_init() then return end
|
||||
|
@ -301,11 +310,7 @@ function wagon:on_step(dtime)
|
|||
local pname=data.seatp[seatno]
|
||||
local driver=pname and minetest.get_player_by_name(pname)
|
||||
local has_driverstand = pname and advtrains.check_driving_couple_protection(pname, data.owner, data.whitelist)
|
||||
if self.seat_groups then
|
||||
has_driverstand = has_driverstand and (seat.driving_ctrl_access or self.seat_groups[seat.group].driving_ctrl_access)
|
||||
else
|
||||
has_driverstand = has_driverstand and (seat.driving_ctrl_access)
|
||||
end
|
||||
has_driverstand = has_driverstand and self:is_driver_stand(seat)
|
||||
if has_driverstand and driver then
|
||||
advtrains.update_driver_hud(driver:get_player_name(), self:train(), data.wagon_flipped)
|
||||
elseif driver then
|
||||
|
|
|
@ -52,12 +52,12 @@ local function show_stoprailform(pos, player)
|
|||
local form = "size[8,7]"
|
||||
form = form.."field[0.5,0.5;7,1;stn;"..attrans("Station Code")..";"..minetest.formspec_escape(stdata.stn).."]"
|
||||
form = form.."field[0.5,1.5;7,1;stnname;"..attrans("Station Name")..";"..minetest.formspec_escape(stnname).."]"
|
||||
form = form.."field[0.5,2.5;2,1;ddelay;"..attrans("Door Delay")..";"..minetest.formspec_escape(stdata.ddelay).."]"
|
||||
form = form.."field[3,2.5;3,1;speed;"..attrans("Departure Speed")..";"..minetest.formspec_escape(stdata.speed).."]"
|
||||
form = form.."field[0.5,2.5;1.5,1;ddelay;"..attrans("Door Delay")..";"..minetest.formspec_escape(stdata.ddelay).."]"
|
||||
form = form.."field[2,2.5;2,1;speed;"..attrans("Departure Speed")..";"..minetest.formspec_escape(stdata.speed).."]"
|
||||
form = form.."checkbox[5,1.75;reverse;"..attrans("Reverse train")..";"..(stdata.reverse and "true" or "false").."]"
|
||||
form = form.."checkbox[5,2.0;kick;"..attrans("Kick out passengers")..";"..(stdata.kick and "true" or "false").."]"
|
||||
form = form.."label[0.5,3;Door side:]"
|
||||
form = form.."dropdown[0.5,3;2;doors;Left,Right,Closed;"..door_dropdown[stdata.doors].."]"
|
||||
form = form.."dropdown[3,3;1.5;reverse;---,Reverse;"..(stdata.reverse and 2 or 1).."]"
|
||||
|
||||
form = form.."dropdown[0.5,3;2;doors;Left,Right,Closed;"..door_dropdown[stdata.doors].."]"
|
||||
form = form.."field[5,3.5;2,1;track;"..attrans("Track")..";"..minetest.formspec_escape(stdata.track).."]"
|
||||
form = form.."field[5,4.5;2,1;wait;"..attrans("Stop Time")..";"..stdata.wait.."]"
|
||||
|
||||
|
@ -67,7 +67,7 @@ local function show_stoprailform(pos, player)
|
|||
|
||||
minetest.show_formspec(pname, "at_lines_stop_"..pe, form)
|
||||
end
|
||||
|
||||
local tmp_checkboxes = {}
|
||||
minetest.register_on_player_receive_fields(function(player, formname, fields)
|
||||
local pname = player:get_player_name()
|
||||
local pe = string.match(formname, "^at_lines_stop_(............)$")
|
||||
|
@ -79,6 +79,15 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
end
|
||||
|
||||
local stdata = advtrains.lines.stops[pe]
|
||||
if not tmp_checkboxes[pe] then
|
||||
tmp_checkboxes[pe] = {}
|
||||
end
|
||||
if fields.kick then -- handle checkboxes due to MT's weird handling
|
||||
tmp_checkboxes[pe].kick = (fields.kick == "true")
|
||||
end
|
||||
if fields.reverse then
|
||||
tmp_checkboxes[pe].reverse = (fields.reverse == "true")
|
||||
end
|
||||
if fields.save then
|
||||
if fields.stn and stdata.stn ~= fields.stn then
|
||||
if fields.stn ~= "" then
|
||||
|
@ -111,10 +120,6 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
if fields.doors then
|
||||
stdata.doors = door_dropdown_rev[fields.doors] or "C"
|
||||
end
|
||||
if fields.reverse then
|
||||
stdata.reverse = fields.reverse == "Reverse"
|
||||
end
|
||||
|
||||
|
||||
if fields.track then
|
||||
stdata.track = fields.track
|
||||
|
@ -133,7 +138,11 @@ minetest.register_on_player_receive_fields(function(player, formname, fields)
|
|||
if fields.speed then
|
||||
stdata.speed = to_int(fields.speed) or "M"
|
||||
end
|
||||
|
||||
|
||||
for k,v in pairs(tmp_checkboxes[pe]) do --handle checkboxes
|
||||
stdata[k] = v or nil
|
||||
end
|
||||
tmp_checkboxes[pe] = nil
|
||||
--TODO: signal
|
||||
updatemeta(pos)
|
||||
show_stoprailform(pos, player)
|
||||
|
@ -192,7 +201,7 @@ local adefunc = function(def, preset, suffix, rotation)
|
|||
local stnname = stn and stn.name or "Unknown Station"
|
||||
|
||||
-- Send ATC command and set text
|
||||
advtrains.atc.train_set_command(train, "B0 W O"..stdata.doors.." D"..stdata.wait.." OC "..(stdata.reverse and "R" or "").."D"..(stdata.ddelay or 1) .. "S" ..(stdata.speed or "M"), true)
|
||||
advtrains.atc.train_set_command(train, "B0 W O"..stdata.doors..(stdata.kick and "K" or "").." D"..stdata.wait.." OC "..(stdata.reverse and "R" or "").."D"..(stdata.ddelay or 1) .. "S" ..(stdata.speed or "M"), true)
|
||||
train.text_inside = stnname
|
||||
if tonumber(stdata.wait) then
|
||||
minetest.after(tonumber(stdata.wait), function() train.text_inside = "" end)
|
||||
|
@ -215,4 +224,4 @@ if minetest.get_modpath("advtrains_train_track") ~= nil then
|
|||
formats={},
|
||||
get_additional_definiton = adefunc,
|
||||
}, advtrains.trackpresets.t_30deg_straightonly)
|
||||
end
|
||||
end
|
||||
|
|
|
@ -46,6 +46,11 @@ Example:
|
|||
B0 W OL D10 OC D1 SM
|
||||
Subway train: stop in station and open doors, depart after 10 seconds.
|
||||
|
||||
K
|
||||
Kick all passengers out of the trains
|
||||
This command kicks all passengers (non-driving players) off the train. This command works only
|
||||
if the train is stopped and its doors are open.
|
||||
|
||||
# conditional statements:
|
||||
|
||||
I<condition><code>;
|
||||
|
|
|
@ -50,6 +50,12 @@ mobs:register_mob("mobs_animal:pumba", {
|
|||
walk_end = 100,
|
||||
punch_start = 70,
|
||||
punch_end = 100,
|
||||
|
||||
die_start = 1, -- we dont have a specific death animation so we will
|
||||
die_end = 2, -- re-use 2 standing frames at a speed of 1 fps and
|
||||
die_speed = 1, -- have mob rotate when dying.
|
||||
die_loop = false,
|
||||
die_rotate = true,
|
||||
},
|
||||
on_rightclick = function(self, clicker)
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ local use_cmi = minetest.global_exists("cmi")
|
|||
|
||||
mobs = {
|
||||
mod = "redo",
|
||||
version = "20210107",
|
||||
version = "20210108",
|
||||
intllib = S,
|
||||
invis = minetest.global_exists("invisibility") and invisibility or {}
|
||||
}
|
||||
|
@ -910,6 +910,7 @@ function mob_class:check_for_death(cmi_cause)
|
|||
local rot = self.animation.die_rotate and 5
|
||||
|
||||
self.attack = nil
|
||||
self.following = nil
|
||||
self.v_start = false
|
||||
self.timer = 0
|
||||
self.blinktimer = 0
|
||||
|
@ -917,7 +918,7 @@ function mob_class:check_for_death(cmi_cause)
|
|||
self.state = "die"
|
||||
self.object:set_properties({
|
||||
pointable = false, collide_with_objects = false,
|
||||
automatic_rotate = rot,
|
||||
automatic_rotate = rot, static_save = false
|
||||
})
|
||||
self:set_velocity(0)
|
||||
self:set_animation("die")
|
||||
|
@ -3074,6 +3075,7 @@ function mob_class:mob_staticdata()
|
|||
if t ~= "function"
|
||||
and t ~= "nil"
|
||||
and t ~= "userdata"
|
||||
and _ ~= "object"
|
||||
and _ ~= "_cmi_components" then
|
||||
tmp[_] = self[_]
|
||||
end
|
||||
|
@ -3326,6 +3328,8 @@ function mob_class:on_step(dtime, moveresult)
|
|||
}}
|
||||
}]]
|
||||
|
||||
if self.state == "die" then return end ----------------
|
||||
|
||||
if use_cmi then
|
||||
cmi.notify_step(self.object, dtime)
|
||||
end
|
||||
|
|
|
@ -623,11 +623,10 @@ end
|
|||
|
||||
function signs_lib.rightclick_sign(pos, node, player, itemstack, pointed_thing)
|
||||
|
||||
local playername = player:get_player_name()
|
||||
if not minetest.check_player_privs(playername, {signslib_edit = true}) then return end
|
||||
if not signs_lib.can_modify(pos, player) then return end
|
||||
|
||||
player:get_meta():set_string("signslib:pos", minetest.pos_to_string(pos))
|
||||
minetest.show_formspec(playername, "signs_lib:sign", get_sign_formspec(pos, node.name))
|
||||
minetest.show_formspec(player:get_player_name(), "signs_lib:sign", get_sign_formspec(pos, node.name))
|
||||
end
|
||||
|
||||
function signs_lib.destruct_sign(pos)
|
||||
|
|
Loading…
Reference in a new issue