Initial commit
This commit is contained in:
133
Torque/SDK/example/starter.fps/server/scripts/doors/door.cs
Normal file
133
Torque/SDK/example/starter.fps/server/scripts/doors/door.cs
Normal file
@@ -0,0 +1,133 @@
|
||||
//Door.cs
|
||||
//writen by Ramen Sama
|
||||
|
||||
|
||||
datablock AudioProfile(doorOpenSound)
|
||||
{
|
||||
filename = "~/data/sound/doorOpen.wav";
|
||||
description = AudioClose3d;
|
||||
preload = false;
|
||||
};
|
||||
|
||||
datablock AudioProfile(doorCloseSound)
|
||||
{
|
||||
filename = "~/data/sound/doorClose.wav";
|
||||
description = AudioClose3d;
|
||||
preload = false;
|
||||
};
|
||||
|
||||
datablock StaticShapeData(door){
|
||||
category = "Doors";
|
||||
//Points to the DTS object change this for your project
|
||||
shapeFile = "~/data/shapes/door/door_redZone.dts";
|
||||
position = "0 0 0";
|
||||
Scale="1 1 1";
|
||||
emap = true;
|
||||
receiveSunLight = "1";
|
||||
};
|
||||
|
||||
//Called when you touch the door
|
||||
function door::onCollision(%this,%door,%col){
|
||||
if (!%door.open){
|
||||
%door.open=true;
|
||||
%door.setthreaddir(0,"true");
|
||||
%door.playthread(0,"open");
|
||||
serverPlay3D(doorOpenSound,%col.getTransform());
|
||||
%this.schedule(2000, close, %door,%col);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function door::close(%this,%door,%col){
|
||||
|
||||
//does a distance check between the door and what hit it last
|
||||
//I have it set for 2... but you can use whatever you like
|
||||
|
||||
%dist=VectorDist(%col.getposition(), %door.getposition());
|
||||
if (%dist > 2){
|
||||
%door.setthreaddir(0,"false");
|
||||
serverPlay3D(doorCloseSound,%col.getTransform());
|
||||
%door.open=false;
|
||||
}
|
||||
else
|
||||
//if the player is too close, just go ahead and start the timer again
|
||||
%this.schedule(2000, close, %door,%col);
|
||||
}
|
||||
|
||||
function door::onSearch(%this,%obj,%source){
|
||||
//Searching will do the same as trying to open it
|
||||
%this.oncollision(%obj,%source);
|
||||
}
|
||||
|
||||
|
||||
function door::make(){
|
||||
|
||||
%pos = $wp.getnodetransform("door");
|
||||
%door = new staticshape(){ dataBlock = door; };
|
||||
%door.settransform(%pos);
|
||||
%door.open=false;
|
||||
%door.searchable=true;
|
||||
|
||||
new Trigger() {
|
||||
position = %pos = $wp.getnodeposition("exit");
|
||||
rotation = "1 0 0 0";
|
||||
scale = "3 1.5 3";
|
||||
dataBlock = "ExitTrigger";
|
||||
polyhedron = "0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
datablock TriggerData(exitTrigger)
|
||||
{
|
||||
tickPeriodMS = 100;
|
||||
};
|
||||
|
||||
function ExitTrigger::onEnterTrigger(%this,%trigger,%obj)
|
||||
{
|
||||
serverconnection.setblackout(true,500);
|
||||
$canmove=false;
|
||||
%loc = $wp.getnodetransform("start");
|
||||
|
||||
|
||||
//Hack for battle
|
||||
schedule(700,0,teleport,$player,%loc);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function ExitTrigger::oncreate(%this,%trigger,%obj)
|
||||
{
|
||||
error("I've been added to the world");
|
||||
|
||||
}
|
||||
|
||||
|
||||
function teleport(%who, %where){
|
||||
%who.settransform(%where);
|
||||
|
||||
|
||||
//Hack for battle start
|
||||
battleprep();
|
||||
serverconnection.setblackout(false,700);
|
||||
return;
|
||||
|
||||
|
||||
$canmove=true;
|
||||
}
|
||||
|
||||
function ExitTrigger::onLeaveTrigger(%this,%trigger,%obj)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function ExitTrigger::onTickTrigger(%this,%trigger)
|
||||
{
|
||||
}
|
||||
|
||||
BIN
Torque/SDK/example/starter.fps/server/scripts/doors/door.cs.dso
Normal file
BIN
Torque/SDK/example/starter.fps/server/scripts/doors/door.cs.dso
Normal file
Binary file not shown.
118
Torque/SDK/example/starter.fps/server/scripts/doors/doorGrey1.cs
Normal file
118
Torque/SDK/example/starter.fps/server/scripts/doors/doorGrey1.cs
Normal file
@@ -0,0 +1,118 @@
|
||||
//Door.cs
|
||||
//writen by Ramen Sama
|
||||
|
||||
datablock StaticShapeData(doorgrey1){
|
||||
category = "Doors";
|
||||
//Points to the DTS object change this for your project
|
||||
shapeFile = "~/data/shapes/door/metaldoorSec1.dts";
|
||||
position = "0 0 0";
|
||||
Scale="1 1 1";
|
||||
emap = true;
|
||||
receiveSunLight = "1";
|
||||
};
|
||||
|
||||
//Called when you touch the door
|
||||
function doorgrey1::onCollision(%this,%door,%col){
|
||||
if (!%door.open){
|
||||
%door.open=true;
|
||||
%door.setthreaddir(0,"true");
|
||||
%door.playthread(0,"open");
|
||||
serverPlay3D(doorMetalOpenSound,%col.getTransform());
|
||||
%this.schedule(2000, close, %door,%col);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function doorgrey1::close(%this,%door,%col){
|
||||
|
||||
//does a distance check between the door and what hit it last
|
||||
//I have it set for 2... but you can use whatever you like
|
||||
|
||||
%dist=VectorDist(%col.getposition(), %door.getposition());
|
||||
if (%dist > 2){
|
||||
%door.setthreaddir(0,"false");
|
||||
serverPlay3D(doorMetalCloseSound,%col.getTransform());
|
||||
%door.open=false;
|
||||
}
|
||||
else
|
||||
//if the player is too close, just go ahead and start the timer again
|
||||
%this.schedule(2000, close, %door,%col);
|
||||
}
|
||||
|
||||
function doorgrey1::onSearch(%this,%obj,%source){
|
||||
//Searching will do the same as trying to open it
|
||||
%this.oncollision(%obj,%source);
|
||||
}
|
||||
|
||||
|
||||
function doorgrey1::make(){
|
||||
|
||||
%pos = $wp.getnodetransform("doorgrey1");
|
||||
%door = new staticshape(){ dataBlock = doorgrey1; };
|
||||
%door.settransform(%pos);
|
||||
%door.open=false;
|
||||
%door.searchable=true;
|
||||
|
||||
new Trigger() {
|
||||
position = %pos = $wp.getnodeposition("exit");
|
||||
rotation = "1 0 0 0";
|
||||
scale = "3 1.5 3";
|
||||
dataBlock = "ExitTrigger";
|
||||
polyhedron = "0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
datablock TriggerData(exitTrigger)
|
||||
{
|
||||
tickPeriodMS = 100;
|
||||
};
|
||||
|
||||
function ExitTrigger::onEnterTrigger(%this,%trigger,%obj)
|
||||
{
|
||||
serverconnection.setblackout(true,500);
|
||||
$canmove=false;
|
||||
%loc = $wp.getnodetransform("start");
|
||||
|
||||
|
||||
//Hack for battle
|
||||
schedule(700,0,teleport,$player,%loc);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function ExitTrigger::oncreate(%this,%trigger,%obj)
|
||||
{
|
||||
error("I've been added to the world");
|
||||
|
||||
}
|
||||
|
||||
|
||||
function teleport(%who, %where){
|
||||
%who.settransform(%where);
|
||||
|
||||
|
||||
//Hack for battle start
|
||||
battleprep();
|
||||
serverconnection.setblackout(false,700);
|
||||
return;
|
||||
|
||||
|
||||
$canmove=true;
|
||||
}
|
||||
|
||||
function ExitTrigger::onLeaveTrigger(%this,%trigger,%obj)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function ExitTrigger::onTickTrigger(%this,%trigger)
|
||||
{
|
||||
}
|
||||
|
||||
132
Torque/SDK/example/starter.fps/server/scripts/doors/doorMetal.cs
Normal file
132
Torque/SDK/example/starter.fps/server/scripts/doors/doorMetal.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
//Door.cs
|
||||
//writen by Ramen Sama
|
||||
|
||||
datablock AudioProfile(doorMetalOpenSound)
|
||||
{
|
||||
filename = "~/data/sound/doorGrate.wav";
|
||||
description = AudioClose3d;
|
||||
preload = false;
|
||||
};
|
||||
|
||||
datablock AudioProfile(doorMetalCloseSound)
|
||||
{
|
||||
filename = "~/data/sound/doorGrate.wav";
|
||||
description = AudioClose3d;
|
||||
preload = false;
|
||||
};
|
||||
|
||||
datablock StaticShapeData(doorMetal){
|
||||
category = "Doors";
|
||||
//Points to the DTS object change this for your project
|
||||
shapeFile = "~/data/shapes/door/metalGrill.dts";
|
||||
position = "0 0 0";
|
||||
Scale="1 1 1";
|
||||
emap = true;
|
||||
receiveSunLight = "1";
|
||||
};
|
||||
|
||||
//Called when you touch the door
|
||||
function doorMetal::onCollision(%this,%door,%col){
|
||||
if (!%door.open){
|
||||
%door.open=true;
|
||||
%door.setthreaddir(0,"true");
|
||||
%door.playthread(0,"open");
|
||||
serverPlay3D(doorMetalOpenSound,%col.getTransform());
|
||||
%this.schedule(2000, close, %door,%col);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function doorMetal::close(%this,%door,%col){
|
||||
|
||||
//does a distance check between the door and what hit it last
|
||||
//I have it set for 2... but you can use whatever you like
|
||||
|
||||
%dist=VectorDist(%col.getposition(), %door.getposition());
|
||||
if (%dist > 2){
|
||||
%door.setthreaddir(0,"false");
|
||||
serverPlay3D(doorMetalCloseSound,%col.getTransform());
|
||||
%door.open=false;
|
||||
}
|
||||
else
|
||||
//if the player is too close, just go ahead and start the timer again
|
||||
%this.schedule(2000, close, %door,%col);
|
||||
}
|
||||
|
||||
function doorMetal::onSearch(%this,%obj,%source){
|
||||
//Searching will do the same as trying to open it
|
||||
%this.oncollision(%obj,%source);
|
||||
}
|
||||
|
||||
|
||||
function doorMetal::make(){
|
||||
|
||||
%pos = $wp.getnodetransform("doorMetal");
|
||||
%door = new staticshape(){ dataBlock = doorMetal; };
|
||||
%door.settransform(%pos);
|
||||
%door.open=false;
|
||||
%door.searchable=true;
|
||||
|
||||
new Trigger() {
|
||||
position = %pos = $wp.getnodeposition("exit");
|
||||
rotation = "1 0 0 0";
|
||||
scale = "3 1.5 3";
|
||||
dataBlock = "ExitTrigger";
|
||||
polyhedron = "0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
datablock TriggerData(exitTrigger)
|
||||
{
|
||||
tickPeriodMS = 100;
|
||||
};
|
||||
|
||||
function ExitTrigger::onEnterTrigger(%this,%trigger,%obj)
|
||||
{
|
||||
serverconnection.setblackout(true,500);
|
||||
$canmove=false;
|
||||
%loc = $wp.getnodetransform("start");
|
||||
|
||||
|
||||
//Hack for battle
|
||||
schedule(700,0,teleport,$player,%loc);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function ExitTrigger::oncreate(%this,%trigger,%obj)
|
||||
{
|
||||
error("I've been added to the world");
|
||||
|
||||
}
|
||||
|
||||
|
||||
function teleport(%who, %where){
|
||||
%who.settransform(%where);
|
||||
|
||||
|
||||
//Hack for battle start
|
||||
battleprep();
|
||||
serverconnection.setblackout(false,700);
|
||||
return;
|
||||
|
||||
|
||||
$canmove=true;
|
||||
}
|
||||
|
||||
function ExitTrigger::onLeaveTrigger(%this,%trigger,%obj)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function ExitTrigger::onTickTrigger(%this,%trigger)
|
||||
{
|
||||
}
|
||||
|
||||
Binary file not shown.
@@ -0,0 +1,132 @@
|
||||
//Door.cs
|
||||
//writen by Ramen Sama
|
||||
|
||||
datablock AudioProfile(doorMetalOpenSound)
|
||||
{
|
||||
filename = "~/data/sound/doorGrate.wav";
|
||||
description = AudioClose3d;
|
||||
preload = false;
|
||||
};
|
||||
|
||||
datablock AudioProfile(doorMetalCloseSound)
|
||||
{
|
||||
filename = "~/data/sound/doorGrate.wav";
|
||||
description = AudioClose3d;
|
||||
preload = false;
|
||||
};
|
||||
|
||||
datablock StaticShapeData(doorMetalMove){
|
||||
category = "Doors";
|
||||
//Points to the DTS object change this for your project
|
||||
shapeFile = "~/data/shapes/door/metalGrillTrans.dts";
|
||||
position = "0 0 0";
|
||||
Scale="1 1 1";
|
||||
emap = true;
|
||||
receiveSunLight = "1";
|
||||
};
|
||||
|
||||
//Called when you touch the door
|
||||
function doorMetalMove::onCollision(%this,%door,%col){
|
||||
if (!%door.open){
|
||||
%door.open=true;
|
||||
%door.setthreaddir(0,"true");
|
||||
%door.playthread(0,"open");
|
||||
serverPlay3D(doorMetalOpenSound,%col.getTransform());
|
||||
%this.schedule(2000, close, %door,%col);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function doorMetalMove::close(%this,%door,%col){
|
||||
|
||||
//does a distance check between the door and what hit it last
|
||||
//I have it set for 2... but you can use whatever you like
|
||||
|
||||
%dist=VectorDist(%col.getposition(), %door.getposition());
|
||||
if (%dist > 2){
|
||||
%door.setthreaddir(0,"false");
|
||||
serverPlay3D(doorMetalCloseSound,%col.getTransform());
|
||||
%door.open=false;
|
||||
}
|
||||
else
|
||||
//if the player is too close, just go ahead and start the timer again
|
||||
%this.schedule(2000, close, %door,%col);
|
||||
}
|
||||
|
||||
function doorMetalMove::onSearch(%this,%obj,%source){
|
||||
//Searching will do the same as trying to open it
|
||||
%this.oncollision(%obj,%source);
|
||||
}
|
||||
|
||||
|
||||
function doorMetalMove::make(){
|
||||
|
||||
%pos = $wp.getnodetransform("doorMetalMove");
|
||||
%door = new staticshape(){ dataBlock = doorMetalMove; };
|
||||
%door.settransform(%pos);
|
||||
%door.open=false;
|
||||
%door.searchable=true;
|
||||
|
||||
new Trigger() {
|
||||
position = %pos = $wp.getnodeposition("exit");
|
||||
rotation = "1 0 0 0";
|
||||
scale = "3 1.5 3";
|
||||
dataBlock = "ExitTrigger";
|
||||
polyhedron = "0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
datablock TriggerData(exitTrigger)
|
||||
{
|
||||
tickPeriodMS = 100;
|
||||
};
|
||||
|
||||
function ExitTrigger::onEnterTrigger(%this,%trigger,%obj)
|
||||
{
|
||||
serverconnection.setblackout(true,500);
|
||||
$canmove=false;
|
||||
%loc = $wp.getnodetransform("start");
|
||||
|
||||
|
||||
//Hack for battle
|
||||
schedule(700,0,teleport,$player,%loc);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function ExitTrigger::oncreate(%this,%trigger,%obj)
|
||||
{
|
||||
error("I've been added to the world");
|
||||
|
||||
}
|
||||
|
||||
|
||||
function teleport(%who, %where){
|
||||
%who.settransform(%where);
|
||||
|
||||
|
||||
//Hack for battle start
|
||||
battleprep();
|
||||
serverconnection.setblackout(false,700);
|
||||
return;
|
||||
|
||||
|
||||
$canmove=true;
|
||||
}
|
||||
|
||||
function ExitTrigger::onLeaveTrigger(%this,%trigger,%obj)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function ExitTrigger::onTickTrigger(%this,%trigger)
|
||||
{
|
||||
}
|
||||
|
||||
Binary file not shown.
132
Torque/SDK/example/starter.fps/server/scripts/doors/doorWood.cs
Normal file
132
Torque/SDK/example/starter.fps/server/scripts/doors/doorWood.cs
Normal file
@@ -0,0 +1,132 @@
|
||||
//DoorWood.cs
|
||||
//writen by Ramen Sama
|
||||
|
||||
datablock AudioProfile(doorWoodOpenSound)
|
||||
{
|
||||
filename = "~/data/sound/doorcreak.wav";
|
||||
description = AudioClose3d;
|
||||
preload = false;
|
||||
};
|
||||
|
||||
datablock AudioProfile(doorWoodCloseSound)
|
||||
{
|
||||
filename = "~/data/sound/doorClose.wav";
|
||||
description = AudioClose3d;
|
||||
preload = false;
|
||||
};
|
||||
|
||||
datablock StaticShapeData(doorWood){
|
||||
category = "Doors";
|
||||
//Points to the DTS object change this for your project
|
||||
shapeFile = "~/data/shapes/door/woodDoor01.dts";
|
||||
position = "0 0 0";
|
||||
Scale="1 1 1";
|
||||
emap = true;
|
||||
receiveSunLight = "1";
|
||||
};
|
||||
|
||||
//Called when you touch the door
|
||||
function doorWood::onCollision(%this,%door,%col){
|
||||
if (!%door.open){
|
||||
%door.open=true;
|
||||
%door.setthreaddir(0,"true");
|
||||
%door.playthread(0,"open");
|
||||
// serverPlay3D(doorWoodOpenSound,%col.getTransform());
|
||||
%this.schedule(2000, close, %door,%col);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function doorWood::close(%this,%door,%col){
|
||||
|
||||
//does a distance check between the door and what hit it last
|
||||
//I have it set for 2... but you can use whatever you like
|
||||
|
||||
%dist=VectorDist(%col.getposition(), %door.getposition());
|
||||
if (%dist > 2){
|
||||
%door.setthreaddir(0,"false");
|
||||
// serverPlay3D(doorWoodCloseSound,%door.getTransform());
|
||||
%door.open=false;
|
||||
}
|
||||
else
|
||||
//if the player is too close, just go ahead and start the timer again
|
||||
%this.schedule(2000, close, %door,%col);
|
||||
}
|
||||
|
||||
function doorWood::onSearch(%this,%obj,%source){
|
||||
//Searching will do the same as trying to open it
|
||||
%this.oncollision(%obj,%source);
|
||||
}
|
||||
|
||||
|
||||
function doorWood::make(){
|
||||
|
||||
%pos = $wp.getnodetransform("doorWood");
|
||||
%door = new staticshape(){ dataBlock = doorWood; };
|
||||
%door.settransform(%pos);
|
||||
%door.open=false;
|
||||
%door.searchable=true;
|
||||
|
||||
new Trigger() {
|
||||
position = %pos = $wp.getnodeposition("exit");
|
||||
rotation = "1 0 0 0";
|
||||
scale = "3 1.5 3";
|
||||
dataBlock = "ExitTrigger";
|
||||
polyhedron = "0.0000000 0.0000000 0.0000000 1.0000000 0.0000000 0.0000000 0.0000000 -1.0000000 0.0000000 0.0000000 0.0000000 1.0000000";
|
||||
};
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
datablock TriggerData(exitTrigger)
|
||||
{
|
||||
tickPeriodMS = 100;
|
||||
};
|
||||
|
||||
function ExitTrigger::onEnterTrigger(%this,%trigger,%obj)
|
||||
{
|
||||
serverconnection.setblackout(true,500);
|
||||
$canmove=false;
|
||||
%loc = $wp.getnodetransform("start");
|
||||
|
||||
|
||||
//Hack for battle
|
||||
schedule(700,0,teleport,$player,%loc);
|
||||
|
||||
}
|
||||
|
||||
|
||||
function ExitTrigger::oncreate(%this,%trigger,%obj)
|
||||
{
|
||||
error("I've been added to the world");
|
||||
|
||||
}
|
||||
|
||||
|
||||
function teleport(%who, %where){
|
||||
%who.settransform(%where);
|
||||
|
||||
|
||||
//Hack for battle start
|
||||
battleprep();
|
||||
serverconnection.setblackout(false,700);
|
||||
return;
|
||||
|
||||
|
||||
$canmove=true;
|
||||
}
|
||||
|
||||
function ExitTrigger::onLeaveTrigger(%this,%trigger,%obj)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
function ExitTrigger::onTickTrigger(%this,%trigger)
|
||||
{
|
||||
}
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user