🐐 DECIMATIO

This commit is contained in:
2026-04-21 15:18:39 +02:00
parent 63c35605a2
commit 861448cb04
9 changed files with 53 additions and 3 deletions

View File

@@ -957,6 +957,16 @@ class BuiltIn(Node):
raise CentvrionError("SEMEN requires an integer seed")
random.seed(seed)
return vtable, ValNul()
case "DECIMATIO":
if "FORS" not in vtable["#modules"]:
raise CentvrionError("Cannot use 'DECIMATIO' without module 'FORS'")
if not isinstance(params[0], ValList):
raise CentvrionError("DECIMATIO requires an array")
arr = list(params[0].value())
to_remove = len(arr) // 10
for _ in range(to_remove):
arr.pop(random.randint(0, len(arr) - 1))
return vtable, ValList(arr)
case "LONGITVDO":
if isinstance(params[0], (ValList, ValStr)):
return vtable, ValInt(len(params[0].value()))