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: 2220
Joined: 07 Jul 2016, 22:50
Location: 'Merica
Plugins: Showcase Store
Version: Beta
Contact:

Plugin Creator

Platform

How to Detect Firework Wires Using Fun

#1

Post by KINGTUT10101 »

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 95 times

Return to “Tutorials and Documentation”