From ba21959c15b7e3148deaa51eedb0139028128ee3 Mon Sep 17 00:00:00 2001 From: 1ue999 <106450442+1ue999@users.noreply.github.com> Date: Tue, 8 Apr 2025 17:48:11 +0200 Subject: [PATCH] Read Length of Strings (#10611) * added ability to sense length of charsequences * documentation * Update core/assets/bundles/bundle.properties Co-authored-by: Jason <131086642+JasonP01@users.noreply.github.com> --------- Co-authored-by: Anuken Co-authored-by: Jason <131086642+JasonP01@users.noreply.github.com> --- core/assets/bundles/bundle.properties | 1 + core/src/mindustry/logic/LExecutor.java | 4 ++++ 2 files changed, 5 insertions(+) diff --git a/core/assets/bundles/bundle.properties b/core/assets/bundles/bundle.properties index b5b5b1bf98..b9e740e588 100644 --- a/core/assets/bundles/bundle.properties +++ b/core/assets/bundles/bundle.properties @@ -2540,6 +2540,7 @@ laccess.dead = Whether a unit/building is dead or no longer valid. laccess.controlled = Returns:\n[accent]@ctrlProcessor[] if unit controller is processor\n[accent]@ctrlPlayer[] if unit/building controller is player\n[accent]@ctrlCommand[] if unit controller is a player command\nOtherwise, 0. laccess.progress = Action progress, 0 to 1.\nReturns production, turret reload or construction progress. laccess.speed = Top speed of a unit, in tiles/sec. +laccess.size = Size of a unit/building or the length of a string. laccess.id = ID of a unit/block/item/liquid.\nThis is the inverse of the lookup operation. lcategory.unknown = Unknown diff --git a/core/src/mindustry/logic/LExecutor.java b/core/src/mindustry/logic/LExecutor.java index 8f7985b55b..d445308e88 100644 --- a/core/src/mindustry/logic/LExecutor.java +++ b/core/src/mindustry/logic/LExecutor.java @@ -652,6 +652,10 @@ public class LExecutor{ } } }else{ + if(target instanceof CharSequence seq && sense == LAccess.size){ + to.setnum(seq.length()); + return; + } to.setobj(null); } }