aboutsummaryrefslogtreecommitdiff
path: root/games/devtest/mods
ModeNameSize
d---------basenodes107logplain
d---------basetools107logplain
d---------broken72logplain
d---------bucket107logplain
d---------chest107logplain
d---------chest_of_everything107logplain
d---------dignodes107logplain
d---------experimental224logplain
d---------give_initial_stuff72logplain
d---------initial_message72logplain
d---------mapgen72logplain
d---------modchannels72logplain
d---------soundstuff140logplain
d---------stairs72logplain
d---------testentities224logplain
d---------testfood107logplain
d---------testformspec303logplain
d---------testhud72logplain
d---------testnodes493logplain
d---------testpathfinder144logplain
d---------testtools181logplain
d---------tiled107logplain
d---------unittests318logplain
d---------util_commands72logplain
n>0]="N"} function advtrains.on_control_change(pc, train, flip) local maxspeed = train.max_speed or 10 if pc.sneak then if pc.up then train.tarvelocity = maxspeed end if pc.down then train.tarvelocity = 0 end if pc.left then train.tarvelocity = 4 end if pc.right then train.tarvelocity = 8 end --[[if pc.jump then train.brake = true --0: released, 1: brake and pressed, 2: released and brake, 3: pressed and brake if not train.brake_hold_state or train.brake_hold_state==0 then train.brake_hold_state = 1 elseif train.brake_hold_state==2 then train.brake_hold_state = 3 end elseif train.brake_hold_state==1 then train.brake_hold_state = 2 elseif train.brake_hold_state==3 then train.brake = false train.brake_hold_state = 0 end]] --shift+use:see wagons.lua else local act=false if pc.jump then train.ctrl_user = 1 act=true end if train.ars_disable and pc.up then -- up clears ars disable flag in any situation train.ars_disable = nil end -- If atc command set, only "Jump" key can clear command. To prevent accidental control. if train.tarvelocity or train.atc_command then return end if pc.up then train.ctrl_user=4 act=true end if pc.down then if train.velocity>0 then if pc.jump then train.ctrl_user = 0 else train.ctrl_user = 2 end act=true else advtrains.invert_train(train.id) advtrains.atc.train_reset_command(train) end end if pc.left then if train.door_open ~= 0 then train.door_open = 0 else train.door_open = -1 end end if pc.right then if train.door_open ~= 0 then train.door_open = 0 else train.door_open = 1 end end if not act then train.ctrl_user = nil end end end function advtrains.update_driver_hud(pname, train, flip) local inside=train.text_inside or "" local ft, ht = advtrains.hud_train_format(train, flip) advtrains.set_trainhud(pname, inside.."\n"..ft, ht) end function advtrains.clear_driver_hud(pname) advtrains.set_trainhud(pname, "") end function advtrains.set_trainhud(name, text, driver) local hud = advtrains.hud[name] local player=minetest.get_player_by_name(name) if not player then return end local drivertext = driver or "" local driverhud = { [hud_type_key] = "image", name = "ADVTRAINS_DRIVER", position = {x=0.5, y=1}, offset = {x=0,y=-170}, text = drivertext, alignment = {x=0,y=-1}, scale = {x=1,y=1}, } if not hud then hud = {} advtrains.hud[name] = hud hud.id = player:hud_add({ [hud_type_key] = "text", name = "ADVTRAINS", number = 0xFFFFFF,