summaryrefslogtreecommitdiff
path: root/durt/nodes/(-4227,18,-5926).lua
blob: b640ec99890a7b231493e37985f2fee1499b35f6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
local rev_rc = "CORN_HS_N"
local rm_rc = true


__approach_callback_mode = 1

if event.approach and not event.has_entered then
	atc_set_lzb_tsr(3)
	atc_set_ars_disable(true)
	return
end

if event.train then
	if atc_arrow then
		if not F.has_rc(rev_rc) then
			atc_set_ars_disable(false)
			return
		end
		if rm_rc then F.remove_rc(rev_rc) end
		schedule_in(";01",atc_id)
		return
	else
		if F.has_rc("CORN_rejoin") then
			set_autocouple()
		end
		return
	end
end

if event.schedule then
	if not atc_id then --bounce the train that just passed
		atc_send_to_train(event.msg,"B0WRD1A1S3")
	else
		if atc_id == event.msg then --train hasn't fully passed yet, wait a bit longer
			schedule_in(";01",atc_id)
		else -- somehow another train crossed the controller before the first one returned. Unlikely but possible
			atc_send_to_train(event.msg,"BBOL")
			atc_send("BBOL")
		end
	end
end
#n159'>159 160 161 162 163 164
/*
Minetest
Copyright (C) 2013 celeron55, Perttu Ahola <celeron55@gmail.com>

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Lesser General Public License as published by
the Free Software Foundation; either version 2.1 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
*/


/******************************************************************************/
/******************************************************************************/
/* WARNING!!!! do NOT add this header in any include file or any code file    */
/*             not being a script/modapi file!!!!!!!!                         */
/******************************************************************************/
/******************************************************************************/

#ifndef C_CONTENT_H_
#define C_CONTENT_H_

extern "C" {
#include <lua.h>
}

#include <iostream>
#include <map>
#include <vector>

#include "irrlichttypes_bloated.h"
#include "util/string.h"

namespace Json { class Value; }

struct MapNode;
class INodeDefManager;
struct PointedThing;
struct ItemStack;
struct ItemDefinition;
struct ToolCapabilities;
struct ObjectProperties;
struct SimpleSoundSpec;
struct ServerSoundParams;
class Inventory;
struct NodeBox;
struct ContentFeatures;
struct TileDef;
class Server;
struct DigParams;
struct HitParams;
struct EnumString;
struct NoiseParams;
class Schematic;


ContentFeatures    read_content_features     (lua_State *L, int index);
TileDef            read_tiledef              (lua_State *L, int index,
                                              u8 drawtype);
void               read_soundspec            (lua_State *L, int index,
                                              SimpleSoundSpec &spec);
NodeBox            read_nodebox              (lua_State *L, int index);

void               read_server_sound_params  (lua_State *L, int index,
                                              ServerSoundParams &params);

void               push_dig_params           (lua_State *L,
                                              const DigParams &params);
void               push_hit_params           (lua_State *L,
                                              const HitParams &params);

ItemStack          read_item                 (lua_State *L, int index, Server *srv);


ToolCapabilities   read_tool_capabilities    (lua_State *L, int table);
void               push_tool_capabilities    (lua_State *L,
                                              const ToolCapabilities &prop);

ItemDefinition     read_item_definition      (lua_State *L, int index,
                                              ItemDefinition default_def);
void               read_object_properties    (lua_State *L, int index,
                                              ObjectProperties *prop);
void               push_object_properties    (lua_State *L,
                                              ObjectProperties *prop);

void               push_inventory_list       (lua_State *L,
                                              Inventory *inv,
                                              const char *name);
void               read_inventory_list       (lua_State *L, int tableindex,
                                              Inventory *inv, const char *name,
                                              Server *srv, int forcesize=-1);

MapNode            readnode                  (lua_State *L, int index,
                                              INodeDefManager *ndef);
void               pushnode                  (lua_State *L, const MapNode &n,
                                              INodeDefManager *ndef);

NodeBox            read_nodebox              (lua_State *L, int index);