File tree Expand file tree Collapse file tree 2 files changed +19
-15
lines changed
Expand file tree Collapse file tree 2 files changed +19
-15
lines changed Original file line number Diff line number Diff line change @@ -203,6 +203,7 @@ import Locale, { defaultLocale } from "@/Locale";
203203import BackgroundSkin from " @/BackgroundSkin" ;
204204import TreeType from " @/TreeType" ;
205205import uuid from " @/utils/uuid" ;
206+ import LeavesGameObject from " @/gameobjects/LeavesGameObject" ;
206207
207208interface IMenuItem {
208209 id: string ;
@@ -351,20 +352,22 @@ export default class STApp extends Vue {
351352 }
352353 // todo: Can we somehow use the secondary interact mode for something here?
353354 } else {
354- const treeType = TreeType .byId (this .tree ) || TreeType .random ();
355- this .game ! .cmd .execute (
356- new AddTreeElementCommand (this .scene ! .tree , e .element .id , {
357- id: uuid (),
358- x: e .x ,
359- y: e .y ,
360- angle: this .angle ,
361- treeType: treeType .id ,
362- elementType:
363- e .mode === InteractMode .PRIMARY
364- ? TreeElementType .BRANCH
365- : TreeElementType .LEAVES
366- })
367- );
355+ if (! (e .element instanceof LeavesGameObject )) {
356+ const treeType = TreeType .byId (this .tree ) || TreeType .random ();
357+ this .game ! .cmd .execute (
358+ new AddTreeElementCommand (this .scene ! .tree , e .element .id , {
359+ id: uuid (),
360+ x: e .x ,
361+ y: e .y ,
362+ angle: this .angle ,
363+ treeType: treeType .id ,
364+ elementType:
365+ e .mode === InteractMode .PRIMARY
366+ ? TreeElementType .BRANCH
367+ : TreeElementType .LEAVES
368+ })
369+ );
370+ }
368371 }
369372 this .cache ();
370373 }
Original file line number Diff line number Diff line change @@ -111,6 +111,7 @@ export default class LeavesGameObject extends TreeElement<JSON> {
111111 }
112112
113113 addLeaves ( details : ITreeElementDetails ) : LeavesGameObject {
114+ // todo: Allow leaves on leaves
114115 throw new Error ( "Not supported." ) ;
115116 }
116117
@@ -129,7 +130,7 @@ export default class LeavesGameObject extends TreeElement<JSON> {
129130 this . treeType = TreeType . byId ( json . treeType ) || TreeType . BROADLEAF ;
130131 }
131132
132- /**
133+ /**
133134 * Called whenever the mous eleaves the branch.
134135 * @param e The pointer event.
135136 */
You can’t perform that action at this time.
0 commit comments