mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 23:40:11 +02:00
make equipping of clonables more reliable
This commit is contained in:
parent
de5b5301d6
commit
195472bd43
2 changed files with 39 additions and 7 deletions
|
@ -12,7 +12,7 @@
|
||||||
LEFT_HAND, RIGHT_HAND, NEAR_GRAB_PICK_RADIUS, DEFAULT_SEARCH_SPHERE_DISTANCE, DISPATCHER_PROPERTIES,
|
LEFT_HAND, RIGHT_HAND, NEAR_GRAB_PICK_RADIUS, DEFAULT_SEARCH_SPHERE_DISTANCE, DISPATCHER_PROPERTIES,
|
||||||
getGrabPointSphereOffset, HMD, MyAvatar, Messages, findHandChildEntities, Picks, PickType, Pointers,
|
getGrabPointSphereOffset, HMD, MyAvatar, Messages, findHandChildEntities, Picks, PickType, Pointers,
|
||||||
PointerManager, getGrabPointSphereOffset, HMD, MyAvatar, Messages, findHandChildEntities, Picks, PickType, Pointers,
|
PointerManager, getGrabPointSphereOffset, HMD, MyAvatar, Messages, findHandChildEntities, Picks, PickType, Pointers,
|
||||||
PointerManager, print, Selection, DISPATCHER_HOVERING_LIST, DISPATCHER_HOVERING_STYLE, Keyboard
|
PointerManager, print, Keyboard
|
||||||
*/
|
*/
|
||||||
|
|
||||||
controllerDispatcherPlugins = {};
|
controllerDispatcherPlugins = {};
|
||||||
|
@ -53,6 +53,7 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||||
this.blacklist = [];
|
this.blacklist = [];
|
||||||
this.pointerManager = new PointerManager();
|
this.pointerManager = new PointerManager();
|
||||||
this.grabSphereOverlays = [null, null];
|
this.grabSphereOverlays = [null, null];
|
||||||
|
this.targetIDs = {};
|
||||||
|
|
||||||
// a module can occupy one or more "activity" slots while it's running. If all the required slots for a module are
|
// a module can occupy one or more "activity" slots while it's running. If all the required slots for a module are
|
||||||
// not set to false (not in use), a module cannot start. When a module is using a slot, that module's name
|
// not set to false (not in use), a module cannot start. When a module is using a slot, that module's name
|
||||||
|
@ -225,8 +226,8 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||||
if (tabletIndex !== -1 && closebyOverlays.indexOf(HMD.tabletID) === -1) {
|
if (tabletIndex !== -1 && closebyOverlays.indexOf(HMD.tabletID) === -1) {
|
||||||
nearbyOverlays.splice(tabletIndex, 1);
|
nearbyOverlays.splice(tabletIndex, 1);
|
||||||
}
|
}
|
||||||
if (miniTabletIndex !== -1
|
if (miniTabletIndex !== -1 &&
|
||||||
&& ((closebyOverlays.indexOf(HMD.miniTabletID) === -1) || h !== HMD.miniTabletHand)) {
|
((closebyOverlays.indexOf(HMD.miniTabletID) === -1) || h !== HMD.miniTabletHand)) {
|
||||||
nearbyOverlays.splice(miniTabletIndex, 1);
|
nearbyOverlays.splice(miniTabletIndex, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -336,6 +337,23 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// also make sure we have the properties from the current module's target
|
||||||
|
for (var tIDRunningPluginName in _this.runningPluginNames) {
|
||||||
|
if (_this.runningPluginNames.hasOwnProperty(tIDRunningPluginName)) {
|
||||||
|
var targetIDs = _this.targetIDs[tIDRunningPluginName];
|
||||||
|
if (targetIDs) {
|
||||||
|
for (var k = 0; k < targetIDs.length; k++) {
|
||||||
|
var targetID = targetIDs[k];
|
||||||
|
if (!nearbyEntityPropertiesByID[targetID]) {
|
||||||
|
var targetProps = Entities.getEntityProperties(targetID, DISPATCHER_PROPERTIES);
|
||||||
|
targetProps.id = targetID;
|
||||||
|
nearbyEntityPropertiesByID[targetID] = targetProps;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// bundle up all the data about the current situation
|
// bundle up all the data about the current situation
|
||||||
var controllerData = {
|
var controllerData = {
|
||||||
triggerValues: [_this.leftTriggerValue, _this.rightTriggerValue],
|
triggerValues: [_this.leftTriggerValue, _this.rightTriggerValue],
|
||||||
|
@ -402,10 +420,23 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||||
Script.beginProfileRange("dispatch.run." + runningPluginName);
|
Script.beginProfileRange("dispatch.run." + runningPluginName);
|
||||||
}
|
}
|
||||||
var runningness = plugin.run(controllerData, deltaTime);
|
var runningness = plugin.run(controllerData, deltaTime);
|
||||||
|
|
||||||
|
if (DEBUG) {
|
||||||
|
if (JSON.stringify(_this.targetIDs[runningPluginName]) != JSON.stringify(runningness.targets)) {
|
||||||
|
print("controllerDispatcher targetIDs[" + runningPluginName + "] = " +
|
||||||
|
JSON.stringify(runningness.targets));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_this.targetIDs[runningPluginName] = runningness.targets;
|
||||||
if (!runningness.active) {
|
if (!runningness.active) {
|
||||||
// plugin is finished running, for now. remove it from the list
|
// plugin is finished running, for now. remove it from the list
|
||||||
// of running plugins and mark its activity-slots as "not in use"
|
// of running plugins and mark its activity-slots as "not in use"
|
||||||
delete _this.runningPluginNames[runningPluginName];
|
delete _this.runningPluginNames[runningPluginName];
|
||||||
|
delete _this.targetIDs[runningPluginName];
|
||||||
|
if (DEBUG) {
|
||||||
|
print("controllerDispatcher deleted targetIDs[" + runningPluginName + "]");
|
||||||
|
}
|
||||||
_this.markSlots(plugin, false);
|
_this.markSlots(plugin, false);
|
||||||
_this.pointerManager.makePointerInvisible(plugin.parameters.handLaser);
|
_this.pointerManager.makePointerInvisible(plugin.parameters.handLaser);
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
|
@ -527,8 +558,9 @@ Script.include("/~/system/libraries/controllerDispatcherUtils.js");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (action === "tablet") {
|
if (action === "tablet") {
|
||||||
var tabletIDs = message.blacklist
|
var tabletIDs = message.blacklist ?
|
||||||
? [HMD.tabletID, HMD.tabletScreenID, HMD.homeButtonID, HMD.homeButtonHighlightID] : [];
|
[HMD.tabletID, HMD.tabletScreenID, HMD.homeButtonID, HMD.homeButtonHighlightID] :
|
||||||
|
[];
|
||||||
if (message.hand === LEFT_HAND) {
|
if (message.hand === LEFT_HAND) {
|
||||||
_this.leftBlacklistTabletIDs = tabletIDs;
|
_this.leftBlacklistTabletIDs = tabletIDs;
|
||||||
_this.setLeftBlacklist();
|
_this.setLeftBlacklist();
|
||||||
|
|
|
@ -595,7 +595,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
|
||||||
equipHotspotBuddy.update(deltaTime, timestamp, controllerData);
|
equipHotspotBuddy.update(deltaTime, timestamp, controllerData);
|
||||||
|
|
||||||
// if the potentialHotspot is cloneable, clone it and return it
|
// if the potentialHotspot is cloneable, clone it and return it
|
||||||
// if the potentialHotspot os not cloneable and locked return null
|
// if the potentialHotspot is not cloneable and locked return null
|
||||||
if (potentialEquipHotspot &&
|
if (potentialEquipHotspot &&
|
||||||
(((this.triggerSmoothedSqueezed() || this.secondarySmoothedSqueezed()) && !this.waitForTriggerRelease) ||
|
(((this.triggerSmoothedSqueezed() || this.secondarySmoothedSqueezed()) && !this.waitForTriggerRelease) ||
|
||||||
this.messageGrabEntity)) {
|
this.messageGrabEntity)) {
|
||||||
|
@ -603,7 +603,7 @@ EquipHotspotBuddy.prototype.update = function(deltaTime, timestamp, controllerDa
|
||||||
this.targetEntityID = this.grabbedHotspot.entityID;
|
this.targetEntityID = this.grabbedHotspot.entityID;
|
||||||
this.startEquipEntity(controllerData);
|
this.startEquipEntity(controllerData);
|
||||||
this.equipedWithSecondary = this.secondarySmoothedSqueezed();
|
this.equipedWithSecondary = this.secondarySmoothedSqueezed();
|
||||||
return makeRunningValues(true, [potentialEquipHotspot.entityID], []);
|
return makeRunningValues(true, [this.targetEntityID], []);
|
||||||
} else {
|
} else {
|
||||||
return makeRunningValues(false, [], []);
|
return makeRunningValues(false, [], []);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue