Testhostplaycanvasmobile / 585.bundle.js
kwabs22
First commit after mobile control creation
0bc2025
"use strict";(self.webpackChunkplaycanvas_game=self.webpackChunkplaycanvas_game||[]).push([[585],{585:(e,t,a)=>{a.r(t),a.d(t,{default:()=>o});const o={name:"Garage Scene",description:"A practice area for experimenting with 3D objects and configurations",async build(e,t,a){console.log("[GarageScene] Building garage practice area...");const o=a.create("GarageRoot",{position:[0,0,0],tags:["scene_root"]}),i=t.createRoom({size:[30,5,25],position:[0,0,0],lighting:"workshop"});i.name="GarageRoom",o.addChild(i);const c=a.createLight("point",{color:new pc.Color(1,1,.9),intensity:2.5,range:15,position:[-8,4,0]});i.addChild(c);const s=a.createLight("point",{color:new pc.Color(1,1,.9),intensity:2.5,range:15,position:[8,4,0]});i.addChild(s),this.createPracticeObjects(i,a),this.createWorkbench(i,a),this.createDisplayShelves(i,a),this.createToolStorage(i,a);const r=a.create("ControlPanel",{components:{model:{type:"box"},collision:{type:"box",halfExtents:[1,.8,.2]},rigidbody:{type:"static"}},position:[0,1.6,-12],scale:[2,1.6,.4],tags:["interactive","control_panel"]});if(r.model){const e=new pc.StandardMaterial;e.diffuse=new pc.Color(.2,.2,.3),e.emissive=new pc.Color(.05,.1,.2),e.update(),r.model.material=e}i.addChild(r);const n=a.create("SpawnPoint",{position:[0,0,10],tags:["spawn"]});return o.addChild(n),console.log("[GarageScene] Garage built successfully"),o},createPracticeObjects(e,t){[{name:"Cube_Practice",type:"box",pos:[-10,1,-5],scale:[2,2,2],color:[1,0,0]},{name:"Sphere_Practice",type:"sphere",pos:[-10,1,0],scale:[1.5,1.5,1.5],color:[0,1,0]},{name:"Cylinder_Practice",type:"cylinder",pos:[-10,1,5],scale:[1.5,3,1.5],color:[0,0,1]},{name:"Engine_Mock",type:"box",pos:[0,1.5,-8],scale:[3,3,4],color:[.5,.5,.6]},{name:"Gear_Large",type:"cylinder",pos:[5,1,-5],scale:[2,.5,2],color:[.8,.6,.2]},{name:"Gear_Small",type:"cylinder",pos:[8,1,-3],scale:[1,.3,1],color:[.8,.6,.2]},{name:"Movable_Block",type:"box",pos:[10,1,0],scale:[1.5,1.5,1.5],color:[1,.5,0],movable:!0},{name:"Rotating_Disc",type:"cylinder",pos:[5,.2,5],scale:[3,.4,3],color:[.7,.3,.9],rotating:!0}].forEach(a=>{const o=t.create(a.name,{components:{model:{type:a.type},collision:{type:a.type},rigidbody:{type:a.movable?"dynamic":"static"}},position:a.pos,scale:a.scale,tags:["practice_object","interactive",a.movable?"movable":"static"]});if(o.model){const e=new pc.StandardMaterial;e.diffuse=new pc.Color(a.color[0],a.color[1],a.color[2]),e.update(),o.model.material=e}a.rotating&&(o.rotationSpeed=.5,o.script={update:function(e){this.entity.rotate(0,this.rotationSpeed*e*60,0)}.bind({entity:o,rotationSpeed:o.rotationSpeed})}),e.addChild(o)})},createWorkbench(e,t){const a=t.create("Workbench",{components:{model:{type:"box"},collision:{type:"box",halfExtents:[3,.4,1.5]},rigidbody:{type:"static"}},position:[-5,.8,8],scale:[6,.8,3],tags:["furniture","workbench","interactive"]});if(a.model){const e=new pc.StandardMaterial;e.diffuse=new pc.Color(.6,.4,.2),e.update(),a.model.material=e}e.addChild(a),[[-6,1.2,8,"Hammer"],[-5,1.2,7,"Wrench"],[-4,1.2,8.5,"Screwdriver"]].forEach(([a,o,i,c])=>{const s=t.create(c,{components:{model:{type:"box"},collision:{type:"box",halfExtents:[.2,.1,.8]},rigidbody:{type:"dynamic"}},position:[a,o,i],scale:[.4,.2,1.6],tags:["tool","interactive"]});if(s.model){const e=new pc.StandardMaterial;e.diffuse=new pc.Color(.7,.7,.8),e.update(),s.model.material=e}e.addChild(s)})},createDisplayShelves(e,t){[{pos:[12,2,-10],items:["Component_A","Component_B","Component_C"]},{pos:[12,2,0],items:["Part_X","Part_Y","Part_Z"]},{pos:[12,2,10],items:["Module_1","Module_2","Module_3"]}].forEach((a,o)=>{const i=t.create(`Shelf_${o}`,{components:{model:{type:"box"},collision:{type:"box",halfExtents:[1,2,.2]},rigidbody:{type:"static"}},position:a.pos,scale:[2,4,.4],tags:["furniture","shelf"]});if(i.model){const e=new pc.StandardMaterial;e.diffuse=new pc.Color(.4,.3,.2),e.update(),i.model.material=e}e.addChild(i),a.items.forEach((o,i)=>{const c=t.create(o,{components:{model:{type:"box"},collision:{type:"box",halfExtents:[.3,.3,.3]},rigidbody:{type:"dynamic"}},position:[a.pos[0]-.8,a.pos[1]+(i-1),a.pos[2]+.5],scale:[.6,.6,.6],tags:["component","interactive"]});if(c.model){const e=new pc.StandardMaterial,t=[[.8,.2,.2],[.2,.8,.2],[.2,.2,.8]],a=t[i%t.length];e.diffuse=new pc.Color(a[0],a[1],a[2]),e.update(),c.model.material=e}e.addChild(c)})})},createToolStorage(e,t){const a=t.create("ToolCabinet",{components:{model:{type:"box"},collision:{type:"box",halfExtents:[1,2,.5]},rigidbody:{type:"static"}},position:[-12,2,8],scale:[2,4,1],tags:["furniture","storage","interactive"]});if(a.model){const e=new pc.StandardMaterial;e.diffuse=new pc.Color(.3,.3,.4),e.update(),a.model.material=e}e.addChild(a),[[-8,.5,10],[-6,.5,10],[-4,.5,10]].forEach((a,o)=>{const i=t.create(`PartsBin_${o}`,{components:{model:{type:"box"},collision:{type:"box",halfExtents:[.8,.5,.8]},rigidbody:{type:"static"}},position:a,scale:[1.6,1,1.6],tags:["storage","interactive"]});if(i.model){const e=new pc.StandardMaterial;e.diffuse=new pc.Color(.6,.6,.7),e.update(),i.model.material=e}e.addChild(i)})},objectives:[{id:"garage_familiarization",name:"Explore the Garage",description:"Familiarize yourself with the practice area",type:"simple",autoStart:!0,rewards:{experience:10}},{id:"interact_objects",name:"Test Object Interactions",description:"Interact with 5 different practice objects",type:"counter",target:5,progress:0,rewards:{experience:30}},{id:"use_workbench",name:"Use the Workbench",description:"Interact with the workbench area",type:"simple",rewards:{experience:20}},{id:"access_storage",name:"Check Storage Areas",description:"Access tool cabinet and parts bins",type:"counter",target:4,progress:0,rewards:{experience:25}},{id:"master_garage",name:"Garage Master",description:"Complete all garage practice activities",type:"simple",prerequisites:["interact_objects","use_workbench","access_storage"],rewards:{experience:100,items:[{id:"garage_key",quantity:1}]}}],state:{objectsInteracted:new Set,workbenchUsed:!1,storageAccessed:new Set,completionInProgress:!1},onLoad(e,t){console.log("[GarageScene] Scene loaded, setting up practice objectives...");const a=t.getSystem("objectivemanager");a&&(a.clearAllObjectives(),this.objectives.forEach(e=>{a.defineObjective(e.id,e)}),a.startObjective("garage_familiarization")),this.setupInteractions(e,t),this.setupObjectiveListeners(e,a),e.fire("ui:notification",{text:"Welcome to the Practice Garage! Experiment with 3D objects here.",type:"info",duration:5e3}),setTimeout(()=>{a&&(a.completeObjective("garage_familiarization"),a.startObjective("interact_objects"),a.startObjective("use_workbench"),a.startObjective("access_storage"))},3e3)},setupInteractions(e,t){const a=t.getSystem("objectivemanager"),o=t=>{console.log(`[GarageScene] Interacting with: ${t}`),(t.includes("Practice")||t.includes("Mock")||t.includes("Gear")||t.includes("Block")||t.includes("Disc"))&&(this.state.objectsInteracted.has(t)||(this.state.objectsInteracted.add(t),e.fire("ui:notification",{text:`Examined: ${t.replace(/_/g," ")}`,type:"info",duration:2e3}),a&&a.isObjectiveActive("interact_objects")&&a.updateObjective("interact_objects",this.state.objectsInteracted.size))),"Workbench"!==t||this.state.workbenchUsed||(this.state.workbenchUsed=!0,e.fire("ui:notification",{text:"Workbench accessed - Ready for projects!",type:"success",duration:3e3}),a&&a.completeObjective("use_workbench")),"ToolCabinet"!==t&&!t.startsWith("PartsBin_")||this.state.storageAccessed.has(t)||(this.state.storageAccessed.add(t),e.fire("ui:notification",{text:`Accessed: ${t.replace(/_/g," ")}`,type:"info",duration:2e3}),a&&a.isObjectiveActive("access_storage")&&a.updateObjective("access_storage",this.state.storageAccessed.size)),"ControlPanel"===t&&e.fire("ui:notification",{text:"Control Panel: All systems operational. Practice mode active.",type:"info",duration:4e3})};e.on("interaction:triggered",o),this.interactHandler=o},setupObjectiveListeners(e,t){if(!t)return;const a=a=>{console.log(`[GarageScene] Objective completed: ${a}`),["interact_objects","use_workbench","access_storage"].includes(a)&&this.checkMasterGaragePrerequisites(t,e)};e.on("objective:completed",a),this.objectiveCompleteHandler=a},checkMasterGaragePrerequisites(e,t){this.state.completionInProgress||["interact_objects","use_workbench","access_storage"].every(t=>{const a=e.objectives.get(t);return a&&"completed"===a.state})&&(console.log("[GarageScene] All prerequisites met, starting master_garage objective"),this.state.completionInProgress=!0,e.startObjective("master_garage"),setTimeout(()=>{e.completeObjective("master_garage"),t.fire("ui:notification",{text:"Garage Master Achievement Unlocked! You've mastered the practice area.",type:"success",duration:6e3}),this.state.completionInProgress=!1},2e3))},onUnload(e,t){console.log("[GarageScene] Cleaning up garage scene..."),this.interactHandler&&(e.off("interaction:triggered",this.interactHandler),this.interactHandler=null),this.objectiveCompleteHandler&&(e.off("objective:completed",this.objectiveCompleteHandler),this.objectiveCompleteHandler=null),this.state&&(this.state.objectsInteracted?.clear(),this.state.storageAccessed?.clear(),this.state.workbenchUsed=!1,this.state.completionInProgress=!1)}}}}]);