mirror of
https://github.com/damp11113-software/ccIDE.git
synced 2025-04-27 22:48:13 +00:00
update 1.3
This commit is contained in:
parent
88ddcb15dd
commit
a11e210c3d
@ -47,7 +47,11 @@ luaGenerator.forBlock['peripheral_call'] = function(block, generator) {
|
||||
var method = generator.valueToCode(block, 'METHOD', generator.ORDER_ATOMIC);
|
||||
var args = generator.valueToCode(block, 'ARGS', generator.ORDER_ATOMIC);
|
||||
|
||||
return [`peripheral.call(${name}, ${method}, ${args})`, luaGenerator.ORDER_NONE];
|
||||
if (block.outputConnection && block.outputConnection.targetConnection) {
|
||||
return [`peripheral.call(${name}, ${method}, ${args})`, luaGenerator.ORDER_NONE];
|
||||
} else {
|
||||
return `peripheral.call(${name}, ${method}, ${args})\n`
|
||||
}
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['peripheral_wrap'] = function(block, generator) {
|
||||
|
787
blocks/Create_Additions/block_design.json
Normal file
787
blocks/Create_Additions/block_design.json
Normal file
@ -0,0 +1,787 @@
|
||||
{
|
||||
"create_addition_electric_motor_set_speed": {
|
||||
"message0": "Set motor %1 speed to %2 RPM",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "MOTOR",
|
||||
"check": "Peripheral"
|
||||
},
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "RPM",
|
||||
"check": "Number"
|
||||
}
|
||||
],
|
||||
"previousStatement": null,
|
||||
"nextStatement": null,
|
||||
"colour": 70,
|
||||
"tooltip": "To set the speed of the Electric Motor, call setSpeed(rpm) where the argument rpm is a number between -256 and 256. The function will throw an exception if it is called too many times per second."
|
||||
},
|
||||
"create_addition_electric_motor_stop": {
|
||||
"message0": "Stop motor %1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "MOTOR",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"previousStatement": null,
|
||||
"nextStatement": null,
|
||||
"colour": 70,
|
||||
"tooltip": "This is a shorthand for setSpeed(0)."
|
||||
},
|
||||
"create_addition_electric_motor_rotate": {
|
||||
"message0": "Calculate rotation for motor %1 to rotate %2 degrees with speed %3 RPM",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "MOTOR",
|
||||
"check": "Peripheral"
|
||||
},
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "DEGREES",
|
||||
"check": "Number"
|
||||
},
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "RPM",
|
||||
"check": "Number"
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will return the time it will take to rotate the shaft by the argument degrees at the current speed. If the optional argument rpm is given it will set the speed of the motor and return the rotation time at the new speed."
|
||||
},
|
||||
"create_addition_electric_motor_translate": {
|
||||
"message0": "Translate motor %1 by %2 blocks with speed %3 RPM",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "MOTOR",
|
||||
"check": "Peripheral"
|
||||
},
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "BLOCKS",
|
||||
"check": "Number"
|
||||
},
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "RPM",
|
||||
"check": "Number"
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will return the time it will take to rotate the shaft to push a piston or gantry shaft by distance given by the argument blocks at the current speed. "
|
||||
},
|
||||
"create_addition_electric_motor_get_speed": {
|
||||
"message0": "Get current speed from motor %1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "MOTOR",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will return the current motor speed."
|
||||
},
|
||||
"create_addition_electric_motor_get_stress_capacity": {
|
||||
"message0": "Get stress capacity from motor %1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "MOTOR",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will return the produced stress capacity (output su)."
|
||||
},
|
||||
"create_addition_electric_motor_get_energy_consumption": {
|
||||
"message0": "Get energy consumption from motor %1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "MOTOR",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will return the motor energy consumption in FE/t."
|
||||
},
|
||||
"create_addition_electric_motor_get_max_input": {
|
||||
"message0": "Get max input from motor %1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "MOTOR",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will return the Motor max input in fe."
|
||||
},
|
||||
"create_addition_electric_motor_get_max_output": {
|
||||
"message0": "Get max output from motor %1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "MOTOR",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will return the Motor max output in fe (Always 0)."
|
||||
},
|
||||
|
||||
"create_addition_accumulator_get_energy": {
|
||||
"message0": "Get current energy is store in accumulator %1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "ACCUMULATOR",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will return the accumulator total stored charge in fe."
|
||||
},
|
||||
"create_addition_accumulator_get_capacity": {
|
||||
"message0": "Get total capacity in accumulator %1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "ACCUMULATOR",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will return the accumulator total capacity in fe."
|
||||
},
|
||||
"create_addition_accumulator_get_percent": {
|
||||
"message0": "Get percent energy is store in accumulator %1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "ACCUMULATOR",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will return the accumulator total charge in relation to the total capacity in percent."
|
||||
},
|
||||
"create_addition_accumulator_get_max_input": {
|
||||
"message0": "Get max input from accumulator %1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "ACCUMULATOR",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will return the accumulator max input per block face in fe."
|
||||
},
|
||||
"create_addition_accumulator_get_max_output": {
|
||||
"message0": "Get max output from accumulator %1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "ACCUMULATOR",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will return the accumulator max output per block face in fe."
|
||||
},
|
||||
"create_addition_accumulator_get_height": {
|
||||
"message0": "Get current height from accumulator %1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "ACCUMULATOR",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will return the accumulator height in block."
|
||||
},
|
||||
"create_addition_accumulator_get_width": {
|
||||
"message0": "Get current width from accumulator %1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "ACCUMULATOR",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will return the accumulator width in block."
|
||||
},
|
||||
|
||||
"create_addition_pei_get_energy": {
|
||||
"message0": "Get current energy is store in source from PEI %1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "PEI",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will return the connected contraption total stored charge in fe, (-1 if not connected)."
|
||||
},
|
||||
"create_addition_pei_get_capacity": {
|
||||
"message0": "Get total capacity in source from PEI %1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "PEI",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will return the connected contraption total capacity in fe, (-1 if not connected)."
|
||||
},
|
||||
"create_addition_pei_is_connected": {
|
||||
"message0": "Is PEI %1 connected",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "PEI",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"output": "Boolean",
|
||||
"colour": 70,
|
||||
"tooltip": "This will return true if a contraption is connected."
|
||||
},
|
||||
"create_addition_pei_get_max_input": {
|
||||
"message0": "Get max input from PEI %1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "PEI",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will return the PEI max input in fe."
|
||||
},
|
||||
"create_addition_pei_get_max_output": {
|
||||
"message0": "Get max output from PEI %1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "PEI",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will return the PEI max output in fe."
|
||||
},
|
||||
|
||||
"create_addition_relay_get_max_input": {
|
||||
"message0": "Get max input from relay %1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "RELAY",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will return the Relay max input in fe."
|
||||
},
|
||||
"create_addition_relay_get_max_output": {
|
||||
"message0": "Get max output from relay %1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "RELAY",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will return the Relay max output in fe."
|
||||
},
|
||||
"create_addition_relay_get_throughput": {
|
||||
"message0": "Get current throughput relay %1",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "RELAY",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will return the current throughput in fe."
|
||||
},
|
||||
"create_addition_relay_is_powered": {
|
||||
"message0": "Is relay %1 powered",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "RELAY",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"output": "Boolean",
|
||||
"colour": 70,
|
||||
"tooltip": "This will return the redstone state of the Relay."
|
||||
},
|
||||
|
||||
"create_addition_da_rotational_speed_control_set_target_speed": {
|
||||
"message0": "Set target speed to %1 rpm to controller %2 at %3 side of adapter",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "RPM"
|
||||
},
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "DA",
|
||||
"check": "Peripheral"
|
||||
},
|
||||
{
|
||||
"type": "field_dropdown",
|
||||
"name": "SIDE",
|
||||
"options": [
|
||||
["Top", "top"],
|
||||
["Bottom", "bottom"],
|
||||
["North", "north"],
|
||||
["East", "east"],
|
||||
["West", "west"],
|
||||
["South", "south"]
|
||||
]
|
||||
}
|
||||
],
|
||||
"previousStatement": null,
|
||||
"nextStatement": null,
|
||||
"colour": 70,
|
||||
"tooltip": "This will set the target speed of a Rotation Speed Controller attached to the side of a Digital Adapter."
|
||||
},
|
||||
"create_addition_da_rotational_speed_control_get_target_speed": {
|
||||
"message0": "Get target speed from controller %1 at %2 side of adapter",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "DA",
|
||||
"check": "Peripheral"
|
||||
},
|
||||
{
|
||||
"type": "field_dropdown",
|
||||
"name": "SIDE",
|
||||
"options": [
|
||||
["Top", "top"],
|
||||
["Bottom", "bottom"],
|
||||
["North", "north"],
|
||||
["East", "east"],
|
||||
["West", "west"],
|
||||
["South", "south"]
|
||||
]
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will get the target speed of a Rotation Speed Controller attached to the side of a Digital Adapter."
|
||||
},
|
||||
|
||||
"create_addition_da_stressometer_get_kinetic_stress": {
|
||||
"message0": "Get current stress from stressometer %1 at %2 side of adapter",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "DA",
|
||||
"check": "Peripheral"
|
||||
},
|
||||
{
|
||||
"type": "field_dropdown",
|
||||
"name": "SIDE",
|
||||
"options": [
|
||||
["Top", "top"],
|
||||
["Bottom", "bottom"],
|
||||
["North", "north"],
|
||||
["East", "east"],
|
||||
["West", "west"],
|
||||
["South", "south"]
|
||||
]
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will get the stress of a Stressometer attached to the side of a Digital Adapter."
|
||||
},
|
||||
"create_addition_da_stressometer_get_kinetic_capacity": {
|
||||
"message0": "Get capacity stress from stressometer %1 at %2 side of adapter",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "DA",
|
||||
"check": "Peripheral"
|
||||
},
|
||||
{
|
||||
"type": "field_dropdown",
|
||||
"name": "SIDE",
|
||||
"options": [
|
||||
["Top", "top"],
|
||||
["Bottom", "bottom"],
|
||||
["North", "north"],
|
||||
["East", "east"],
|
||||
["West", "west"],
|
||||
["South", "south"]
|
||||
]
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will get the stress capacity of a Stressometer attached to the side of a Digital Adapter."
|
||||
},
|
||||
|
||||
"create_addition_da_speedometer_get_kinetic_speed": {
|
||||
"message0": "Get current speed from speedometer %1 at %2 side of adapter",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "DA",
|
||||
"check": "Peripheral"
|
||||
},
|
||||
{
|
||||
"type": "field_dropdown",
|
||||
"name": "SIDE",
|
||||
"options": [
|
||||
["Top", "top"],
|
||||
["Bottom", "bottom"],
|
||||
["North", "north"],
|
||||
["East", "east"],
|
||||
["West", "west"],
|
||||
["South", "south"]
|
||||
]
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will get the speed of a Speedometer attached to the side of a Digital Adapter."
|
||||
},
|
||||
"create_addition_da_speedometer_get_kinetic_max_speed": {
|
||||
"message0": "Get max speed from speedometer %1 of adapter",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "DA",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will get the top speed as set by Create."
|
||||
},
|
||||
|
||||
"create_addition_da_pulleys_get_pulleys_distance": {
|
||||
"message0": "Get current distance from pulleys %1 at %2 side of adapter",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "DA",
|
||||
"check": "Peripheral"
|
||||
},
|
||||
{
|
||||
"type": "field_dropdown",
|
||||
"name": "SIDE",
|
||||
"options": [
|
||||
["Top", "top"],
|
||||
["Bottom", "bottom"],
|
||||
["North", "north"],
|
||||
["East", "east"],
|
||||
["West", "west"],
|
||||
["South", "south"]
|
||||
]
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will get the extended distance of a Rope, Hose, or Elevator -Pulley attached to the side of a Digital Adapter."
|
||||
},
|
||||
|
||||
"create_addition_da_elevator_pulley_get_elevator_floor": {
|
||||
"message0": "Get current floor from elevator %1 at %2 side of adapter",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "DA",
|
||||
"check": "Peripheral"
|
||||
},
|
||||
{
|
||||
"type": "field_dropdown",
|
||||
"name": "SIDE",
|
||||
"options": [
|
||||
["Top", "top"],
|
||||
["Bottom", "bottom"],
|
||||
["North", "north"],
|
||||
["East", "east"],
|
||||
["West", "west"],
|
||||
["South", "south"]
|
||||
]
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will get the current floor index of an Elevator Pulley attached to the side of a Digital Adapter."
|
||||
},
|
||||
"create_addition_da_elevator_pulley_get_elevator_floors": {
|
||||
"message0": "Get total floors from elevator %1 at %2 side of adapter",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "DA",
|
||||
"check": "Peripheral"
|
||||
},
|
||||
{
|
||||
"type": "field_dropdown",
|
||||
"name": "SIDE",
|
||||
"options": [
|
||||
["Top", "top"],
|
||||
["Bottom", "bottom"],
|
||||
["North", "north"],
|
||||
["East", "east"],
|
||||
["West", "west"],
|
||||
["South", "south"]
|
||||
]
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will get the number of floors of an Elevator Pulley attached to the side of a Digital Adapter."
|
||||
},
|
||||
"create_addition_da_elevator_pulley_get_elevator_floor_name": {
|
||||
"message0": "Get floor %1 name from elevator %2 at %3 side of adapter",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "INDEX",
|
||||
"check": "Number"
|
||||
},
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "DA",
|
||||
"check": "Peripheral"
|
||||
},
|
||||
{
|
||||
"type": "field_dropdown",
|
||||
"name": "SIDE",
|
||||
"options": [
|
||||
["Top", "top"],
|
||||
["Bottom", "bottom"],
|
||||
["North", "north"],
|
||||
["East", "east"],
|
||||
["West", "west"],
|
||||
["South", "south"]
|
||||
]
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will get floor name at floor index of a Elevator Pulley attached to the side of a Digital Adapter."
|
||||
},
|
||||
"create_addition_da_elevator_pulley_goto_elevator_floor_name": {
|
||||
"message0": "Goto floor %1 with elevator %2 at %3 side of adapter",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "INDEX",
|
||||
"check": "Number"
|
||||
},
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "DA",
|
||||
"check": "Peripheral"
|
||||
},
|
||||
{
|
||||
"type": "field_dropdown",
|
||||
"name": "SIDE",
|
||||
"options": [
|
||||
["Top", "top"],
|
||||
["Bottom", "bottom"],
|
||||
["North", "north"],
|
||||
["East", "east"],
|
||||
["West", "west"],
|
||||
["South", "south"]
|
||||
]
|
||||
}
|
||||
],
|
||||
"previousStatement": null,
|
||||
"nextStatement": null,
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will trigger a Elevator Pulley attached to the side of a Digital Adapter to move to the given floor index and returns the delta-y to move."
|
||||
},
|
||||
|
||||
"create_addition_da_mechanical_piston_get_piston_distance": {
|
||||
"message0": "Get current extended distance from piston %1 at %2 side of adapter",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "DA",
|
||||
"check": "Peripheral"
|
||||
},
|
||||
{
|
||||
"type": "field_dropdown",
|
||||
"name": "SIDE",
|
||||
"options": [
|
||||
["Top", "top"],
|
||||
["Bottom", "bottom"],
|
||||
["North", "north"],
|
||||
["East", "east"],
|
||||
["West", "west"],
|
||||
["South", "south"]
|
||||
]
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will get the extended distance of a Mechanical Piston attached to the side of a Digital Adapter."
|
||||
},
|
||||
|
||||
"create_addition_da_mechanical_bearing_get_bearing_angle": {
|
||||
"message0": "Get current angle from Bearing %1 at %2 side of adapter",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "DA",
|
||||
"check": "Peripheral"
|
||||
},
|
||||
{
|
||||
"type": "field_dropdown",
|
||||
"name": "SIDE",
|
||||
"options": [
|
||||
["Top", "top"],
|
||||
["Bottom", "bottom"],
|
||||
["North", "north"],
|
||||
["East", "east"],
|
||||
["West", "west"],
|
||||
["South", "south"]
|
||||
]
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will get the angle of a Mechanical Bearing attached to the side of a Digital Adapter."
|
||||
},
|
||||
|
||||
"create_addition_da_dp_link_print": {
|
||||
"message0": "Print %1 to display %2 with adapter",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "TEXT",
|
||||
"check": "String"
|
||||
},
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "DA",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"previousStatement": null,
|
||||
"nextStatement": null,
|
||||
"colour": 70,
|
||||
"tooltip": "This will print a string on the currently selected line to an internal buffer which can be read by a Display Link and put on a Display Board, print will increment the currently selected line."
|
||||
},
|
||||
"create_addition_da_dp_link_clear_line": {
|
||||
"message0": "Clear current line in display %1 with adapter",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "DA",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"previousStatement": null,
|
||||
"nextStatement": null,
|
||||
"colour": 70,
|
||||
"tooltip": "This will clear the text on the currently selected line."
|
||||
},
|
||||
"create_addition_da_dp_link_clear": {
|
||||
"message0": "Clear display %1 with adapter",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "DA",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"previousStatement": null,
|
||||
"nextStatement": null,
|
||||
"colour": 70,
|
||||
"tooltip": "This will clear all the text on all lines."
|
||||
},
|
||||
"create_addition_da_dp_link_get_line": {
|
||||
"message0": "Get current line from display %1 with adapter",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "DA",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will return the currently selected line (starts at 1)."
|
||||
},
|
||||
"create_addition_da_dp_link_set_line": {
|
||||
"message0": "Goto line %1 in display %2 with adapter",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "LINE",
|
||||
"check": "Number"
|
||||
},
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "DA",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"previousStatement": null,
|
||||
"nextStatement": null,
|
||||
"colour": 70,
|
||||
"tooltip": "This will set the currently selected line to line (starts at 1)."
|
||||
},
|
||||
"create_addition_da_dp_link_get_max_line": {
|
||||
"message0": "Get max line in display %1 with adapter",
|
||||
"args0": [
|
||||
{
|
||||
"type": "input_value",
|
||||
"name": "DA",
|
||||
"check": "Peripheral"
|
||||
}
|
||||
],
|
||||
"output": "Number",
|
||||
"colour": 70,
|
||||
"tooltip": "This will return the max number of lines that can be displayable using the Digital Adapter (will always return 16)."
|
||||
}
|
||||
}
|
330
blocks/Create_Additions/generator.js
Normal file
330
blocks/Create_Additions/generator.js
Normal file
@ -0,0 +1,330 @@
|
||||
// this file not for generator only
|
||||
|
||||
const { luaGenerator } = require('blockly/lua');
|
||||
|
||||
// Check if luaGenerator.forBlock is defined and initialize if necessary
|
||||
if (!luaGenerator.forBlock) {
|
||||
luaGenerator.forBlock = {};
|
||||
}
|
||||
|
||||
// generator for Electric Motor
|
||||
|
||||
luaGenerator.forBlock['create_addition_electric_motor_set_speed'] = function(block, generator) {
|
||||
var motor = generator.valueToCode(block, 'MOTOR', generator.ORDER_ATOMIC);
|
||||
var speed = generator.valueToCode(block, 'RPM', generator.ORDER_ATOMIC);
|
||||
|
||||
return `${motor}.setSpeed(${speed})\n`;
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_electric_motor_stop'] = function(block, generator) {
|
||||
var motor = generator.valueToCode(block, 'MOTOR', generator.ORDER_ATOMIC);
|
||||
|
||||
return `${motor}.stop()\n`;
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_electric_motor_rotate'] = function(block, generator) {
|
||||
var motor = generator.valueToCode(block, 'MOTOR', generator.ORDER_ATOMIC);
|
||||
var degrees = generator.valueToCode(block, 'DEGREES', generator.ORDER_ATOMIC);
|
||||
var speed = generator.valueToCode(block, 'RPM', generator.ORDER_ATOMIC);
|
||||
|
||||
if (speed == "nil") {
|
||||
return [`${motor}.rotate(${degrees})`, luaGenerator.ORDER_NONE];
|
||||
} else {
|
||||
return [`${motor}.rotate(${degrees}, ${speed})`, luaGenerator.ORDER_NONE];
|
||||
}
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_electric_motor_translate'] = function(block, generator) {
|
||||
var motor = generator.valueToCode(block, 'MOTOR', generator.ORDER_ATOMIC);
|
||||
var tblock = generator.valueToCode(block, 'BLOCKS', generator.ORDER_ATOMIC);
|
||||
var speed = generator.valueToCode(block, 'RPM', generator.ORDER_ATOMIC);
|
||||
|
||||
if (speed == "nil") {
|
||||
return [`${motor}.translate(${tblock})`, luaGenerator.ORDER_NONE];
|
||||
} else {
|
||||
return [`${motor}.translate(${tblock}, ${speed})`, luaGenerator.ORDER_NONE];
|
||||
}
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_electric_motor_get_speed'] = function(block, generator) {
|
||||
var motor = generator.valueToCode(block, 'MOTOR', generator.ORDER_ATOMIC);
|
||||
|
||||
return [`${motor}.getSpeed()`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_electric_motor_get_stress_capacity'] = function(block, generator) {
|
||||
var motor = generator.valueToCode(block, 'MOTOR', generator.ORDER_ATOMIC);
|
||||
|
||||
return [`${motor}.getStressCapacity()`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_electric_motor_get_energy_consumption'] = function(block, generator) {
|
||||
var motor = generator.valueToCode(block, 'MOTOR', generator.ORDER_ATOMIC);
|
||||
|
||||
return [`${motor}.getEnergyConsumption()`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_electric_motor_get_max_input'] = function(block, generator) {
|
||||
var motor = generator.valueToCode(block, 'MOTOR', generator.ORDER_ATOMIC);
|
||||
|
||||
return [`${motor}.getMaxInsert()`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_electric_motor_get_max_output'] = function(block, generator) {
|
||||
var motor = generator.valueToCode(block, 'MOTOR', generator.ORDER_ATOMIC);
|
||||
|
||||
return [`${motor}.getMaxExtract()`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
// generator for Accumulator
|
||||
|
||||
luaGenerator.forBlock['create_addition_accumulator_get_energy'] = function(block, generator) {
|
||||
var accumulator = generator.valueToCode(block, 'ACCUMULATOR', generator.ORDER_ATOMIC);
|
||||
|
||||
return [`${accumulator}.getEnergy()`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_accumulator_get_capacity'] = function(block, generator) {
|
||||
var accumulator = generator.valueToCode(block, 'ACCUMULATOR', generator.ORDER_ATOMIC);
|
||||
|
||||
return [`${accumulator}.getCapacity()`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_accumulator_get_percent'] = function(block, generator) {
|
||||
var accumulator = generator.valueToCode(block, 'ACCUMULATOR', generator.ORDER_ATOMIC);
|
||||
|
||||
return [`${accumulator}.getPercent()`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_accumulator_get_max_input'] = function(block, generator) {
|
||||
var accumulator = generator.valueToCode(block, 'ACCUMULATOR', generator.ORDER_ATOMIC);
|
||||
|
||||
return [`${accumulator}.getMaxInsert()`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_accumulator_get_max_output'] = function(block, generator) {
|
||||
var accumulator = generator.valueToCode(block, 'ACCUMULATOR', generator.ORDER_ATOMIC);
|
||||
|
||||
return [`${accumulator}.getMaxExtract()`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_accumulator_get_height'] = function(block, generator) {
|
||||
var accumulator = generator.valueToCode(block, 'ACCUMULATOR', generator.ORDER_ATOMIC);
|
||||
|
||||
return [`${accumulator}.getHeight()`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_accumulator_get_width'] = function(block, generator) {
|
||||
var accumulator = generator.valueToCode(block, 'ACCUMULATOR', generator.ORDER_ATOMIC);
|
||||
|
||||
return [`${accumulator}.getWidth()`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
// generator for Portable Energy Interface (PEI)
|
||||
|
||||
luaGenerator.forBlock['create_addition_pei_get_energy'] = function(block, generator) {
|
||||
var pei = generator.valueToCode(block, 'PEI', generator.ORDER_ATOMIC);
|
||||
|
||||
return [`${pei}.getEnergy()`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_pei_get_capacity'] = function(block, generator) {
|
||||
var pei = generator.valueToCode(block, 'PEI', generator.ORDER_ATOMIC);
|
||||
|
||||
return [`${pei}.getCapacity()`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_pei_is_connected'] = function(block, generator) {
|
||||
var pei = generator.valueToCode(block, 'PEI', generator.ORDER_ATOMIC);
|
||||
|
||||
return [`${pei}.isConnected()`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_pei_get_max_input'] = function(block, generator) {
|
||||
var pei = generator.valueToCode(block, 'PEI', generator.ORDER_ATOMIC);
|
||||
|
||||
return [`${pei}.getMaxInsert()`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_pei_get_max_output'] = function(block, generator) {
|
||||
var pei = generator.valueToCode(block, 'PEI', generator.ORDER_ATOMIC);
|
||||
|
||||
return [`${pei}.getMaxExtract()`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
// generator for Redstone Relay
|
||||
|
||||
luaGenerator.forBlock['create_addition_relay_get_max_input'] = function(block, generator) {
|
||||
var relay = generator.valueToCode(block, 'RELAY', generator.ORDER_ATOMIC);
|
||||
|
||||
return [`${relay}.getMaxInsert()`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_relay_get_max_output'] = function(block, generator) {
|
||||
var relay = generator.valueToCode(block, 'RELAY', generator.ORDER_ATOMIC);
|
||||
|
||||
return [`${relay}.getMaxExtract()`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_relay_get_throughput'] = function(block, generator) {
|
||||
var relay = generator.valueToCode(block, 'RELAY', generator.ORDER_ATOMIC);
|
||||
|
||||
return [`${relay}.getThroughput()`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_relay_is_powered'] = function(block, generator) {
|
||||
var relay = generator.valueToCode(block, 'RELAY', generator.ORDER_ATOMIC);
|
||||
|
||||
return [`${relay}.isPowered()`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
// Digital Adapter | Rotational Speed Controller
|
||||
|
||||
luaGenerator.forBlock['create_addition_da_rotational_speed_control_set_target_speed'] = function(block, generator) {
|
||||
var speed = generator.valueToCode(block, 'RPM', generator.ORDER_ATOMIC);
|
||||
var adapter = generator.valueToCode(block, 'DA', generator.ORDER_ATOMIC);
|
||||
var side = block.getFieldValue('SIDE');
|
||||
|
||||
return `${adapter}.setTargetSpeed("${side}", ${speed})\n`;
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_da_rotational_speed_control_get_target_speed'] = function(block, generator) {
|
||||
var adapter = generator.valueToCode(block, 'DA', generator.ORDER_ATOMIC);
|
||||
var side = block.getFieldValue('SIDE');
|
||||
|
||||
return [`${adapter}.getTargetSpeed("${side}")`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
// Digital Adapter | Stressometer
|
||||
|
||||
luaGenerator.forBlock['create_addition_da_stressometer_get_kinetic_stress'] = function(block, generator) {
|
||||
var adapter = generator.valueToCode(block, 'DA', generator.ORDER_ATOMIC);
|
||||
var side = block.getFieldValue('SIDE');
|
||||
|
||||
return [`${adapter}.getKineticStress("${side}")`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_da_stressometer_get_kinetic_capacity'] = function(block, generator) {
|
||||
var adapter = generator.valueToCode(block, 'DA', generator.ORDER_ATOMIC);
|
||||
var side = block.getFieldValue('SIDE');
|
||||
|
||||
return [`${adapter}.getKineticSpeed("${side}")`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
// Digital Adapter | Speedometer
|
||||
|
||||
luaGenerator.forBlock['create_addition_da_speedometer_get_kinetic_speed'] = function(block, generator) {
|
||||
var adapter = generator.valueToCode(block, 'DA', generator.ORDER_ATOMIC);
|
||||
var side = block.getFieldValue('SIDE');
|
||||
|
||||
return [`${adapter}.getKineticSpeed("${side}")`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_da_speedometer_get_kinetic_max_speed'] = function(block, generator) {
|
||||
var adapter = generator.valueToCode(block, 'DA', generator.ORDER_ATOMIC);
|
||||
|
||||
return [`${adapter}.getKineticTopSpeed()`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
// Digital Adapter | Pulleys
|
||||
|
||||
luaGenerator.forBlock['create_addition_da_pulleys_get_pulleys_distance'] = function(block, generator) {
|
||||
var adapter = generator.valueToCode(block, 'DA', generator.ORDER_ATOMIC);
|
||||
var side = block.getFieldValue('SIDE');
|
||||
|
||||
return [`${adapter}.getPulleyDistance("${side}")`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
// Digital Adapter | Elevator Pulley
|
||||
|
||||
luaGenerator.forBlock['create_addition_da_elevator_pulley_get_elevator_floor'] = function(block, generator) {
|
||||
var adapter = generator.valueToCode(block, 'DA', generator.ORDER_ATOMIC);
|
||||
var side = block.getFieldValue('SIDE');
|
||||
|
||||
return [`${adapter}.getElevatorFloor("${side}")`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_da_elevator_pulley_get_elevator_floors'] = function(block, generator) {
|
||||
var adapter = generator.valueToCode(block, 'DA', generator.ORDER_ATOMIC);
|
||||
var side = block.getFieldValue('SIDE');
|
||||
|
||||
return [`${adapter}.getElevatorFloors("${side}")`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_da_elevator_pulley_get_elevator_floor_name'] = function(block, generator) {
|
||||
var floorindex = generator.valueToCode(block, 'INDEX', generator.ORDER_ATOMIC);
|
||||
var adapter = generator.valueToCode(block, 'DA', generator.ORDER_ATOMIC);
|
||||
var side = block.getFieldValue('SIDE');
|
||||
|
||||
return [`${adapter}.getElevatorFloorName("${side}", ${floorindex})`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_da_elevator_pulley_goto_elevator_floor_name'] = function(block, generator) {
|
||||
var floorindex = generator.valueToCode(block, 'INDEX', generator.ORDER_ATOMIC);
|
||||
var adapter = generator.valueToCode(block, 'DA', generator.ORDER_ATOMIC);
|
||||
var side = block.getFieldValue('SIDE');
|
||||
|
||||
if (block.outputConnection && block.outputConnection.targetConnection) {
|
||||
return [`${adapter}.gotoElevatorFloor("${side}", ${floorindex})`, luaGenerator.ORDER_NONE];
|
||||
} else {
|
||||
return `${adapter}.gotoElevatorFloor("${side}", ${floorindex})\n`;
|
||||
}
|
||||
};
|
||||
|
||||
// Digital Adapter | Mechanical Piston
|
||||
|
||||
luaGenerator.forBlock['create_addition_da_mechanical_piston_get_piston_distance'] = function(block, generator) {
|
||||
var adapter = generator.valueToCode(block, 'DA', generator.ORDER_ATOMIC);
|
||||
var side = block.getFieldValue('SIDE');
|
||||
|
||||
return [`${adapter}.getPistonDistance("${side}")`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
// Digital Adapter | Mechanical Bearing
|
||||
|
||||
luaGenerator.forBlock['create_addition_da_mechanical_bearing_get_bearing_angle'] = function(block, generator) {
|
||||
var adapter = generator.valueToCode(block, 'DA', generator.ORDER_ATOMIC);
|
||||
var side = block.getFieldValue('SIDE');
|
||||
|
||||
return [`${adapter}.getBearingAngle("${side}")`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
// Digital Adapter | Display Link
|
||||
|
||||
luaGenerator.forBlock['create_addition_da_dp_link_print'] = function(block, generator) {
|
||||
var text = generator.valueToCode(block, 'TEXT', generator.ORDER_ATOMIC);
|
||||
var adapter = generator.valueToCode(block, 'DA', generator.ORDER_ATOMIC);
|
||||
|
||||
return `${adapter}.print("${text}")\n`;
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_da_dp_link_clear_line'] = function(block, generator) {
|
||||
var adapter = generator.valueToCode(block, 'DA', generator.ORDER_ATOMIC);
|
||||
|
||||
return `${adapter}.clearLine()\n`;
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_da_dp_link_clear'] = function(block, generator) {
|
||||
var adapter = generator.valueToCode(block, 'DA', generator.ORDER_ATOMIC);
|
||||
|
||||
return `${adapter}.clear()\n`;
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_da_dp_link_get_line'] = function(block, generator) {
|
||||
var adapter = generator.valueToCode(block, 'DA', generator.ORDER_ATOMIC);
|
||||
|
||||
return [`${adapter}.getLine()`, luaGenerator.ORDER_NONE];
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_da_dp_link_set_line'] = function(block, generator) {
|
||||
var line = generator.valueToCode(block, 'LINE', generator.ORDER_ATOMIC);
|
||||
var adapter = generator.valueToCode(block, 'DA', generator.ORDER_ATOMIC);
|
||||
|
||||
return `${adapter}.setLine()\n`;
|
||||
};
|
||||
|
||||
luaGenerator.forBlock['create_addition_da_dp_link_get_max_line'] = function(block, generator) {
|
||||
var adapter = generator.valueToCode(block, 'DA', generator.ORDER_ATOMIC);
|
||||
|
||||
return [`${adapter}.getMaxLines()`, luaGenerator.ORDER_NONE];
|
||||
};
|
BIN
blocks/Create_Additions/icon.png
Normal file
BIN
blocks/Create_Additions/icon.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 58 KiB |
22
blocks/Create_Additions/index.json
Normal file
22
blocks/Create_Additions/index.json
Normal file
@ -0,0 +1,22 @@
|
||||
{
|
||||
"name": "Create Crafts & Additions",
|
||||
"author": "DPSoftware Foundation",
|
||||
"description": "https://www.curseforge.com/minecraft/mc-mods/createaddition",
|
||||
"version": "1.0",
|
||||
"category": "Create",
|
||||
"keyword": "create mod",
|
||||
"license": "GPL-3.0-or-later",
|
||||
"peripherals": true,
|
||||
"library": false,
|
||||
"require_network": false,
|
||||
"dependencies": {},
|
||||
"design_for_computer": {
|
||||
"basic": true,
|
||||
"adv": true,
|
||||
"command": true,
|
||||
"pocket": false,
|
||||
"advpocket": false,
|
||||
"turtle": true,
|
||||
"advturtle": true
|
||||
}
|
||||
}
|
125
blocks/Create_Additions/toolbox.xml
Normal file
125
blocks/Create_Additions/toolbox.xml
Normal file
@ -0,0 +1,125 @@
|
||||
<xml id="toolbox" style="display: none;">
|
||||
<category name="Create Additions" colour="70">
|
||||
<label text="Electric Motor"></label>
|
||||
<block type="create_addition_electric_motor_set_speed">
|
||||
<value name="RPM">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">32</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="create_addition_electric_motor_stop"></block>
|
||||
<block type="create_addition_electric_motor_rotate">
|
||||
<value name="DEGREES">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">90</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="RPM">
|
||||
<shadow type="logic_null"></shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="create_addition_electric_motor_translate">
|
||||
<value name="BLOCKS">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">1</field>
|
||||
</shadow>
|
||||
</value>
|
||||
<value name="RPM">
|
||||
<shadow type="logic_null"></shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="create_addition_electric_motor_get_speed"></block>
|
||||
<block type="create_addition_electric_motor_get_stress_capacity"></block>
|
||||
<block type="create_addition_electric_motor_get_energy_consumption"></block>
|
||||
<block type="create_addition_electric_motor_get_max_input"></block>
|
||||
<block type="create_addition_electric_motor_get_max_output"></block>
|
||||
|
||||
<label text="Accumulator"></label>
|
||||
<block type="create_addition_accumulator_get_energy"></block>
|
||||
<block type="create_addition_accumulator_get_capacity"></block>
|
||||
<block type="create_addition_accumulator_get_percent"></block>
|
||||
<block type="create_addition_accumulator_get_max_input"></block>
|
||||
<block type="create_addition_accumulator_get_max_output"></block>
|
||||
<block type="create_addition_accumulator_get_height"></block>
|
||||
<block type="create_addition_accumulator_get_width"></block>
|
||||
|
||||
<label text="Portable Energy Interface (PEI)"></label>
|
||||
<block type="create_addition_pei_get_energy"></block>
|
||||
<block type="create_addition_pei_get_capacity"></block>
|
||||
<block type="create_addition_pei_is_connected"></block>
|
||||
<block type="create_addition_pei_get_max_input"></block>
|
||||
<block type="create_addition_pei_get_max_output"></block>
|
||||
|
||||
<label text="Redstone Relay"></label>
|
||||
<block type="create_addition_relay_get_max_input"></block>
|
||||
<block type="create_addition_relay_get_max_output"></block>
|
||||
<block type="create_addition_relay_get_throughput"></block>
|
||||
<block type="create_addition_relay_is_powered"></block>
|
||||
|
||||
<label text="Digital Adapter | Rotational Speed Controller"></label>
|
||||
<block type="create_addition_da_rotational_speed_control_set_target_speed">
|
||||
<value name="RPM">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">32</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="create_addition_da_rotational_speed_control_get_target_speed"></block>
|
||||
|
||||
<label text="Digital Adapter | Stressometer"></label>
|
||||
<block type="create_addition_da_stressometer_get_kinetic_stress"></block>
|
||||
<block type="create_addition_da_stressometer_get_kinetic_capacity"></block>
|
||||
|
||||
<label text="Digital Adapter | Speedometer"></label>
|
||||
<block type="create_addition_da_speedometer_get_kinetic_speed"></block>
|
||||
<block type="create_addition_da_speedometer_get_kinetic_max_speed"></block>
|
||||
|
||||
<label text="Digital Adapter | Pulleys"></label>
|
||||
<block type="create_addition_da_pulleys_get_pulleys_distance"></block>
|
||||
|
||||
<label text="Digital Adapter | Elevator Pulley"></label>
|
||||
<block type="create_addition_da_elevator_pulley_get_elevator_floor"></block>
|
||||
<block type="create_addition_da_elevator_pulley_get_elevator_floors"></block>
|
||||
<block type="create_addition_da_elevator_pulley_get_elevator_floor_name">
|
||||
<value name="INDEX">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">1</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="create_addition_da_elevator_pulley_goto_elevator_floor_name">
|
||||
<value name="INDEX">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">1</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
|
||||
<label text="Digital Adapter | Mechanical Piston"></label>
|
||||
<block type="create_addition_da_mechanical_piston_get_piston_distance"></block>
|
||||
|
||||
<label text="Digital Adapter | Mechanical Bearing"></label>
|
||||
<block type="create_addition_da_mechanical_bearing_get_bearing_angle"></block>
|
||||
|
||||
<label text="Digital Adapter | Display Link"></label>
|
||||
<block type="create_addition_da_dp_link_print">
|
||||
<value name="TEXT">
|
||||
<shadow type="text">
|
||||
<field name="TEXT">Hello, world!</field> <!-- Default value -->
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="create_addition_da_dp_link_clear_line"></block>
|
||||
<block type="create_addition_da_dp_link_clear"></block>
|
||||
<block type="create_addition_da_dp_link_get_line"></block>
|
||||
<block type="create_addition_da_dp_link_set_line">
|
||||
<value name="LINE">
|
||||
<shadow type="math_number">
|
||||
<field name="NUM">1</field>
|
||||
</shadow>
|
||||
</value>
|
||||
</block>
|
||||
<block type="create_addition_da_dp_link_get_max_line"></block>
|
||||
</category>
|
||||
</xml>
|
Binary file not shown.
117
index.js
117
index.js
@ -11,16 +11,31 @@ const logger = pino(pretty())
|
||||
|
||||
process.env['ELECTRON_DISABLE_SECURITY_WARNINGS'] = 'true';
|
||||
|
||||
let currentprojectpath = null;
|
||||
let currentprojectname = null;
|
||||
let currentprojectopen = false;
|
||||
let appexiting = false;
|
||||
let appreloading = false;
|
||||
let currentworkspacechange = false;
|
||||
let isopennewproject = false;
|
||||
var currentprojectpath = null;
|
||||
var currentprojectname = null;
|
||||
var currentprojectopen = false;
|
||||
var appexiting = false;
|
||||
var appreloading = false;
|
||||
var currentworkspacechange = false;
|
||||
var isopennewproject = false;
|
||||
|
||||
var appstarted = false;
|
||||
var version;
|
||||
|
||||
let appstarted = false;
|
||||
try {
|
||||
// Read package.json synchronously
|
||||
const data = fs.readFileSync('package.json', 'utf8');
|
||||
|
||||
// Parse JSON
|
||||
const packageJson = JSON.parse(data);
|
||||
|
||||
// Get project version
|
||||
version = packageJson.version;
|
||||
|
||||
console.log("Project version:", version);
|
||||
} catch (err) {
|
||||
console.error("Error reading package.json:", err);
|
||||
}
|
||||
|
||||
app.whenReady().then(() => {
|
||||
logger.info("Initializing splash window...")
|
||||
@ -65,12 +80,15 @@ app.whenReady().then(() => {
|
||||
dialog.showErrorBox("Error on startup", "Can't find index.html");
|
||||
}
|
||||
}
|
||||
win.setTitle(`ccIDE`)
|
||||
win.setTitle(`ccIDE v${version}`)
|
||||
|
||||
ipc.once('ready', () => {
|
||||
splash.webContents.send("isloaded")
|
||||
splash.webContents.send("change-status", "Thanks for using software from DPSoftware.")
|
||||
splash.webContents.send("change-title", `ccIDE v${version}`)
|
||||
logger.info("Ready!")
|
||||
if (splash) {
|
||||
splash.close();
|
||||
splash.hide();
|
||||
}
|
||||
win.show();
|
||||
//win.maximize();
|
||||
@ -111,7 +129,7 @@ app.whenReady().then(() => {
|
||||
appreloading = false;
|
||||
isopennewproject = false;
|
||||
if (isloaded) {
|
||||
win.setTitle(`ccIDE`)
|
||||
win.setTitle(`ccIDE v${version}`)
|
||||
win.reload();
|
||||
}
|
||||
}
|
||||
@ -183,7 +201,7 @@ app.whenReady().then(() => {
|
||||
currentprojectname = path.basename(result.filePaths[0]);
|
||||
currentprojectopen = true;
|
||||
|
||||
win.setTitle(`${currentprojectname} | ccIDE`)
|
||||
win.setTitle(`${currentprojectname} | ccIDE v${version}`)
|
||||
});
|
||||
|
||||
}
|
||||
@ -218,7 +236,7 @@ app.whenReady().then(() => {
|
||||
currentprojectname = path.basename(result.filePaths[0]);
|
||||
currentprojectopen = true;
|
||||
|
||||
win.setTitle(`${currentprojectname} | ccIDE`)
|
||||
win.setTitle(`${currentprojectname} | ccIDE v${version}`)
|
||||
});
|
||||
|
||||
}
|
||||
@ -288,6 +306,16 @@ app.whenReady().then(() => {
|
||||
click: () => {
|
||||
win.webContents.send("open-about")
|
||||
}
|
||||
},
|
||||
{
|
||||
label: 'Splash Screen',
|
||||
click: () => {
|
||||
if (!splash.isVisible()) {
|
||||
splash.show();
|
||||
} else {
|
||||
splash.hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
@ -348,7 +376,7 @@ app.whenReady().then(() => {
|
||||
|
||||
win.webContents.send('workspace-saved', true);
|
||||
|
||||
win.setTitle(`${currentprojectname} | ccIDE`)
|
||||
win.setTitle(`${currentprojectname} | ccIDE v${version}`)
|
||||
if (currentworkspacechange) {
|
||||
currentworkspacechange = false;
|
||||
}
|
||||
@ -373,7 +401,7 @@ app.whenReady().then(() => {
|
||||
|
||||
win.webContents.send('workspace-saved', true);
|
||||
|
||||
win.setTitle(`${currentprojectname} | ccIDE`)
|
||||
win.setTitle(`${currentprojectname} | ccIDE v${version}`)
|
||||
|
||||
if (currentworkspacechange) {
|
||||
currentworkspacechange = false;
|
||||
@ -408,7 +436,7 @@ app.whenReady().then(() => {
|
||||
currentprojectname = path.basename(result.filePaths[0]);
|
||||
currentprojectopen = true;
|
||||
|
||||
win.setTitle(`${currentprojectname} | ccIDE`)
|
||||
win.setTitle(`${currentprojectname} | ccIDE v${version}`)
|
||||
});
|
||||
|
||||
}
|
||||
@ -444,41 +472,44 @@ app.whenReady().then(() => {
|
||||
});
|
||||
|
||||
ipc.on('workspace-notsave', (event) => {
|
||||
win.setTitle(`${currentprojectname}* | ccIDE`)
|
||||
win.setTitle(`${currentprojectname}* | ccIDE v${version}`)
|
||||
currentworkspacechange = true;
|
||||
})
|
||||
ipc.on('workspace-unsave', (event) => {
|
||||
currentworkspacechange = true;
|
||||
})
|
||||
})
|
||||
|
||||
|
||||
app.on("close", function(e) {
|
||||
console.log("Close event triggered");
|
||||
if (currentprojectopen) {
|
||||
const result = dialog.showMessageBoxSync({
|
||||
type: 'question',
|
||||
buttons: ['Save', 'Don\'t Save', 'Cancel'],
|
||||
defaultId: 2,
|
||||
title: 'Save Changes',
|
||||
message: "Your project is not saved",
|
||||
});
|
||||
if (result === 1) {
|
||||
// Don't save, continue closing
|
||||
win = null;
|
||||
} else if (result === 0) {
|
||||
// Save and then quit
|
||||
appexiting = true;
|
||||
win.webContents.send('save-workspace-request');
|
||||
// Listen for the close event of the main window
|
||||
win.on('close', (event) => {
|
||||
event.preventDefault()
|
||||
if (currentprojectopen) {
|
||||
const result = dialog.showMessageBoxSync({
|
||||
type: 'question',
|
||||
buttons: ['Save', 'Don\'t Save', 'Cancel'],
|
||||
defaultId: 2,
|
||||
title: 'Save Changes',
|
||||
message: "Your project is not saved",
|
||||
});
|
||||
if (result === 1) {
|
||||
// Don't save, continue closing
|
||||
win.close();
|
||||
} else if (result === 0) {
|
||||
// Save and then quit
|
||||
appexiting = true;
|
||||
win.webContents.send('save-workspace-request');
|
||||
}
|
||||
} else {
|
||||
// Cancel the close operation
|
||||
e.preventDefault();
|
||||
win.destroy();
|
||||
}
|
||||
} else {
|
||||
// No unsaved changes, continue closing
|
||||
win = null;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
win.on("closed", () => {
|
||||
if (splash) {
|
||||
splash.close()
|
||||
}
|
||||
})
|
||||
|
||||
})
|
||||
|
||||
app.on('window-all-closed', () => {
|
||||
if (process.platform !== 'darwin') {
|
||||
|
@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "ccide",
|
||||
"version": "1.1",
|
||||
"version": "1.3",
|
||||
"description": "ComputerCraft mod virtual lua IDE",
|
||||
"main": "index.js",
|
||||
"scripts": {
|
||||
|
@ -3,7 +3,6 @@
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>ccIDE</title>
|
||||
<link href="https://fonts.googleapis.com/css2?family=Noto+Sans:wght@400;700&display=swap" rel="stylesheet">
|
||||
<script>
|
||||
const bootstrap = require('bootstrap')
|
||||
@ -15,9 +14,11 @@
|
||||
<body>
|
||||
<!-- Navigation bar -->
|
||||
<nav id="navbar">
|
||||
<!--
|
||||
<button class="navbar-button" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="Computer Types" style="background-color: #0087bd;">
|
||||
<svg viewBox="0 0 24 24"><path d="M6 4h12v1h3v2h-3v2h3v2h-3v2h3v2h-3v2h3v2h-3v1H6v-1H3v-2h3v-2H3v-2h3v-2H3V9h3V7H3V5h3V4m5 11v3h1v-3h-1m2 0v3h1v-3h-1m2 0v3h1v-3h-1z" /></svg>
|
||||
</button>
|
||||
-->
|
||||
<button class="navbar-button" data-bs-toggle="tooltip" data-bs-placement="bottom" data-bs-title="Packages Managers" style="background-color: #0087bd;" onclick="openlibraryselect()">
|
||||
<svg viewBox="0 0 24 24"><path d="M21 16.5c0 .38-.21.71-.53.88l-7.9 4.44c-.16.12-.36.18-.57.18-.21 0-.41-.06-.57-.18l-7.9-4.44A.991.991 0 0 1 3 16.5v-9c0-.38.21-.71.53-.88l7.9-4.44c.16-.12.36-.18.57-.18.21 0 .41.06.57.18l7.9 4.44c.32.17.53.5.53.88v9M12 4.15l-1.89 1.07L16 8.61l1.96-1.11L12 4.15M6.04 7.5 12 10.85l1.96-1.1-5.88-3.4L6.04 7.5M5 15.91l6 3.38v-6.71L5 9.21v6.7m14 0v-6.7l-6 3.37v6.71l6-3.38z" /></svg>
|
||||
</button>
|
||||
|
@ -60,8 +60,8 @@
|
||||
<body>
|
||||
<div id="splash-content">
|
||||
<img src="../assets/ccIDEIcon.ico" alt="ccIDE Icon">
|
||||
<h1>Loading ccIDE...</h1>
|
||||
<div class="progress-bar">
|
||||
<h1 id="title">Loading ccIDE...</h1>
|
||||
<div class="progress-bar" id="progressbar">
|
||||
<div class="progress-bar-value"></div>
|
||||
</div>
|
||||
<h6 id="status">Initializing...</h6>
|
||||
@ -76,6 +76,15 @@
|
||||
ipc.on('change-status', (event, status) => {
|
||||
document.getElementById('status').textContent = status;
|
||||
});
|
||||
|
||||
ipc.on('change-title', (event, title) => {
|
||||
document.getElementById('title').textContent = title;
|
||||
});
|
||||
|
||||
ipc.on('isloaded', (event) => {
|
||||
document.getElementById('progressbar').remove();
|
||||
});
|
||||
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
|
Loading…
x
Reference in New Issue
Block a user