aboutsummaryrefslogtreecommitdiff
path: root/po/jbo
diff options
context:
space:
mode:
authorPilzAdam <PilzAdam@minetest.net>2015-10-27 16:45:01 +0100
committerWeblate <noreply@weblate.org>2015-11-08 18:40:23 +0100
commit54634fa8b3ddde57958f051c50da0ab7fd716fe6 (patch)
tree2ac61c6d486ae2c6e800fa172f2335db533e967b /po/jbo
parent037221c84d0c7cc18d1c41c3ec3d206150a2975f (diff)
downloadminetest-54634fa8b3ddde57958f051c50da0ab7fd716fe6.tar.gz
minetest-54634fa8b3ddde57958f051c50da0ab7fd716fe6.tar.bz2
minetest-54634fa8b3ddde57958f051c50da0ab7fd716fe6.zip
Translated using Weblate (Chinese (Taiwan))
Currently translated at 43.8% (330 of 753 strings)
Diffstat (limited to 'po/jbo')
0 files changed, 0 insertions, 0 deletions
> 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426
-- Signal API implementation

local F = advtrains.formspec

local signal = {}

signal.MASP_HALT = {
	name = "_halt",
	halt = true,
}

signal.MASP_DEFAULT = {
	name = "_default",
	default = true,
}

signal.ASPI_HALT = {
	main = 0,
	shunt = false,
}

signal.ASPI_FREE = {
	main = -1,
	shunt = false,
	proceed_as_main = true,
}

--[[
Implementation plan orwell 2024-01-28:
Most parts of ywang's implementation are fine, especially I like the formspecs. But I would like to change a few aspects (no pun intended) of this.
- Signal gets distant assigned via field in signal aspect table (instead of explicitly)
- Signal speed/shunt are no longer free-text but rather they need to be predefined in the node definition
To do this: Differentiation between:
== Main Aspect ==
This is what a signal is assigned by either the route system or the user.
It is a string key which has an appropriate entry in the node definition (where it has a description assigned)
The signal mod defines a function to set a signal to the most appropriate aspect. This function gets
a) the main aspect table (straight from node def)
b) the distant signal's aspect group name & aspect table

== Aspect ==
One concrete combination of lights/shapes that a signal signal shows. Handling these is at the discretion of
the signal mod defining the signal, and they are typically combinations of main aspect and distant aspect
Example:
- A Ks signal has the main_aspect="proceed_12" set for a route
- The signal at the end of the route shows main_aspect="proceed_8", advtrains also passes on that this means {main=8, shunt=false}
- The ndef.afunction(pos, node, main_aspect, rem_aspect, rem_aspinfo) determines that the signal should now show
		blinking green with main indicator 12 and dst indicator 8, and sets the nodes accordingly.
		This function can now return the Aspect Info table, which will be cached by advtrains until the aspect changes again
		and will be used when a train approaches the signal. If nil is returned, then the aspect will be queried next time
		by calling ndef.advtrains.get_aspect_info(pos)

Note that once apply_aspect returns, there is no need for advtrains anymore to query the aspect info.
When the signal, for any reason, wants to change its aspect by itself *without* going through the signal API then
it should update the aspect info cache by calling advtrains.interlocking.signal.update_aspect_info(pos)

Apply_aspect may also receive the special main aspect { name = "_halt", halt = true }. It usually means that the signal is not assigned to anything particular,
and it should cause the signal to show its most restrictive aspect. Typically it is a halt aspect, but e.g. for distant-only
signals this would be "expect stop".

A special case occurs for pure distant signals: Such signals must set apply_aspect, but must not set main_aspects. Behavior is as follows:
- Signal is uninitialized, distant signal is not assigned to a main signal, or no route is set: main_aspect == { name = "_halt", halt = true } and rem_aspect == nil
- A remote main signal is assigned (either by user or by route): main_aspect is always { name = "_default" } and rem_aspect / rem_aspinfo give the correct information

Main aspect names starting with underscore (e.g. "_default") are reserved and must not be used!

== Aspect Info ==
The actual signal aspect in the already-known format. This is what the trains use to determine halt/proceed and speed.
asp = {
	main = 0 (halt) / -1 (max speed) / false (no info) / <number> (speed limit)
	shunt = true (shunt free) / false (shunt not free)
	proceed_as_main = true (shunt move can proceed and become train move when main!=0) / false (no)
	dst = speed of the remote signal (like main, informative character, not actually used)
}

Node definition of signals:
- The signal needs some logic to figure out, for each combination of its own aspect group and the distant signal's aspect, what aspect info it can/will show.
ndef.advtrains = {
	main_aspects = {
		{ name = "proceed" description = "Proceed at full speed", <more data at discretion of signal>}
		{ name = "reduced" description = "Proceed at reduced speed", <more data at discretion of signal>}
	}
		-- This list is mainly for the selection dialog. Order of entries determines list order in the dropdown.
		-- Some fields have special meaning:
		-- name: A unique key to identify the main aspect. Might be required by some code.
		-- description: Text shown in UI dropdown
		-- Node can set any other fields at its discretion. They are not touched.
		-- Note: Pure distant signals (that cannot show halt) should NOT have a main_aspects table.
		--       For these signals no main aspect selection UI is shown and they cannot be startpoint of a route
	apply_aspect = function(pos, node, main_aspect, rem_aspect, rem_aspinfo)
		-- set the node to show the desired aspect
		-- called by advtrains when this signal's aspect group or the remote signal's aspect changes
		-- main_aspect is never nil, but can be one of the special aspects { halt = true } or { default = true }
		-- MAY return the aspect_info. If it returns nil then get_aspect_info will be queried at a later point.
	get_aspect_info(pos, main_aspect)
		-- Returns the aspect info table (main, shunt, dst etc.)
	distant_support = true or false
		-- If true, signal is considered in distant signalling. If false or nil, rem_aspect and rem_aspinfo are never set.
	route_role = one of "main", "shunt", "distant", "distant_repeater", "end"
		-- Determines how the signal behaves when routes are set. Only in effect when signal is assigned to a TCB.
		-- main: The signal is a possible endpoint for a train move route. Distant signals before it refer to it.
		-- shunt: The signal is a possible endpoint for a shunt move route. Ignored for distant signals.
		-- distant, distant_repeater: When route is set, signal is always assigned its first main aspect. The next signal with role="main" is set as the remote signal. (currently no further distinction)
		-- end: like main, but signifies that it marks an end of track and trains cannot continue further. (currently no practical implications above main)
}

== Nomenclature ==
The distant/main relation is named as follows:
     V    M
=====>====>
Main signal (main) always refers to the signal that is in focus right now (even if that is a distant-only signal)
From the standpoint of M, V is the distant (dst) signal. M does not need to concern itself with V's aspect but needs to notify V when it changes
From the standpoint of V, M is the remote (rem) signal. V needs to show an aspect that matches its remote signal M

== Criteria for which signals are eligible for routes ==

All signals must define:
- get_aspect_info()

Signals that can be assigned to a TCB must satisfy:
- apply_aspect() defined

Signals that are possible start and end points for a route must satisfy:
- main_aspects defined (note, pure distant signals should therefore not define main_aspects)

]]

-- Database
-- Signal Aspect store
-- Stores for each signal the main aspect and other info, like the assigned remote signal
-- [signal encodePos] = { main = <table or string>, [remote = encodedPos] }
-- main is a string: "named aspect" is looked up in the main_aspects table of the ndef
-- main is a table: this table directly is the main aspect (used for advanced signals with additional lights/indicators)
signal.aspects = {}

-- Distant signal notification. Records for each signal the distant signals that refer to it
-- Note: this mapping is weak. Needs always backreference check.
-- [signal encodePos] = { [distant signal encodePos] = true }
signal.distant_refs = {}

function signal.load(data)
	signal.aspects = data.aspects or {}
	-- rebuild distant_refs after load
	signal.distant_refs = {}
	for main, aspt in pairs(signal.aspects) do
		if aspt.remote then
			if not signal.distant_refs[aspt.remote] then
				signal.distant_refs[aspt.remote] = {}
			end
			signal.distant_refs[aspt.remote][main] = true
		end
	end
end

function signal.save(data)
	data.aspects = signal.aspects
end


-- Set a signal's aspect.
-- Signal aspects should only be set through this function. It takes care of:
-- - Storing the main aspect and dst pos for this signal permanently (until next change)
-- - Assigning the distant signal for this signal
-- - Calling apply_aspect() in the signal's node definition to make the signal show the aspect
-- - Calling apply_aspect() again whenever the remote signal changes its aspect
-- - Notifying this signal's distant signals about changes to this signal (unless skip_dst_notify is specified)
-- main_asp: either a string (==name in ndef.advtrains.main_aspects) or the main aspect table directly (for advanced signals)
function signal.set_aspect(pos, main_asp, rem_pos, skip_dst_notify)