• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

First Machine Age's Mods (Combined repo.)


Commit MetaInfo

Revisãoa69ce26f3336ca6fed393b32653bdfd7112542c3 (tree)
Hora2021-02-27 10:24:50
Autormelchior <melchior@user...>
Commitermelchior

Mensagem de Log

W.I.P. working collapse

Mudança Sumário

Diff

--- a/Assorted/BlockClasses/CollapsingBlock.cs
+++ b/Assorted/BlockClasses/CollapsingBlock.cs
@@ -1,6 +1,6 @@
11 using System;
22 using System.Collections.Generic;
3-
3+using System.Threading;
44 using Vintagestory.API.Common;
55 using Vintagestory.API.Common.Entities;
66 using Vintagestory.API.Config;
@@ -12,7 +12,7 @@ namespace FirstMachineAge
1212 {
1313 public class CollapsingBlock : Block
1414 {
15- private readonly Cuboidf[ ] collapseZones = { new Cuboidf(0.1f, 0.1f, 0.0f, 0.95f, 0.95f, 0.25f) };
15+ private readonly Cuboidf[ ] collapseZones = { new Cuboidf(0.06f, 0.1f, 0.1f, 0.937f, 0.25f, 1.0f) };
1616
1717
1818 private void MabeyCollapse(IWorldAccessor localAcc, BlockPos here, float delay)
@@ -24,10 +24,9 @@ namespace FirstMachineAge
2424 //hitboxSize: { x: 0.6, y: 1.85 } > Seraph
2525 //hitboxSize: { x: 0.85, y: 0.5 }> Pup
2626 //hitboxSize: { x: 0.4, y: 0.3 } > lil'Bunny
27-
27+
2828 bool enough = false;
29- var victems = localAcc.GetIntersectingEntities(here.UpCopy( ), collapseZones);//TOP 'Surface' - excluding edges
30- //var victems = localAcc.GetEntitiesInsideCuboid(here.AddCopy(-1,-1,-1),here.AddCopy(1,1,1));//TOP 'Surface' - excluding edges
29+ var victems = localAcc.GetIntersectingEntities(here.UpCopy( ), collapseZones, (e) => { return true;});//TOP 'Surface' - excluding edges
3130
3231 foreach (var entity in victems)
3332 {
@@ -43,7 +42,9 @@ namespace FirstMachineAge
4342 }
4443
4544 if (enough) {
46- localAcc.BlockAccessor.BreakBlock(here, null, 0);
45+ localAcc.BlockAccessor.BreakBlock(here.Copy(), null);
46+ //TODO: Sound & Dust
47+
4748 }
4849
4950 }
@@ -79,16 +80,7 @@ namespace FirstMachineAge
7980
8081 #region Overrides
8182
82- //TODO: Fall apart if player tries to 'Hoe' 'Dig' or mess with block in any way, or even place things on top of it...
83- public override void OnEntityInside(IWorldAccessor world, Entity entity, BlockPos pos)
84- {
85- if (api.Side.IsClient()) return;
8683
87- //Get Ready to CRUMBLE!
88- #if DEBUG
89- ServerAPI.Logger.VerboseDebug($"OnEntityInside ({entity.Code}) of [{entity.GetType( ).Name}] @ {pos}");
90- #endif
91- }
9284
9385 public override void OnEntityCollide(IWorldAccessor world, Entity entity, BlockPos pos, BlockFacing facing, Vec3d collideSpeed, bool isImpact)
9486 {
@@ -99,7 +91,7 @@ namespace FirstMachineAge
9991 #endif
10092
10193 //Tick Callback; in 200ms...
102- ServerAPI.World.RegisterCallbackUnique(MabeyCollapse, pos ,100);
94+ ServerAPI.World.RegisterCallbackUnique(MabeyCollapse, pos.Copy() ,50);
10395 }
10496
10597 public override string GetPlacedBlockName(IWorldAccessor world, BlockPos pos)
@@ -123,6 +115,46 @@ namespace FirstMachineAge
123115 base.OnNeighbourBlockChange(world, pos, neibpos);
124116 }
125117
118+ public override bool CanCreatureSpawnOn(IBlockAccessor blockAccessor, BlockPos pos, EntityProperties type, BaseSpawnConditions sc)
119+ {
120+ return false;
121+ }
122+
123+ public override void OnBlockBroken(IWorldAccessor world, BlockPos pos, IPlayer byPlayer, float dropQuantityMultiplier = 1)
124+ {
125+ if (api.Side.IsClient( )) {
126+ //Dust
127+ /*
128+ byPlayer.Entity.World.SpawnParticles(new SimpleParticleProperties( ) {
129+ MinQuantity = 0,
130+ AddQuantity = 10,
131+ Color = ColorUtil.ToRgba(128, 128, 128, 64),
132+ MinPos = new Vec3d(posx + faceVec.X * 0.01f, posy + faceVec.Y * 0.01f, posz + faceVec.Z * 0.01f),
133+ AddPos = new Vec3d(0, 0, 0),
134+ MinVelocity = new Vec3f(
135+ 4 * faceVec.X,
136+ 4 * faceVec.Y,
137+ 4 * faceVec.Z
138+ ),
139+ AddVelocity = new Vec3f(
140+ 8 * (( float )rnd.NextDouble( ) - 0.5f),
141+ 8 * (( float )rnd.NextDouble( ) - 0.5f),
142+ 8 * (( float )rnd.NextDouble( ) - 0.5f)
143+ ),
144+ LifeLength = 0.025f,
145+ GravityEffect = 0f,
146+ MinSize = 0.03f,
147+ MaxSize = 0.4f,
148+ ParticleModel = EnumParticleModel.Quad,
149+ VertexFlags = 200,
150+ SizeEvolve = new EvolvingNatFloat(EnumTransformFunction.LINEAR, -0.15f)
151+ }, byPlayer);
152+ */
153+ }
154+
155+ base.OnBlockBroken(world, pos, byPlayer, dropQuantityMultiplier);
156+ }
157+
126158 #endregion
127159
128160
--- a/Assorted/assets/defensive/blocktypes/wood/false_floor.json
+++ b/Assorted/assets/defensive/blocktypes/wood/false_floor.json
@@ -32,7 +32,8 @@
3232 replaceable: 600,
3333 resistance: 0.4,
3434 sounds: {
35- "walk": "game:walk/stone",
35+ "walk": "game:walk/wood",
36+ "break":"game:effect/rockslide",
3637 byTool: {
3738 "Pickaxe": { hit: "game:block/rock-hit-pickaxe", break: "game:block/rock-break-pickaxe" }
3839 }
@@ -42,5 +43,10 @@
4243 translation: { x: -1.2, y: -1.1, z: -0.8 },
4344 rotation: { x: -2, y: 25, z: -78 },
4445 scale: 0.37
46+ },
47+ dropsByType: {
48+ "*": [{ type: "item", code: "game:bamboostakes", quantity: { avg: 0.7, var: 1 } } ],
49+ "*-cobblestone-*": [{ type: "item", code: "game:stone-{material}" , quantity: { avg: 0.5 } } ],
50+ "*-stonebricks-*": [{ type: "item", code: "game:stonebrick-{material}" , quantity: { avg: 0.5 } }]
4551 }
4652 }
--- a/Assorted/assets/defensive/shapes/block/wood/false_floor.json
+++ b/Assorted/assets/defensive/shapes/block/wood/false_floor.json
@@ -100,14 +100,14 @@
100100 {
101101 "name": "Psudeo_Layer",
102102 "from": [ 0.0, 4.0, -7.0 ],
103- "to": [ 16.0, 5.0, 9.0 ],
103+ "to": [ 16.0, 5.0, 9.0 ],
104104 "rotationOrigin": [ 0.0, 4.0, 8.0 ],
105105 "faces": {
106106 "north": { "texture": "#camo", "uv": [ 0.0, 0.0, 16.0, 1.0 ] },
107107 "east": { "texture": "#camo", "uv": [ 0.0, 0.0, 16.0, 1.0 ] },
108108 "south": { "texture": "#camo", "uv": [ 0.0, 0.0, 16.0, 1.0 ] },
109109 "west": { "texture": "#camo", "uv": [ 0.0, 0.0, 16.0, 1.0 ] },
110- "up": { "texture": "#camo", "uv": [ 0.0, 0.0, 16.0, 16.0 ] },
110+ "up": { "texture": "#camo", "uv": [ 0.0, 0.0, 16.0, 16.0 ], "rotation": 90 },
111111 "down": { "texture": "#camo", "uv": [ 0.0, 0.0, 16.0, 16.0 ] }
112112 }
113113 }