diff --git a/Engine/source/T3D/gameBase/gameConnection.cpp b/Engine/source/T3D/gameBase/gameConnection.cpp index d39b5c249..a0632511e 100644 --- a/Engine/source/T3D/gameBase/gameConnection.cpp +++ b/Engine/source/T3D/gameBase/gameConnection.cpp @@ -44,10 +44,8 @@ #include "console/engineAPI.h" #include "math/mTransform.h" -#ifdef TORQUE_EXPERIMENTAL_EC #include "T3D/entity.h" #include "T3D/components/coreInterfaces.h" -#endif #ifdef TORQUE_HIFI_NET #include "T3D/gameBase/hifi/hifiMoveList.h" @@ -785,7 +783,6 @@ bool GameConnection::getControlCameraFov(F32 * fov) } if (cObj) { -#ifdef TORQUE_EXPERIMENTAL_EC if (Entity* ent = dynamic_cast(cObj)) { if (CameraInterface* camInterface = ent->getComponent()) @@ -795,11 +792,9 @@ bool GameConnection::getControlCameraFov(F32 * fov) } else { - *fov = cObj->getCameraFov(); + *fov = cObj->getCameraFov(); } -#else - *fov = cObj->getCameraFov(); -#endif + return(true); } @@ -819,7 +814,6 @@ bool GameConnection::isValidControlCameraFov(F32 fov) if (cObj) { -#ifdef TORQUE_EXPERIMENTAL_EC if (Entity* ent = dynamic_cast(cObj)) { if (CameraInterface* camInterface = ent->getComponent()) @@ -831,9 +825,6 @@ bool GameConnection::isValidControlCameraFov(F32 fov) { return cObj->isValidCameraFov(fov); } -#else - return cObj->isValidCameraFov(fov); -#endif } return NULL; @@ -851,8 +842,6 @@ bool GameConnection::setControlCameraFov(F32 fov) } if (cObj) { - -#ifdef TORQUE_EXPERIMENTAL_EC F32 newFov = 90.f; if (Entity* ent = dynamic_cast(cObj)) { @@ -872,11 +861,6 @@ bool GameConnection::setControlCameraFov(F32 fov) cObj->setCameraFov(mClampF(fov, MinCameraFov, MaxCameraFov)); newFov = cObj->getCameraFov(); } -#else - // allow shapebase to clamp fov to its datablock values - cObj->setCameraFov(mClampF(fov, MinCameraFov, MaxCameraFov)); - F32 newFov = cObj->getCameraFov(); -#endif // server fov of client has 1degree resolution if( S32(newFov) != S32(mCameraFov) || newFov != fov ) diff --git a/Engine/source/T3D/gameBase/processList.cpp b/Engine/source/T3D/gameBase/processList.cpp index 1fef84fc2..13285caa1 100644 --- a/Engine/source/T3D/gameBase/processList.cpp +++ b/Engine/source/T3D/gameBase/processList.cpp @@ -32,10 +32,8 @@ #include "platform/profiler.h" #include "console/consoleTypes.h" -#ifdef TORQUE_EXPERIMENTAL_EC #include "T3D/components/coreInterfaces.h" #include "T3D/components/component.h" -#endif //---------------------------------------------------------------------------- ProcessObject::ProcessObject() @@ -277,12 +275,10 @@ void ProcessList::advanceObjects() onTickObject(pobj); } -#ifdef TORQUE_EXPERIMENTAL_EC for (U32 i = 0; i < UpdateInterface::all.size(); i++) { UpdateInterface::all[i]->processTick(); } -#endif mTotalTicks++; diff --git a/Engine/source/T3D/gameBase/std/stdGameProcess.cpp b/Engine/source/T3D/gameBase/std/stdGameProcess.cpp index b9c3a27f1..1e9166316 100644 --- a/Engine/source/T3D/gameBase/std/stdGameProcess.cpp +++ b/Engine/source/T3D/gameBase/std/stdGameProcess.cpp @@ -37,10 +37,8 @@ #include "T3D/gameBase/std/stdMoveList.h" #include "T3D/fx/cameraFXMgr.h" -#ifdef TORQUE_EXPERIMENTAL_EC #include "T3D/components/coreInterfaces.h" #include "T3D/components/component.h" -#endif MODULE_BEGIN( ProcessList ) @@ -137,7 +135,6 @@ bool StdClientProcessList::advanceTime( SimTime timeDelta ) obj = obj->mProcessLink.next; } -#ifdef TORQUE_EXPERIMENTAL_EC for (U32 i = 0; i < UpdateInterface::all.size(); i++) { Component *comp = dynamic_cast(UpdateInterface::all[i]); @@ -147,7 +144,6 @@ bool StdClientProcessList::advanceTime( SimTime timeDelta ) UpdateInterface::all[i]->interpolateTick(mLastDelta); } -#endif // Inform objects of total elapsed delta so they can advance // client side animations. @@ -163,7 +159,6 @@ bool StdClientProcessList::advanceTime( SimTime timeDelta ) obj = obj->mProcessLink.next; } -#ifdef TORQUE_EXPERIMENTAL_EC for (U32 i = 0; i < UpdateInterface::all.size(); i++) { Component *comp = dynamic_cast(UpdateInterface::all[i]); @@ -176,7 +171,6 @@ bool StdClientProcessList::advanceTime( SimTime timeDelta ) UpdateInterface::all[i]->advanceTime(dt); } -#endif return ret; } diff --git a/Engine/source/gui/controls/guiTreeViewCtrl.cpp b/Engine/source/gui/controls/guiTreeViewCtrl.cpp index 1c6343f04..9835c9858 100644 --- a/Engine/source/gui/controls/guiTreeViewCtrl.cpp +++ b/Engine/source/gui/controls/guiTreeViewCtrl.cpp @@ -36,9 +36,7 @@ #include "gui/editor/editorFunctions.h" #endif #include "console/engineAPI.h" -#ifdef TORQUE_EXPERIMENTAL_EC #include "T3D/entity.h" -#endif IMPLEMENT_CONOBJECT(GuiTreeViewCtrl); @@ -647,7 +645,6 @@ void GuiTreeViewCtrl::Item::getTooltipText(U32 bufLen, char *buf) bool GuiTreeViewCtrl::Item::isParent() const { -#ifdef TORQUE_EXPERIMENTAL_EC //We might have a special case with entities //So if our entity either has children, or has some component with the EditorInspect interface, we return true if (mInspectorInfo.mObject) @@ -659,7 +656,6 @@ bool GuiTreeViewCtrl::Item::isParent() const return true; } } -#endif if(mState.test(VirtualParent)) { @@ -3790,7 +3786,6 @@ void GuiTreeViewCtrl::onMouseDown(const GuiEvent & event) if( !item->isInspectorData() && item->mState.test(Item::VirtualParent) ) onVirtualParentExpand(item); -#ifdef TORQUE_EXPERIMENTAL_EC //Slightly hacky, but I'm not sure of a better setup until we get major update to the editors //We check if our object is an entity, and if it is, we call a 'onInspect' function. //This function is pretty much a special notifier to the entity so if it has any behaviors that do special @@ -3810,7 +3805,6 @@ void GuiTreeViewCtrl::onMouseDown(const GuiEvent & event) } } } -#endif mFlags.set( RebuildVisible ); scrollVisible(item); @@ -4558,12 +4552,10 @@ bool GuiTreeViewCtrl::objectSearch( const SimObject *object, Item **item ) if ( !pItem ) continue; -#ifdef TORQUE_EXPERIMENTAL_EC //A bit hackish, but we make a special exception here for items that are named 'Components', as they're merely //virtual parents to act as a container to an Entity's components if (pItem->mScriptInfo.mText == StringTable->insert("Components")) continue; -#endif SimObject *pObj = pItem->getObject(); @@ -4628,11 +4620,10 @@ bool GuiTreeViewCtrl::onVirtualParentBuild(Item *item, bool bForceFullUpdate) // Go through our items and purge those that have disappeared from // the set. -#ifdef TORQUE_EXPERIMENTAL_EC + //Entities will be a special case here, if we're an entity, skip this step if (dynamic_cast(srcObj)) return true; -#endif for( Item* ptr = item->mChild; ptr != NULL; ) { diff --git a/Engine/source/gui/editor/guiInspector.cpp b/Engine/source/gui/editor/guiInspector.cpp index 77ab67365..086995529 100644 --- a/Engine/source/gui/editor/guiInspector.cpp +++ b/Engine/source/gui/editor/guiInspector.cpp @@ -29,11 +29,9 @@ #include "gui/containers/guiScrollCtrl.h" #include "gui/editor/inspector/customField.h" -#ifdef TORQUE_EXPERIMENTAL_EC #include "gui/editor/inspector/entityGroup.h" #include "gui/editor/inspector/mountingGroup.h" #include "gui/editor/inspector/componentGroup.h" -#endif IMPLEMENT_CONOBJECT(GuiInspector); @@ -589,7 +587,6 @@ void GuiInspector::refresh() mGroups.push_back(general); addObject(general); -#ifdef TORQUE_EXPERIMENTAL_EC //Entity inspector group if (mTargets.first()->getClassRep()->isSubclassOf("Entity")) { @@ -624,7 +621,6 @@ void GuiInspector::refresh() addObject(compGroup); } } -#endif // Create the inspector groups for static fields. diff --git a/Engine/source/gui/editor/inspector/dynamicGroup.cpp b/Engine/source/gui/editor/inspector/dynamicGroup.cpp index 78d8c4bd8..3d9879919 100644 --- a/Engine/source/gui/editor/inspector/dynamicGroup.cpp +++ b/Engine/source/gui/editor/inspector/dynamicGroup.cpp @@ -26,9 +26,7 @@ #include "gui/editor/inspector/dynamicField.h" #include "console/engineAPI.h" -#ifdef TORQUE_EXPERIMENTAL_EC #include "T3D/components/component.h" -#endif IMPLEMENT_CONOBJECT(GuiInspectorDynamicGroup); @@ -126,7 +124,6 @@ bool GuiInspectorDynamicGroup::inspectGroup() SimFieldDictionary * fieldDictionary = target->getFieldDictionary(); for(SimFieldDictionaryIterator ditr(fieldDictionary); *ditr; ++ditr) { -#ifdef TORQUE_EXPERIMENTAL_EC if (target->getClassRep()->isSubclassOf("Component")) { Component* compTarget = dynamic_cast(target); @@ -135,7 +132,7 @@ bool GuiInspectorDynamicGroup::inspectGroup() if (compField) continue; } -#endif + if( i == 0 ) { flist.increment(); diff --git a/Engine/source/scene/sceneRenderState.cpp b/Engine/source/scene/sceneRenderState.cpp index 325ba6a76..fa1966ab8 100644 --- a/Engine/source/scene/sceneRenderState.cpp +++ b/Engine/source/scene/sceneRenderState.cpp @@ -26,10 +26,8 @@ #include "renderInstance/renderPassManager.h" #include "math/util/matrixSet.h" -#ifdef TORQUE_EXPERIMENTAL_EC #include "T3D/components/render/renderComponentInterface.h" #include "T3D/components/component.h" -#endif //----------------------------------------------------------------------------- @@ -108,7 +106,6 @@ void SceneRenderState::renderObjects( SceneObject** objects, U32 numObjects ) object->prepRenderImage( this ); } -#ifdef TORQUE_EXPERIMENTAL_EC U32 interfaceCount = RenderComponentInterface::all.size(); for (U32 i = 0; i < RenderComponentInterface::all.size(); i++) { @@ -119,7 +116,6 @@ void SceneRenderState::renderObjects( SceneObject** objects, U32 numObjects ) RenderComponentInterface::all[i]->prepRenderImage(this); } } -#endif PROFILE_END(); diff --git a/Templates/BaseGame/game/core/CoreComponents.module b/Templates/BaseGame/game/core/CoreComponents.module new file mode 100644 index 000000000..7ca29196a --- /dev/null +++ b/Templates/BaseGame/game/core/CoreComponents.module @@ -0,0 +1,16 @@ + + + + \ No newline at end of file diff --git a/Templates/BaseGame/game/core/components/RigidBodyComponent.asset.taml b/Templates/BaseGame/game/core/components/RigidBodyComponent.asset.taml new file mode 100644 index 000000000..8e60db364 --- /dev/null +++ b/Templates/BaseGame/game/core/components/RigidBodyComponent.asset.taml @@ -0,0 +1,8 @@ + diff --git a/Templates/BaseGame/game/core/components/animationComponent.asset.taml b/Templates/BaseGame/game/core/components/animationComponent.asset.taml new file mode 100644 index 000000000..771d38e02 --- /dev/null +++ b/Templates/BaseGame/game/core/components/animationComponent.asset.taml @@ -0,0 +1,8 @@ + diff --git a/Templates/Full/game/scripts/server/components/cameraOrbiterComponent.asset.taml b/Templates/BaseGame/game/core/components/cameraOrbiterComponent.asset.taml similarity index 58% rename from Templates/Full/game/scripts/server/components/cameraOrbiterComponent.asset.taml rename to Templates/BaseGame/game/core/components/cameraOrbiterComponent.asset.taml index e03081564..b615f2348 100644 --- a/Templates/Full/game/scripts/server/components/cameraOrbiterComponent.asset.taml +++ b/Templates/BaseGame/game/core/components/cameraOrbiterComponent.asset.taml @@ -1,7 +1,8 @@ + description="Acts as a boon arm for a camera component." /> diff --git a/Templates/Full/game/scripts/server/components/collisionComponent.asset.taml b/Templates/BaseGame/game/core/components/collisionComponent.asset.taml similarity index 57% rename from Templates/Full/game/scripts/server/components/collisionComponent.asset.taml rename to Templates/BaseGame/game/core/components/collisionComponent.asset.taml index 9796df18d..1a4f99a0d 100644 --- a/Templates/Full/game/scripts/server/components/collisionComponent.asset.taml +++ b/Templates/BaseGame/game/core/components/collisionComponent.asset.taml @@ -1,7 +1,8 @@ + description="Enables an entity to collide with things." /> diff --git a/Templates/Full/game/scripts/server/components/game/camera.asset.taml b/Templates/BaseGame/game/core/components/game/camera.asset.taml similarity index 65% rename from Templates/Full/game/scripts/server/components/game/camera.asset.taml rename to Templates/BaseGame/game/core/components/game/camera.asset.taml index 5d00d1170..0d55a74b4 100644 --- a/Templates/Full/game/scripts/server/components/game/camera.asset.taml +++ b/Templates/BaseGame/game/core/components/game/camera.asset.taml @@ -1,7 +1,9 @@ + scriptFile="core/components/game/camera.cs" + description="Allows the component owner to operate as a camera." /> diff --git a/Templates/Full/game/scripts/server/components/game/camera.cs b/Templates/BaseGame/game/core/components/game/camera.cs similarity index 56% rename from Templates/Full/game/scripts/server/components/game/camera.cs rename to Templates/BaseGame/game/core/components/game/camera.cs index 24363bd82..b6f510c9d 100644 --- a/Templates/Full/game/scripts/server/components/game/camera.cs +++ b/Templates/BaseGame/game/core/components/game/camera.cs @@ -100,97 +100,86 @@ function CameraComponent::onClientDisconnect(%this, %client) } } -//move to the editor later -GlobalActionMap.bind("keyboard", "alt c", "toggleEditorCam"); +/// +/// +/// -function switchCamera(%client, %newCamEntity) +function VRCameraComponent::onAdd(%this) { - if(!isObject(%client) || !isObject(%newCamEntity)) - return error("SwitchCamera: No client or target camera!"); - - %cam = %newCamEntity.getComponent(CameraComponent); - - if(!isObject(%cam)) - return error("SwitchCamera: Target camera doesn't have a camera behavior!"); - - //TODO: Cleanup clientOwner for previous camera! - if(%cam.clientOwner == 0 || %cam.clientOwner $= "") - %cam.clientOwner = 0; - - %cam.scopeToClient(%client); - %cam.setDirty(); - - %client.setCameraObject(%newCamEntity); - %client.setControlCameraFov(%cam.FOV); - - %client.camera = %newCamEntity; -} + %this.addComponentField(clientOwner, "The client that views this camera", "int", "1", ""); -function buildEditorCamera() -{ - if(isObject("EditorCamera")) - return EditorCamera; - - %camObj = SGOManager.spawn("SpectatorObject", false); - - %camObj.name = "EditorCamera"; - - %client = ClientGroup.getObject(0); - - %camObj.getComponent(SpectatorControls).setupControls(%client); - - MissionCleanup.add(%camObj); - - return %camObj; -} + %test = %this.clientOwner; -//TODO: Move this somewhere else! -function toggleEditorCam(%val) -{ - if(!%val) - return; - - %client = ClientGroup.getObject(0); + %barf = ClientGroup.getCount(); - if(!isObject(%client.camera)) - return error("ToggleEditorCam: no existing camera!"); - - %editorCam = buildEditorCamera(); - - //if this is our first switch, just go to the editor camera - if(%client.lastCam $= "" || %client.camera.getId() != %editorCam.getId()) + %clientID = %this.getClientID(); + if(%clientID && !isObject(%clientID.camera)) { - if(%client.lastCam $= "") - { - //set up the position - %editorCam.position = %client.camera.position; - %editorCam.rotation = %client.camera.rotation; - } - - %client.lastCam = %client.camera; - %client.lastController = %client.getControlObject(); - switchCamera(%client, %editorCam); - switchControlObject(%client, %editorCam); - } - else - { - switchCamera(%client, %client.lastCam); - switchControlObject(%client, %client.lastController); - %client.lastCam = %editorCam; - %client.lastController = %editorCam; + %this.scopeToClient(%clientID); + %this.setDirty(); + + %clientID.setCameraObject(%this.owner); + %clientID.setControlCameraFov(%this.FOV); + + %clientID.camera = %this.owner; } + + %res = $pref::Video::mode; + %derp = 0; } -function serverCmdSetClientAspectRatio(%client, %width, %height) +function VRCameraComponent::onRemove(%this) { - echo("Client: " @ %client SPC "changing screen res to: " @ %width SPC %height); - %client.screenExtent = %width SPC %height; - %cam = %client.getCameraObject(); - - if(!isObject(%cam)) - return; - - %cameraComp = %cam.getComponent(CameraComponent); + %clientID = %this.getClientID(); + if(%clientID) + %clientID.clearCameraObject(); +} - %cameraComp.ScreenAspect = %width SPC %height; +function CameraComponent::onInspectorUpdate(%this) +{ + //if(%this.clientOwner) + //%this.clientOwner.setCameraObject(%this.owner); +} + +function VRCameraComponent::getClientID(%this) +{ + return ClientGroup.getObject(%this.clientOwner-1); +} + +function VRCameraComponent::isClientCamera(%this, %client) +{ + %clientID = ClientGroup.getObject(%this.clientOwner-1); + + if(%client.getID() == %clientID) + return true; + else + return false; +} + +function VRCameraComponent::onClientConnect(%this, %client) +{ + //if(%this.isClientCamera(%client) && !isObject(%client.camera)) + //{ + %this.scopeToClient(%client); + %this.setDirty(); + + %client.setCameraObject(%this.owner); + %client.setControlCameraFov(%this.FOV); + + %client.camera = %this.owner; + //} + //else + //{ + // echo("CONNECTED CLIENT IS NOT CAMERA OWNER!"); + //} +} + +function VRCameraComponent::onClientDisconnect(%this, %client) +{ + Parent::onClientDisconnect(%this, %client); + + if(isClientCamera(%client)){ + %this.clearScopeToClient(%client); + %client.clearCameraObject(); + } } \ No newline at end of file diff --git a/Templates/Full/game/scripts/server/components/game/controlObject.asset.taml b/Templates/BaseGame/game/core/components/game/controlObject.asset.taml similarity index 68% rename from Templates/Full/game/scripts/server/components/game/controlObject.asset.taml rename to Templates/BaseGame/game/core/components/game/controlObject.asset.taml index 2c9d48e1c..93f58119f 100644 --- a/Templates/Full/game/scripts/server/components/game/controlObject.asset.taml +++ b/Templates/BaseGame/game/core/components/game/controlObject.asset.taml @@ -1,7 +1,10 @@ + scriptFile="core/components/game/controlObject.cs" + description="Allows the component owner to be controlled by a client." /> diff --git a/Templates/Full/game/scripts/server/components/game/controlObject.cs b/Templates/BaseGame/game/core/components/game/controlObject.cs similarity index 100% rename from Templates/Full/game/scripts/server/components/game/controlObject.cs rename to Templates/BaseGame/game/core/components/game/controlObject.cs diff --git a/Templates/Full/game/scripts/server/components/game/itemRotate.asset.taml b/Templates/BaseGame/game/core/components/game/itemRotate.asset.taml similarity index 68% rename from Templates/Full/game/scripts/server/components/game/itemRotate.asset.taml rename to Templates/BaseGame/game/core/components/game/itemRotate.asset.taml index 8068b49f3..806d0db19 100644 --- a/Templates/Full/game/scripts/server/components/game/itemRotate.asset.taml +++ b/Templates/BaseGame/game/core/components/game/itemRotate.asset.taml @@ -1,7 +1,10 @@ + scriptFile="core/components/game/itemRotate.cs" + description="Rotates the entity around an axis, like an item pickup." /> diff --git a/Templates/Full/game/scripts/server/components/game/itemRotate.cs b/Templates/BaseGame/game/core/components/game/itemRotate.cs similarity index 100% rename from Templates/Full/game/scripts/server/components/game/itemRotate.cs rename to Templates/BaseGame/game/core/components/game/itemRotate.cs diff --git a/Templates/Full/game/scripts/server/components/game/playerSpawner.asset.taml b/Templates/BaseGame/game/core/components/game/playerSpawner.asset.taml similarity index 62% rename from Templates/Full/game/scripts/server/components/game/playerSpawner.asset.taml rename to Templates/BaseGame/game/core/components/game/playerSpawner.asset.taml index d181a86b4..bf2b872ef 100644 --- a/Templates/Full/game/scripts/server/components/game/playerSpawner.asset.taml +++ b/Templates/BaseGame/game/core/components/game/playerSpawner.asset.taml @@ -1,7 +1,10 @@ + scriptFile="core/components/game/playerSpawner.cs" + description="When a client connects, it spawns a player object for them and attaches them to it." /> diff --git a/Templates/Full/game/scripts/server/components/game/playerSpawner.cs b/Templates/BaseGame/game/core/components/game/playerSpawner.cs similarity index 78% rename from Templates/Full/game/scripts/server/components/game/playerSpawner.cs rename to Templates/BaseGame/game/core/components/game/playerSpawner.cs index fb6507d08..a7387eaf1 100644 --- a/Templates/Full/game/scripts/server/components/game/playerSpawner.cs +++ b/Templates/BaseGame/game/core/components/game/playerSpawner.cs @@ -29,32 +29,40 @@ function PlayerSpawner::onAdd(%this) %this.friendlyName = "Player Spawner"; %this.componentType = "Spawner"; - %this.addComponentField("GameObjectName", "The name of the game object we spawn for the players", string, "PlayerObject"); + %this.addComponentField("GameObjectName", "The name of the game object we spawn for the players", "gameObject", "PlayerObject"); } function PlayerSpawner::onClientConnect(%this, %client) { - %playerObj = SGOManager.spawn(%this.GameObjectName); + %playerObj = spawnGameObject(%this.GameObjectName, false); if(!isObject(%playerObj)) return; %playerObj.position = %this.owner.position; - MissionCleanup.add(%playerObj); - - for(%b = 0; %b < %playerObj.getComponentCount(); %b++) - { - %comp = %playerObj.getComponentByIndex(%b); - - if(%comp.isMethod("onClientConnect")) - %comp.onClientConnect(%client); - } + %playerObj.notify("onClientConnect", %client); switchControlObject(%client, %playerObj); switchCamera(%client, %playerObj); - //%playerObj.getComponent(FPSControls).setupControls(%client); + %client.player = %playerObj; + %client.camera = %playerObj; + + %inventory = %playerObj.getComponent(InventoryController); + + if(isObject(%inventory)) + { + for(%i=0; %i<5; %i++) + { + %arrow = spawnGameObject(ArrowProjectile, false); + + %inventory.addItem(%arrow); + } + } + + %playerObj.position = %this.owner.position; + %playerObj.rotation = "0 0 0"; %this.clientCount++; } diff --git a/Templates/Full/game/scripts/server/components/input/fpsControls.asset.taml b/Templates/BaseGame/game/core/components/input/fpsControls.asset.taml similarity index 62% rename from Templates/Full/game/scripts/server/components/input/fpsControls.asset.taml rename to Templates/BaseGame/game/core/components/input/fpsControls.asset.taml index 34f31f181..cd0440055 100644 --- a/Templates/Full/game/scripts/server/components/input/fpsControls.asset.taml +++ b/Templates/BaseGame/game/core/components/input/fpsControls.asset.taml @@ -1,7 +1,9 @@ + description="First Person Shooter-type controls." /> diff --git a/Templates/Full/game/scripts/server/components/input/fpsControls.cs b/Templates/BaseGame/game/core/components/input/fpsControls.cs similarity index 100% rename from Templates/Full/game/scripts/server/components/input/fpsControls.cs rename to Templates/BaseGame/game/core/components/input/fpsControls.cs diff --git a/Templates/Full/game/scripts/server/components/input/inputManager.cs b/Templates/BaseGame/game/core/components/input/inputManager.cs similarity index 100% rename from Templates/Full/game/scripts/server/components/input/inputManager.cs rename to Templates/BaseGame/game/core/components/input/inputManager.cs diff --git a/Templates/BaseGame/game/core/components/meshComponent.asset.taml b/Templates/BaseGame/game/core/components/meshComponent.asset.taml new file mode 100644 index 000000000..b41de171a --- /dev/null +++ b/Templates/BaseGame/game/core/components/meshComponent.asset.taml @@ -0,0 +1,8 @@ + diff --git a/Templates/Full/game/scripts/server/components/playerControllerComponent.asset.taml b/Templates/BaseGame/game/core/components/playerControllerComponent.asset.taml similarity index 80% rename from Templates/Full/game/scripts/server/components/playerControllerComponent.asset.taml rename to Templates/BaseGame/game/core/components/playerControllerComponent.asset.taml index d5174644b..417f409e0 100644 --- a/Templates/Full/game/scripts/server/components/playerControllerComponent.asset.taml +++ b/Templates/BaseGame/game/core/components/playerControllerComponent.asset.taml @@ -1,7 +1,8 @@ + description="Enables an entity to move like a player object." /> diff --git a/Templates/BaseGame/game/core/components/soundComponent.asset.taml b/Templates/BaseGame/game/core/components/soundComponent.asset.taml new file mode 100644 index 000000000..a29bcc9ff --- /dev/null +++ b/Templates/BaseGame/game/core/components/soundComponent.asset.taml @@ -0,0 +1,8 @@ + diff --git a/Templates/Full/game/scripts/server/components/stateMachineComponent.asset.taml b/Templates/BaseGame/game/core/components/stateMachineComponent.asset.taml similarity index 59% rename from Templates/Full/game/scripts/server/components/stateMachineComponent.asset.taml rename to Templates/BaseGame/game/core/components/stateMachineComponent.asset.taml index a261bb194..ff1d53cd8 100644 --- a/Templates/Full/game/scripts/server/components/stateMachineComponent.asset.taml +++ b/Templates/BaseGame/game/core/components/stateMachineComponent.asset.taml @@ -1,7 +1,8 @@ + description="Enables a state machine on the entity." /> diff --git a/Templates/Full/game/art/art.module.taml b/Templates/Full/game/art/art.module.taml deleted file mode 100644 index 73855c09e..000000000 --- a/Templates/Full/game/art/art.module.taml +++ /dev/null @@ -1,13 +0,0 @@ - - - \ No newline at end of file diff --git a/Templates/Full/game/art/shapes/actors/Soldier/soldier.asset.taml b/Templates/Full/game/art/shapes/actors/Soldier/soldier.asset.taml deleted file mode 100644 index 4ba732205..000000000 --- a/Templates/Full/game/art/shapes/actors/Soldier/soldier.asset.taml +++ /dev/null @@ -1,3 +0,0 @@ - diff --git a/Templates/Full/game/scripts/scripts.module.taml b/Templates/Full/game/scripts/scripts.module.taml deleted file mode 100644 index e1a6b57be..000000000 --- a/Templates/Full/game/scripts/scripts.module.taml +++ /dev/null @@ -1,13 +0,0 @@ - - - \ No newline at end of file diff --git a/Templates/Full/game/scripts/server/components/animationComponent.asset.taml b/Templates/Full/game/scripts/server/components/animationComponent.asset.taml deleted file mode 100644 index 62f15cdf9..000000000 --- a/Templates/Full/game/scripts/server/components/animationComponent.asset.taml +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/Templates/Full/game/scripts/server/components/meshComponent.asset.taml b/Templates/Full/game/scripts/server/components/meshComponent.asset.taml deleted file mode 100644 index d019cd893..000000000 --- a/Templates/Full/game/scripts/server/components/meshComponent.asset.taml +++ /dev/null @@ -1,7 +0,0 @@ - diff --git a/Templates/Full/game/scripts/server/gameObjects/GameObjectManager.cs b/Templates/Full/game/scripts/server/gameObjects/GameObjectManager.cs deleted file mode 100644 index f0b618920..000000000 --- a/Templates/Full/game/scripts/server/gameObjects/GameObjectManager.cs +++ /dev/null @@ -1,123 +0,0 @@ -//----------------------------------------------------------------------------- -// Copyright (c) 2012 GarageGames, LLC -// -// Permission is hereby granted, free of charge, to any person obtaining a copy -// of this software and associated documentation files (the "Software"), to -// deal in the Software without restriction, including without limitation the -// rights to use, copy, modify, merge, publish, distribute, sublicense, and/or -// sell copies of the Software, and to permit persons to whom the Software is -// furnished to do so, subject to the following conditions: -// -// The above copyright notice and this permission notice shall be included in -// all copies or substantial portions of the Software. -// -// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING -// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS -// IN THE SOFTWARE. -//----------------------------------------------------------------------------- -function execGameObjects() -{ - //find all GameObjectAssets - %assetQuery = new AssetQuery(); - if(!AssetDatabase.findAssetType(%assetQuery, "GameObjectAsset")) - return; //if we didn't find ANY, just exit - - %count = %assetQuery.getCount(); - - for(%i=0; %i < %count; %i++) - { - %assetId = %assetQuery.getAsset(%i); - - %gameObjectAsset = AssetDatabase.acquireAsset(%assetId); - - if(isFile(%gameObjectAsset.scriptFilePath)) - exec(%gameObjectAsset.scriptFilePath); - } -} - -function findGameObject(%name) -{ - //find all GameObjectAssets - %assetQuery = new AssetQuery(); - if(!AssetDatabase.findAssetType(%assetQuery, "GameObjectAsset")) - return 0; //if we didn't find ANY, just exit - - %count = %assetQuery.getCount(); - - for(%i=0; %i < %count; %i++) - { - %assetId = %assetQuery.getAsset(%i); - - %gameObjectAsset = AssetDatabase.acquireAsset(%assetId); - - if(%gameObjectAsset.gameObjectName $= %name) - { - if(isFile(%gameObjectAsset.TAMLFilePath)) - { - return %gameObjectAsset; - } - } - } - - return 0; -} - -function spawnGameObject(%name, %addToMissionGroup) -{ - if(%addToMissionGroup $= "") - %addToMissionGroup = true; - - %gameObjectAsset = findGameObject(%name); - - if(isObject(%gameObjectAsset)) - { - %newSGOObject = TamlRead(%gameObjectAsset.TAMLFilePath); - - if(%addToMissionGroup == true) //save instance when saving level - MissionGroup.add(%newSGOObject); - else // clear instance on level exit - MissionCleanup.add(%newSGOObject); - - return %newSGOObject; - } - - return 0; -} - -function saveGameObject(%name, %tamlPath, %scriptPath) -{ - %gameObjectAsset = findGameObject(%name); - - //find if it already exists. If it does, we'll update it, if it does not, we'll make a new asset - if(isObject(%gameObjectAsset)) - { - %assetID = %gameObjectAsset.getAssetId(); - - %gameObjectAsset.TAMLFilePath = %tamlPath; - %gameObjectAsset.scriptFilePath = %scriptPath; - - TAMLWrite(%gameObjectAsset, AssetDatabase.getAssetFilePath(%assetID)); - AssetDatabase.refreshAsset(%assetID); - } - else - { - //Doesn't exist, so make a new one - %gameObjectAsset = new GameObjectAsset() - { - assetName = %name @ "Asset"; - gameObjectName = %name; - TAMLFilePath = %tamlPath; - scriptFilePath = %scriptPath; - }; - - //Save it alongside the taml file - %path = filePath(%tamlPath); - - TAMLWrite(%gameObjectAsset, %path @ "/" @ %name @ ".asset.taml"); - AssetDatabase.refreshAllAssets(true); - } -} \ No newline at end of file diff --git a/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.asset.taml b/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.asset.taml deleted file mode 100644 index 2d593a50b..000000000 --- a/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.asset.taml +++ /dev/null @@ -1,5 +0,0 @@ - diff --git a/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.cs b/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.cs deleted file mode 100644 index 3ab05a79d..000000000 --- a/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.cs +++ /dev/null @@ -1,247 +0,0 @@ -function ThirdPersonPlayerObject::onAdd(%this) -{ - %this.turnRate = 0.3; - - %this.phys = %this.getComponent("PlayerControllerComponent"); - %this.collision = %this.getComponent("CollisionComponent"); - %this.cam = %this.getComponent("CameraComponent"); - %this.camArm = %this.getComponent("CameraOrbiterComponent"); - %this.animation = %this.getComponent("AnimationComponent"); - %this.stateMachine = %this.getComponent("StateMachineComponent"); - %this.mesh = %this.getComponent("MeshComponent"); - - %this.stateMachine.forwardVector = 0; - - %this.crouch = false; - - %this.firstPerson = false; - - %this.crouchSpeedMod = 0.5; - - %this.aimOrbitDist = 1.5; - %this.regularOrbitDist = 5; - - %this.regularOrbitMaxPitch = 70; - %this.regularOrbitMinPitch = -10; - - %this.aimedMaxPitch = 90; - %this.aimedMinPitch = -90; -} - -function ThirdPersonPlayerObject::onRemove(%this) -{ - -} - -function ThirdPersonPlayerObject::moveVectorEvent(%this) -{ - %moveVector = %this.getMoveVector(); - - // forward of the camera on the x-z plane - %cameraForward = %this.cam.getForwardVector(); - - %cameraRight = %this.cam.getRightVector(); - - %moveVec = VectorAdd(VectorScale(%cameraRight, %moveVector.x), VectorScale(%cameraForward, %moveVector.y)); - - if(%this.aiming || %this.firstPerson) - { - %forMove = "0 0 0"; - - if(%moveVector.x != 0) - { - %this.phys.inputVelocity.x = %moveVector.x * 10; - } - else - { - %this.phys.inputVelocity.x = 0; - } - - if(%moveVector.y != 0) - { - - %this.phys.inputVelocity.y = %moveVector.y * 10; - } - else - { - %this.phys.inputVelocity.y = 0; - } - } - else - { - if(%moveVec.x == 0 && %moveVec.y == 0) - { - %this.phys.inputVelocity = "0 0 0"; - %this.stateMachine.forwardVector = 0; - } - else - { - %moveVec.z = 0; - - %curForVec = %this.getForwardVector(); - - %newForVec = VectorLerp(%curForVec, %moveVec, %this.turnRate); - - %this.setForwardVector(%newForVec); - - %this.phys.inputVelocity.y = 10; - - %this.stateMachine.forwardVector = 1; - } - } - - if(%this.crouch) - %this.phys.inputVelocity = VectorScale(%this.phys.inputVelocity, %this.crouchSpeedMod); -} - -function ThirdPersonPlayerObject::moveYawEvent(%this) -{ - %moveRotation = %this.getMoveRotation(); - - %camOrb = %this.getComponent("CameraOrbiterComponent"); - - if(%this.aiming || %this.firstPerson) - { - %this.rotation.z += %moveRotation.z * 10; - } - - %camOrb.rotation.z += %moveRotation.z * 10; -} - -function ThirdPersonPlayerObject::movePitchEvent(%this) -{ - %moveRotation = %this.getMoveRotation(); - - %camOrb = %this.getComponent("CameraOrbiterComponent"); - - %camOrb.rotation.x += %moveRotation.x * 10; -} - -function ThirdPersonPlayerObject::moveRollEvent(%this){} - -function ThirdPersonPlayerObject::moveTriggerEvent(%this, %triggerNum, %triggerValue) -{ - if(%triggerNum == 3 && %triggerValue) - { - if(%triggerValue) - { - %this.firstPerson = !%this.firstPerson; - - if(%this.firstPerson) - { - %this.rotation.z = %this.cam.rotationOffset.z; - %this.camArm.orbitDistance = 0; - %this.camArm.maxPitchAngle = %this.aimedMaxPitch; - %this.camArm.minPitchAngle = %this.aimedMinPitch; - - %this.cam.positionOffset = "0 0 0"; - %this.cam.rotationOffset = "0 0 0"; - } - else if(%this.aiming) - { - %this.camArm.orbitDistance = %this.aimOrbitDist; - - %this.camArm.maxPitchAngle = %this.aimedMaxPitch; - %this.camArm.minPitchAngle = %this.aimedMinPitch; - } - else - { - %this.camArm.orbitDistance = %this.regularOrbitDist; - - %this.camArm.maxPitchAngle = %this.regularOrbitMaxPitch; - %this.camArm.minPitchAngle = %this.regularOrbitMinPitch; - } - - commandToClient(localclientConnection, 'SetClientRenderShapeVisibility', - localclientConnection.getGhostID(%this.getComponent("MeshComponent")), !%this.firstPerson); - } - } - else if(%triggerNum == 2 && %triggerValue == true) - { - //get our best collision assuming up is 0 0 1 - %collisionAngle = %this.collision.getBestCollisionAngle("0 0 1"); - - if(%collisionAngle >= 80) - { - %surfaceNormal = %this.collision.getCollisionNormal(0); - %jumpVector = VectorScale(%surfaceNormal, 200); - echo("Jump surface Angle is at: " @ %surfaceNormal); - - %this.phys.applyImpulse(%this.position, %jumpVector); - %this.setForwardVector(%jumpVector); - } - else - %this.phys.applyImpulse(%this.position, "0 0 300"); - } - else if(%triggerNum == 4) - { - %this.crouch = %triggerValue; - } - else if(%triggerNum == 1) - { - %this.aiming = %triggerValue; - - if(%this.aiming) - { - %this.rotation.z = %this.cam.rotationOffset.z; - %this.camArm.orbitDistance = %this.aimOrbitDist; - %this.camArm.maxPitchAngle = %this.aimedMaxPitch; - %this.camArm.minPitchAngle = %this.aimedMinPitch; - } - else - { - %this.camArm.orbitDistance = %this.regularOrbitDist; - %this.camArm.maxPitchAngle = %this.regularOrbitMaxPitch; - %this.camArm.minPitchAngle = %this.regularOrbitMinPitch; - } - } -} - -function ThirdPersonPlayerObject::onCollisionEvent(%this, %colObject, %colNormal, %colPoint, %colMatID, %velocity) -{ - if(!%this.phys.isContacted()) - echo(%this @ " collided with " @ %colObject); -} - -function ThirdPersonPlayerObject::processTick(%this) -{ - %moveVec = %this.getMoveVector(); - %bestFit = ""; - - if(%this.crouch) - { - if(%moveVec.x != 0 || %moveVec.y != 0) - %bestFit = "Crouch_Forward"; - else - %bestFit = "Crouch_Root"; - } - else - { - if(%moveVec.x != 0 || %moveVec.y != 0) - %bestFit = "Run"; - else - %bestFit = "Root"; - } - - if(%this.animation.getThreadAnimation(0) !$= %bestFit) - %this.animation.playThread(0, %bestFit); -} - -//Used for first person mode -function clientCmdSetClientRenderShapeVisibility(%id, %visiblilty) -{ - %localID = ServerConnection.resolveGhostID(%id); - %localID.enabled = %visiblilty; -} - -function serverToClientObject( %serverObject ) -{ - assert( isObject( LocalClientConnection ), "serverToClientObject() - No local client connection found!" ); - assert( isObject( ServerConnection ), "serverToClientObject() - No server connection found!" ); - - %ghostId = LocalClientConnection.getGhostId( %serverObject ); - if ( %ghostId == -1 ) - return 0; - - return ServerConnection.resolveGhostID( %ghostId ); -} \ No newline at end of file diff --git a/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.taml b/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.taml deleted file mode 100644 index df2397bb5..000000000 --- a/Templates/Full/game/scripts/server/gameObjects/ThirdPersonPlayerObject.taml +++ /dev/null @@ -1,98 +0,0 @@ - - - - - - - - - - - diff --git a/Templates/Full/game/scripts/server/scriptExec.cs b/Templates/Full/game/scripts/server/scriptExec.cs index f6eb29b7d..a61204040 100644 --- a/Templates/Full/game/scripts/server/scriptExec.cs +++ b/Templates/Full/game/scripts/server/scriptExec.cs @@ -58,23 +58,3 @@ exec("./turret.cs"); // Load our gametypes exec("./gameCore.cs"); // This is the 'core' of the gametype functionality. exec("./gameDM.cs"); // Overrides GameCore with DeathMatch functionality. - -//Entity/Component stuff -if(isFile("./components/game/camera.cs")) - exec("./components/game/camera.cs"); -if(isFile("./components/game/controlObject.cs")) - exec("./components/game/controlObject.cs"); -if(isFile("./components/game/itemRotate.cs")) - exec("./components/game/itemRotate.cs"); -if(isFile("./components/game/playerSpawner.cs")) - exec("./components/game/playerSpawner.cs"); -if(isFile("./components/input/fpsControls.cs")) - exec("./components/input/fpsControls.cs"); -if(isFile("./components/input/inputManager.cs")) - exec("./components/input/inputManager.cs"); - -if(isFile("./gameObjects/GameObjectManager.cs")) -{ - exec("./gameObjects/GameObjectManager.cs"); - execGameObjects(); -} diff --git a/Tools/CMake/torque3d.cmake b/Tools/CMake/torque3d.cmake index 63209ae97..80b6e60b0 100644 --- a/Tools/CMake/torque3d.cmake +++ b/Tools/CMake/torque3d.cmake @@ -143,9 +143,6 @@ if(WIN32) option(TORQUE_D3D11 "Allow Direct3D 11 render" ON) endif() -option(TORQUE_EXPERIMENTAL_EC "Experimental Entity/Component systems" OFF) -mark_as_advanced(TORQUE_EXPERIMENTAL_EC) - option(TORQUE_DEDICATED "Torque dedicated" OFF) mark_as_advanced(TORQUE_DEDICATED) @@ -316,9 +313,6 @@ addPath("${srcDir}/physics") addPath("${srcDir}/gui/3d") addPath("${srcDir}/postFx") -if(NOT TORQUE_EXPERIMENTAL_EC) - set(BLACKLIST "entity.cpp;entity.h" ) -endif() addPath("${srcDir}/T3D") set(BLACKLIST "" ) @@ -331,16 +325,13 @@ addPath("${srcDir}/T3D/decal") addPath("${srcDir}/T3D/sfx") addPath("${srcDir}/T3D/gameBase") addPath("${srcDir}/T3D/turret") - -if( TORQUE_EXPERIMENTAL_EC ) - addPath("${srcDir}/T3D/components/") - addPath("${srcDir}/T3D/components/animation") - addPath("${srcDir}/T3D/components/camera") - addPath("${srcDir}/T3D/components/collision") - addPath("${srcDir}/T3D/components/game") - addPath("${srcDir}/T3D/components/physics") - addPath("${srcDir}/T3D/components/render") -endif() +addPath("${srcDir}/T3D/components/") +addPath("${srcDir}/T3D/components/animation") +addPath("${srcDir}/T3D/components/camera") +addPath("${srcDir}/T3D/components/collision") +addPath("${srcDir}/T3D/components/game") +addPath("${srcDir}/T3D/components/physics") +addPath("${srcDir}/T3D/components/render") addPath("${srcDir}/main/") addPath("${srcDir}/assets") @@ -422,9 +413,6 @@ if(TORQUE_TOOLS) addPath("${srcDir}/environment/editors") addPath("${srcDir}/forest/editor") addPath("${srcDir}/gui/editor") - if(NOT TORQUE_EXPERIMENTAL_EC) - set(BLACKLIST "entityGroup.cpp;entityGroup.h;mountingGroup.cpp;mountingGroup.h;componentGroup.cpp;componentGroup.h" ) - endif() addPath("${srcDir}/gui/editor/inspector") set(BLACKLIST "" ) endif() @@ -502,10 +490,6 @@ if(TORQUE_DEDICATED) addDef(TORQUE_DEDICATED) endif() -if(TORQUE_EXPERIMENTAL_EC) - addDef(TORQUE_EXPERIMENTAL_EC) -endif() - #modules dir file(GLOB modules "modules/*.cmake") foreach(module ${modules}) @@ -855,26 +839,6 @@ if(TORQUE_TEMPLATE) message("Prepare Template(${TORQUE_TEMPLATE}) install...") file(GLOB_RECURSE INSTALL_FILES_AND_DIRS "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/*") - IF( NOT TORQUE_EXPERIMENTAL_EC) - list(REMOVE_ITEM INSTALL_FILES_AND_DIRS "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/art/art.module.taml") - list(REMOVE_ITEM INSTALL_FILES_AND_DIRS "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/art/shapes/actors/Soldier/soldier.asset.taml") - list(REMOVE_ITEM INSTALL_FILES_AND_DIRS "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/scripts/scripts.module.taml") - - foreach(ITEM ${INSTALL_FILES_AND_DIRS}) - get_filename_component( dir ${ITEM} DIRECTORY ) - get_filename_component( fileName ${ITEM} NAME ) - if( ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/scripts/server/components - OR ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/scripts/server/components/game - OR ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/scripts/server/components/input - OR ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/scripts/server/gameObjects - OR ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/tools/componentEditor - OR ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/tools/componentEditor/gui - OR ${dir} STREQUAL ${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/game/tools/componentEditor/scripts ) - list(REMOVE_ITEM INSTALL_FILES_AND_DIRS ${dir}/${fileName}) - ENDIF() - endforeach() - ENDIF() - foreach(ITEM ${INSTALL_FILES_AND_DIRS}) get_filename_component( dir ${ITEM} DIRECTORY ) STRING(REGEX REPLACE "${CMAKE_SOURCE_DIR}/Templates/${TORQUE_TEMPLATE}/" "${TORQUE_APP_DIR}/" INSTALL_DIR ${dir})