|
|
"use strict";(self.webpackChunkplaycanvas_game=self.webpackChunkplaycanvas_game||[]).push([[392],{392:(e,t,i)=>{i.r(t),i.d(t,{default:()=>a});const a={id:"supply_collection",title:"Supply Collection: Warehouse Operations",type:"mission",objectives:[{id:"warehouse_arrival",name:"Report to Warehouse",description:"Check in with the warehouse supervisor",type:"simple",rewards:{experience:10}},{id:"collect_supplies",name:"Collect Supply Items",description:"Gather items from storage crates around the warehouse",type:"counter",target:7,rewards:{experience:50}},{id:"repair_equipment",name:"Repair Equipment",description:"Use tools at the maintenance workbench",type:"simple",rewards:{experience:25}},{id:"deliver_package",name:"Final Delivery",description:"Deliver the special package to complete operations",type:"simple",rewards:{experience:75,items:[{id:"completion_badge",quantity:1}]}}],state:{cratesCollected:new Set,workbenchUsed:!1,packageDelivered:!1,supervisorSpoken:!1},async build(e,t,i){console.log("[SupplyCollection] Building warehouse operations mission...");const a=t.createRoom({size:[30,5,25],position:[0,0,0],lighting:"ambient"});a.name="WarehouseRoom",e.root.addChild(a);const o=i.createNPC("warehouse_supervisor",{position:[-12,0,-10],displayName:"Supervisor Chen",dialogue:{greeting:"Welcome to the warehouse! Ready for your supply collection duties?",topics:{duties:"Collect items from the storage crates and use the repair tools.",status:"How's the collection going? Don't forget the maintenance tasks!",completion:"Excellent work! The warehouse operations are running smoothly."}}});o.tags.add("warehouse_staff"),a.addChild(o);const s=i.createNPC("storage_clerk",{position:[12,0,8],displayName:"Storage Clerk Anna",dialogue:{greeting:"I manage all the storage operations here.",topics:{inventory:"Check all the crates - they contain various supplies we need.",package:"There's a special delivery package in the golden crate when you're ready.",help:"Need anything? I can guide you to the storage areas."}}});s.tags.add("warehouse_staff"),a.addChild(s);const n=["health_potion","stamina_potion","wrench","security_keycard","health_potion","medical_supplies","stamina_potion"];this.storageCrates=[],[[-10,0,-5],[10,0,-5],[0,0,10],[-8,0,5],[8,0,5],[-5,0,-2],[5,0,-2]].forEach((e,t)=>{const o=i.create(`StorageCrate_${t}`,{components:{model:{type:"box"},collision:{type:"box",halfExtents:[1,1,1]},rigidbody:{type:"static"}},position:[e[0],e[1]+1,e[2]],scale:[2,2,2],tags:["interactive","storage_crate"]});o._interactionData={type:"storage_crate",crateIndex:t,itemId:n[t],isEmpty:!1},setTimeout(()=>{if(o.model&&o.model.meshInstances){const e=new pc.StandardMaterial;switch(n[t]){case"health_potion":e.diffuse=new pc.Color(.8,.2,.2);break;case"stamina_potion":e.diffuse=new pc.Color(.2,.2,.8);break;case"wrench":e.diffuse=new pc.Color(.6,.6,.6);break;case"security_keycard":e.diffuse=new pc.Color(.8,.8,.2);break;default:e.diffuse=new pc.Color(.6,.4,.2)}e.update(),o.model.meshInstances.forEach(t=>t.material=e)}},100),a.addChild(o),this.storageCrates.push(o)});const r=i.create("MaintenanceWorkbench",{components:{model:{type:"box"},collision:{type:"box",halfExtents:[1.5,.5,1]},rigidbody:{type:"static"}},position:[-5,.5,10],scale:[3,1,2],tags:["interactive","workbench"]});r._interactionData={type:"workbench",used:!1},setTimeout(()=>{if(r.model&&r.model.meshInstances){const e=new pc.StandardMaterial;e.diffuse=new pc.Color(.4,.4,.5),e.metalness=.8,e.update(),r.model.meshInstances.forEach(t=>t.material=e)}},100),a.addChild(r);const c=i.create("DeliveryBox",{components:{model:{type:"box"},collision:{type:"box",halfExtents:[1,1,1]},rigidbody:{type:"static"}},position:[0,1,8],scale:[2,2,2],tags:["interactive","delivery_point"]});return c._interactionData={type:"delivery",completed:!1},setTimeout(()=>{if(c.model&&c.model.meshInstances){const e=new pc.StandardMaterial;e.diffuse=new pc.Color(.8,.6,.2),e.emissive=new pc.Color(.2,.15,.05),e.emissiveIntensity=.3,e.metalness=.8,e.update(),c.model.meshInstances.forEach(t=>t.material=e)}},100),a.addChild(c),this.workbench=r,this.deliveryBox=c,console.log("[SupplyCollection] Warehouse operations mission built successfully"),a},onLoad(e,t){console.log("[SupplyCollection] Mission loaded, setting up objectives...");const i=t.getSystem("objectivemanager");i&&(i.clearAllObjectives(),this.objectives.forEach(e=>{i.defineObjective(e.id,e)}),i.startObjective("warehouse_arrival")),this.setupInteractions(e,t),e.fire("ui:notification",{text:"Supply Collection Mission: Report to warehouse supervisor",type:"info",duration:5e3})},setupInteractions(e,t){const i=t.getSystem("objectivemanager"),a=t.getSystem("inventorymanager"),o=t=>{console.log(`[SupplyCollection] Interacting with NPC: ${t}`),"warehouse_supervisor"!==t||this.state.supervisorSpoken||(this.state.supervisorSpoken=!0,i&&i.isObjectiveActive("warehouse_arrival")&&(i.completeObjective("warehouse_arrival"),i.startObjective("collect_supplies"),e.fire("ui:notification",{text:'Supervisor Chen: "Collect items from all storage crates around the warehouse."',type:"info",duration:4e3}))),"storage_clerk"===t&&e.fire("ui:notification",{text:'Anna: "Keep up the good work! Check all the colored crates for supplies."',type:"info",duration:3e3})};e.on("npc:interact",o),this.npcHandler=o;const s=t=>{const o=e.root.findByName(t);if(!o||!o._interactionData)return;const s=o._interactionData;if("storage_crate"!==s.type||s.isEmpty)"workbench"!==s.type||s.used||this.state.workbenchUsed?"delivery"!==s.type||s.completed||this.state.packageDelivered||(a&&a.hasItem("annas_package")?(this.state.packageDelivered=!0,s.completed=!0,a.removeItem("annas_package",1),i&&(i.isObjectiveActive("deliver_package")||i.startObjective("deliver_package"),i.completeObjective("deliver_package")),e.fire("ui:notification",{text:"Package delivered successfully! Mission Complete! (+75 XP)",type:"success",duration:5e3})):e.fire("ui:notification",{text:"Need the special package to make this delivery",type:"warning",duration:2e3})):a&&a.hasItem("wrench")?(this.state.workbenchUsed=!0,s.used=!0,i&&i.isObjectiveActive("repair_equipment")?i.completeObjective("repair_equipment"):i&&(i.startObjective("repair_equipment"),i.completeObjective("repair_equipment")),e.fire("ui:notification",{text:"Used wrench to repair equipment! (+25 XP)",type:"success",duration:3e3})):e.fire("ui:notification",{text:"Need a wrench to repair this equipment",type:"warning",duration:2e3});else if(a&&a.pickupItem(s.itemId,1)){if(this.state.cratesCollected.add(s.crateIndex),s.isEmpty=!0,o.model&&o.model.meshInstances){const e=new pc.StandardMaterial;e.diffuse=new pc.Color(.3,.3,.3),e.update(),o.model.meshInstances.forEach(t=>t.material=e)}i&&i.isObjectiveActive("collect_supplies")&&i.updateObjective("collect_supplies",this.state.cratesCollected.size),e.fire("ui:notification",{text:`Collected ${s.itemId}!`,type:"success",duration:2e3})}};e.on("interaction:triggered",s),this.interactionHandler=s},onUnload(e,t){console.log("[SupplyCollection] Cleaning up supply collection mission..."),this.npcHandler&&(e.off("npc:interact",this.npcHandler),this.npcHandler=null),this.interactionHandler&&(e.off("interaction:triggered",this.interactionHandler),this.interactionHandler=null),e.root.findByTag("npc").forEach(e=>{e.cleanupLabel&&e.cleanupLabel()}),this.state&&(this.state.cratesCollected.clear(),this.state.workbenchUsed=!1,this.state.packageDelivered=!1,this.state.supervisorSpoken=!1),this.storageCrates=null,this.workbench=null,this.deliveryBox=null}}}}]); |