private void placeStorageAreaWithBlocksToPlaceOn(IEnumerable <BlockLoc> blocksToPlaceSiteOn, IslandPathingProfile profile, ResourceBlock.ResourceType toStore) { List <BlockLoc> blocksForSite = new List <BlockLoc>(); HashSet <BlockLoc> alreadyOccupied = allBlocksWithJobSites(); foreach (BlockLoc inGround in blocksToPlaceSiteOn) { if (!alreadyOccupied.Contains(BlockLoc.AddIntVec3(inGround, new IntVector3(0, 1, 0)))) { blocksForSite.Add(BlockLoc.AddIntVec3(inGround, new IntVector3(0, 1, 0))); } if (!alreadyOccupied.Contains(BlockLoc.AddIntVec3(inGround, new IntVector3(0, 2, 0)))) { blocksForSite.Add(BlockLoc.AddIntVec3(inGround, new IntVector3(0, 2, 0))); } } HashSet <BlockLoc> locsNotOfWork = new HashSet <BlockLoc>(); removeAllBlocksAtOrBelowWorkBlock(blocksForSite, locsNotOfWork); if (locsNotOfWork.Count > 0) { HashSet <BlockLoc> locsNotSolid = new HashSet <BlockLoc>(); foreach (BlockLoc test in locsNotOfWork) { if (!profile.isProfileSolidAtWithWithinCheck(test)) { locsNotSolid.Add(test); } } resourceBlockJobsite.addStockpile(new Stockpile(locsNotSolid, toStore)); } }
private void handleAddVelocityAction(Vector3 velocityAddition, Actor actor, bool isFootPropelled) { Island closestIsland = islandManager.getClosestIslandToLocation(actor.getLocation()); if (closestIsland == null)// if no islands are loaded { actor.setVelocity(new Vector3()); } else { List <BlockLoc> intersectedByActor = actor.getBlocksIntersectedByAABB(); IslandPathingProfile profile = closestIsland.getPathingProfile(); if (!profile.isActorStanding(actor) && actor.canBeKnockedBack() && isFootPropelled && !Ocean.pointIsUnderWater(actor.getFootLocation())) { actor.addToVelocity(velocityAddition * .02f);//character propells slowly in midair return; } foreach (BlockLoc test in intersectedByActor) { if (profile.isProfileSolidAtWithWithinCheck(test)) { actor.setFootLocation(actor.getFootLocation() + new Vector3(0, .3f, 0)); return; } } actor.addToVelocity(velocityAddition); } }