~ywang

~ywang/misc

Last active 3 years ago
View more

Recent activity

Re: [PATCH] [LuaATC] Add get_supported_aspects(), fix set_aspect() 17 days ago

From Y. Wang to ~gpcf/advtrains-devel

> +	static_env.get_supported_aspects = function(signal)
> +		local pos = atlatc.pcnaming.resolve_pos(signal)
> +		return advtrains.interlocking.signal_get_supported_aspects(pos)
> +	end

I would suggest adding table.copy(...) here (or in 
advtrains.interlocking.signal_get_supported_aspects). Currently the 
table of supported aspects is passed verbatim to LuaATC.

It is also worth noting that the signal aspect system is reworked in 
new-ks{,-orwell}, where the table of supported signal aspects is no 
longer a table of {main = ..., dst = ..., shunt = ..., ...}.

[PATCH] atlatc: implement support for the mail mod 4 months ago

From Y. Wang to ~gpcf/advtrains-devel

---
 advtrains_luaautomation/README.md         |  7 ++++
 advtrains_luaautomation/active_common.lua |  5 ++-
 advtrains_luaautomation/environment.lua   | 46 ++++++++++++++++++++---
 advtrains_luaautomation/mod.conf          |  2 +-
 4 files changed, 52 insertions(+), 8 deletions(-)

diff --git a/advtrains_luaautomation/README.md b/advtrains_luaautomation/README.md
index a885075..1ee2507 100644
--- a/advtrains_luaautomation/README.md
+++ b/advtrains_luaautomation/README.md
@@ -164,6 +164,13 @@ Schedules an event of type {type="schedule", schedule=true, msg=msg} at (resp. a

Note: Using the lines scheduler is preferred over using `interrupt()`, as it's more performant and safer to use.
[message trimmed]

[PATCH] Fix use_texture_alpha for tracks 4 months ago

From Y. Wang to ~gpcf/advtrains-devel

The use of textures with transparent pixels (for the default tracks: the
"features" on the track) without specifying use_texture_alpha (at least
for the mesh drawtype) has been deprecated in a PR from August 2020[1]
(i.e. since 5.4.0[2]) and removed in the latest dev version[3]. As a
consequence, regular tracks are now rendered with black markers at the
same position where e.g. the blue (Lua)ATC marker would be found.

This commit fixes the issue by enabling use_texture_alpha by default for
all tracks.

[1] https://github.com/minetest/minetest/pull/10122
[2] https://dev.minetest.net/Changelog#5.3.0_.E2.86.92_5.4.0
[3] https://github.com/minetest/minetest/pull/13929
---
[message trimmed]

Re: [Patch] Doors improvements 4 months ago

From Y. Wang to ~gpcf/advtrains-devel

On 22/10/2023 00:27, Athozus wrote:
> Oh, and due to that error, I forgot to send the patches.
> 
> Sorry about that, here they are.

I would suggest using git-send-email[1] if possible. It sends the 
patches as the content of the email and allows people to quote snippets 
from the patch directly; you will need to send multiple emails with it, 
though, but then people know the order in which the patches should be 
applied, if this is done correctly.

[1] https://git-send-email.io/

The patch itself looks good with some (IMO) minor things that I would

[PATCH] Fix incorrect speed indicator; include routing info in text HUD 11 months ago

From Y. Wang to ~gpcf/advtrains-devel

---
 advtrains/texture.lua  |  6 +++---
 advtrains/trainhud.lua | 12 ++++++++++++
 2 files changed, 15 insertions(+), 3 deletions(-)

diff --git a/advtrains/texture.lua b/advtrains/texture.lua
index 1ecc91b..e6d83b0 100644
--- a/advtrains/texture.lua
+++ b/advtrains/texture.lua
@@ -125,12 +125,12 @@ local function add_segmentbar(n, self, x, y, w, h, m, c, ...)
	local bs = ss - m
	for k = 1, argc, 3 do
		local lower, upper, fill = argv[k], argv[k+1], argv[k+2]
		lower = math.max(0, math.floor(lower)+1)
[message trimmed]

[PATCH] Rework graphical train HUD code 11 months ago

From Y. Wang to ~gpcf/advtrains-devel

- A basic texture manipulation API is added; currently this is only a
  (selected) subset of texture modifiers provided by MT; the goal is to
  avoid writing (potentially incorrect) texture strings by hand;
- The graphical HUD code is cleaned up; in particular, most code used
  for generating texture patterns are moved to texture.lua so that the
  code can be used outside of the HUD;
- Inactive elements are given the darkslategray background.

A basic unittest is added; however, it needs to be expanded for better
coverage.

Reported-by: Lars Müller <appgurulars@gmx.de>
---
 advtrains/init.lua              |   1 +
[message trimmed]

Re: [PATCH] Fix texture modifiers relying on undocumented behavior 11 months ago

From Y. Wang to ~gpcf/advtrains-devel

> The Lua API states:
> 
> /Modifiers that accept texture names (e.g. //|[combine|//) accept
> escaping to allow passing complex texture names as arguments. Escaping
> is done with backslash and is required for //|^|//, //|:|//and //|\|//./

Ah, I overlooked the part that escaping is required for carets and 
simply thought you were referring to the parentheses. Thanks for 
pointing it out.

> (that said, I am considering relaxing my parser since
> using parentheses instead of properly escaping carets seems to have come
> up a few times and is not that far off-spec / unreasonable).

Re: [PATCH] Fix texture modifiers relying on undocumented behavior 11 months ago

From Y. Wang to ~gpcf/advtrains-devel

I would like a bit of clarification here, as I do not see how the use of 
(x^y) is undocumented ("texture grouping"); the documentation for the 
[combine modifier also does not state that () can not be used in the 
texture string(s) to combine.

That said, the changes do make the texture strings look cleaner.

Regardless of the texture strings, I have to admit that the code was put 
together in a relatively short amount of time, so I (or someone else) 
would need to rework the code anyway.

Re: [Discussion] [API] advtrains.get_wagon_at_pos(pos) 11 months ago

From Y. Wang to ~gpcf/advtrains-devel

> Just noticed you added a patch here an hour ago... Which means we were
> working in parallel.
> 
> My remark still holds though, and I believe my implementation is
> correct.

Agreed. I put together that patch based on reading some existing code 
and my (limited) knowledge of the path system.

Anyway, I wrote that function as an auxiliary function for 
occ.get_wagon_at(pos) since Maverick2797 wanted to get the wagon at a 
speicific position; the idea is to use occ.get_trains_at(pos) and remap 
the returned table to wagons (instead of trains).

[PATCH] Add API to get wagons at a specific position 11 months ago

From Y. Wang to ~gpcf/advtrains-devel

---
 advtrains/occupation.lua | 14 ++++++++++++++
 advtrains/trainlogic.lua | 17 +++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/advtrains/occupation.lua b/advtrains/occupation.lua
index db39991..18e3f2b 100644
--- a/advtrains/occupation.lua
+++ b/advtrains/occupation.lua
@@ -186,6 +186,20 @@ function o.get_trains_at(ppos)
	return r
end

-- Gets a mapping of wagon id's to offsets of wagons that stand or drive over;
[message trimmed]