Add support for control interaction links in App.tsx
This commit is contained in:
@@ -292,7 +292,10 @@ import {
|
|||||||
} from "../entities/entity-labels";
|
} from "../entities/entity-labels";
|
||||||
import { listNpcActorUsages } from "../entities/npc-actor-registry";
|
import { listNpcActorUsages } from "../entities/npc-actor-registry";
|
||||||
import {
|
import {
|
||||||
|
formatControlEffectValue,
|
||||||
|
formatControlTargetRef,
|
||||||
areInteractionLinksEqual,
|
areInteractionLinksEqual,
|
||||||
|
createControlInteractionLink,
|
||||||
createPlayAnimationInteractionLink,
|
createPlayAnimationInteractionLink,
|
||||||
createPlaySoundInteractionLink,
|
createPlaySoundInteractionLink,
|
||||||
createStopAnimationInteractionLink,
|
createStopAnimationInteractionLink,
|
||||||
@@ -1197,6 +1200,8 @@ function getInteractionActionLabel(link: InteractionLink): string {
|
|||||||
return "Play Sound";
|
return "Play Sound";
|
||||||
case "stopSound":
|
case "stopSound":
|
||||||
return "Stop Sound";
|
return "Stop Sound";
|
||||||
|
case "control":
|
||||||
|
return "Control Effect";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -6626,6 +6631,14 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
|||||||
targetSoundEmitterId: link.action.targetSoundEmitterId
|
targetSoundEmitterId: link.action.targetSoundEmitterId
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
case "control":
|
||||||
|
nextLink = createControlInteractionLink({
|
||||||
|
id: link.id,
|
||||||
|
sourceEntityId: link.sourceEntityId,
|
||||||
|
trigger,
|
||||||
|
effect: link.action.effect
|
||||||
|
});
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
commitInteractionLinkChange(
|
commitInteractionLinkChange(
|
||||||
@@ -6645,6 +6658,13 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (actionType === "control") {
|
||||||
|
setStatusMessage(
|
||||||
|
"Control links are not authored from this inspector yet."
|
||||||
|
);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (actionType === "teleportPlayer") {
|
if (actionType === "teleportPlayer") {
|
||||||
const defaultTarget = teleportTargetOptions[0]?.entity;
|
const defaultTarget = teleportTargetOptions[0]?.entity;
|
||||||
|
|
||||||
@@ -7119,6 +7139,7 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
|||||||
<option value="stopAnimation">Stop Animation</option>
|
<option value="stopAnimation">Stop Animation</option>
|
||||||
<option value="playSound">Play Sound</option>
|
<option value="playSound">Play Sound</option>
|
||||||
<option value="stopSound">Stop Sound</option>
|
<option value="stopSound">Stop Sound</option>
|
||||||
|
<option value="control">Control Effect</option>
|
||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
@@ -7297,7 +7318,7 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
|||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
) : (
|
) : link.action.type === "stopAnimation" ? (
|
||||||
<div className="form-section">
|
<div className="form-section">
|
||||||
<label className="form-field">
|
<label className="form-field">
|
||||||
<span className="label">Instance</span>
|
<span className="label">Instance</span>
|
||||||
@@ -7325,6 +7346,29 @@ export function App({ store, initialStatusMessage }: AppProps) {
|
|||||||
</select>
|
</select>
|
||||||
</label>
|
</label>
|
||||||
</div>
|
</div>
|
||||||
|
) : (
|
||||||
|
<div className="form-section">
|
||||||
|
<div className="vector-inputs vector-inputs--two">
|
||||||
|
<label className="form-field">
|
||||||
|
<span className="label">Target</span>
|
||||||
|
<input
|
||||||
|
className="text-input"
|
||||||
|
type="text"
|
||||||
|
value={formatControlTargetRef(link.action.effect.target)}
|
||||||
|
readOnly
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
<label className="form-field">
|
||||||
|
<span className="label">Value</span>
|
||||||
|
<input
|
||||||
|
className="text-input"
|
||||||
|
type="text"
|
||||||
|
value={formatControlEffectValue(link.action.effect)}
|
||||||
|
readOnly
|
||||||
|
/>
|
||||||
|
</label>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
)}
|
)}
|
||||||
|
|
||||||
<div className="inline-actions">
|
<div className="inline-actions">
|
||||||
|
|||||||
Reference in New Issue
Block a user