How to Detect Firework Wires Using Fun

Learn here how to create and use plugins.

Moderator: Plugin Moderators

User avatar
KINGTUT10101
1,000,000 inhabitants
Reactions:
Posts: 1945
Joined: Thu Jul 07, 2016 22:50
Location: 'Merica
Plugins: Show
Version: Beta
Phone model: Moto x4

Platform

Plugin Creator

How to Detect Firework Wires Using Fun

#1

Post by KINGTUT10101 » Sat Oct 05, 2019 21:25

This tutorial should help those of you who want to utilize the firework wire's functionality without having to make your own wire.

It is very simple to use a wire in your condition:

Code: Select all

"condition":{"type":"building","id":"$on"}
All you need is something like this that checks for the ID "$on". Very simple, but very useful. If you want to detect when the wire is off, then you'll need to use the ID "$off".
There's no need to worry about detecting frames. Checking for the ID will be enough.

Here's an example of its usage:

Code: Select all

[
	{
		"frames":[
			{
				"steal":"$res00"
			}
		],
		"fun":[
			{
				"actions":[
					{
						"type":"remove"
					}
				],
				"condition":{
					"id":"$on",
					"type":"building",
					"x":1
				}
			},
			{
				"actions":[
					{
						"type":"remove"
					}
				],
				"condition":{
					"id":"$on",
					"type":"building",
					"x":-1
				}
			},
			{
				"actions":[
					{
						"type":"remove"
					}
				],
				"condition":{
					"id":"$on",
					"type":"building",
					"y":1
				}
			},
			{
				"actions":[
					{
						"type":"remove"
					}
				],
				"condition":{
					"id":"$on",
					"type":"building",
					"y":-1
				}
			}
		],
		"height":1,
		"id":"wire_sensor.kt101",
		"needsroad":false,
		"power":0,
		"price":0,
		"text":"Wiresensor",
		"title":"Wiresensor",
		"type":"terrain",
		"water":0,
		"width":1
	}
]
This code checks for an activated wire nearby and removes the building when the condition is true.

You can download the example file here:
wire_sensor.json
(522 Bytes) Downloaded 6 times

Return to “Tutorials and Documentation”

Who is online

Users browsing this forum: No registered users and 2 guests