Infinideastudio / NEWorld

NEWorld is a free game with similar game rules to Minecraft.
116 stars 29 forks source link

explosionPower shouldn't be stored in NWblocktype #99

Closed jacky8399 closed 6 years ago

jacky8399 commented 8 years ago

explosionPower should instead be stored in an Explosion class created on-the-fly. Also, the fields translucent and opaque are useful to the client only, and should not be stored in NWblocktype.

harrynull commented 8 years ago

explosionPower is a property of a block, so there is nothing wrong to store it in NWblocktype. Fields translucent and opaque can also be useful in server-side. A example is beacon in Minecraft.

jacky8399 commented 8 years ago

explosionPower is a property of a block, so there is nothing wrong to store it in NWblocktype.

But not every block have the ability to explode, and adding that to the struct would be redundant. Blocks can make an explosionPower field their own.

Miigon commented 8 years ago

explosionPower is a property of a block, so there is nothing wrong to store it in NWblocktype.

I agree with.

Fields translucent and opaque can also be useful in server-side. A example is beacon in Minecraft.

I think it's not very useful but in order to keep the code uniform,I approve of it

Miigon commented 8 years ago

@abc612008 Does explosionPower mean "The ability of anti explosion"?

jacky8399 commented 8 years ago

Does explosionPower mean "The ability of anti explosion"?

If that's what it means, it should be renamed to explosionResistance in order to prevent ambiguity.

harrynull commented 8 years ago

I got the point. A system which is used to store specific block information may be need to be built.

harrynull commented 8 years ago

However, removing the fields translucent and opaque in server-side is not necessary and not worthy. It can bring different behaviors and make the game become difficult to develop and maintain.

Miigon commented 8 years ago

@abc612008 yes,you're right but,can you explain what explosionPower means?

bridgekat commented 8 years ago

就是爆炸强度,不会炸就是0,炸得越厉害就越大

bridgekat commented 8 years ago

这种细节能不能不要纠结了啊(╯‵□′)╯︵┻━┻ 本来根本没啥事的地方(BlockType多点东西又不占多大内存)还说要改 这种冗余要是都改的话又麻烦又复杂

harrynull commented 8 years ago

233

jacky8399 commented 8 years ago

这种细节能不能不要纠结了啊(╯‵□′)╯︵┻━┻ 本来根本没啥事的地方(BlockType多点东西又不占多大内存)还说要改

blockType裏居然不保存比較重要的luminosity 而保存無關重要的explosionPower,這就是設計上的問題了吧。

況且,如果允許blockType加入任何property of block的話,將來是不是會在blockType加入liquidDensity, blockMobility, liquidMobility呢?

这种冗余要是都改的话又麻烦又复杂

寫程序不麻煩嗎? 修bug不麻煩嗎? 現在不改的話,將來再改不會變得更複雜嗎?

Finally, 中國有一句話,叫細節決定成敗

harrynull commented 8 years ago

没存luminosity是因为现在没用到,blocktype还没定稿

jacky8399 commented 8 years ago

没存luminosity是因为现在没用到,blocktype还没定稿

BlockData brightness?

harrynull commented 8 years ago

luminosity和brightness有区别?

jacky8399 commented 8 years ago

luminosity是一個方塊發出的亮度 brightness是當前方塊的亮度 吧

Miigon commented 8 years ago

explosionPower是爆炸威力吧 为什么不把爆炸做成触发器事件之类的呢? 比如,规定方块被打火石右键之后就生成一个点燃的实体,这个实体又有一个事件是在几秒后爆炸 这样会灵活很多

taxerap commented 7 years ago

luminosity指的是光度,常是科学名词,不同领域好像都有不同定义……; brightness指的是东西未经任何阻挡或处理_自行_发出来的亮度; luminance指的是辉度,中文不知道怎么定义……大概是发光能力; 干脆就叫illuminance好了,单位流明233

taxerap commented 7 years ago

至于爆炸威力……为什么不专门弄个Virtual Class叫explosive呢……

jacky8399 commented 7 years ago

至于爆炸威力……为什么不专门弄个Virtual Class叫explosive呢……

我本來打算提議弄個像Minecraft一樣的Explosion class 當觸發爆炸時new Explosion(world, radius) 然後由Explosion計算爆炸影響的方塊和生物 但是 他們已經打算把explosionPower硬編碼了 也代表Explosion class不可能出現了

jacky8399 commented 7 years ago

至于爆炸威力……为什么不专门弄个Virtual Class叫explosive呢……

話說你這樣 如果不是int getExplosionForce(WorldObj wld, BlockPos pos)而是int getExplosionForce()的話 基本上就跟硬編碼沒有分別了吧..

taxerap commented 7 years ago

@jacky8399 好吧,我还没看完(guo)NW的代码,还以为Explosion已经弄好了

Miigon commented 7 years ago

@jacky8399 说的和我想的一致 不同意explosionPower

bridgekat commented 7 years ago

那先去掉就是了

jacky8399 commented 7 years ago

qzr對我:

这种细节能不能不要纠结了啊(╯‵□′)╯︵┻━┻

qzr對@Miigon dalao

那先去掉就是了

taxerap commented 7 years ago

这后面可能有不可告re

bridgekat commented 7 years ago

@jacky8399 1、这两句话想表达的意思其实是一样的 2、我是回复你的,然后close了issue,可是又被批判之后reopen了,然后我就必须稍微作出让步,才有了后一句话

jacky8399 commented 7 years ago

QAQ

charlesdong commented 7 years ago

同意。记得以前的NW代码里的方块属性里竟然有一个bool canExplode(大概是刚加入TNT时),这个真的没有必要,因为从ID就可以判断出来能不能爆炸了。 I agree. I remember in the past, there's even a bool canExplode in the block property of NW. That's really unnecessary. Because you can know if the block can explode directly from its ID.

jacky8399 commented 7 years ago

直接用id判斷能不能爆炸不就硬編碼了嗎.

boolean canExplode(Block b) {
    return b.getBlockId() == 46; //TNT in Minecraft
}

我的意思是像MC這樣

/* 大概是createExplosion(@Nullable Entity e, float x, float y, float z, float exlosionPower, boolean createFire) */
public boolean onBlockActivated(/*args*/) {
    worldIn.createExplosion((Entity) null, posX, posY, posZ, 4.0F, true);
}

或者是

worldIn.addExplosion(new Explosion(posX, posY, posZ, 4.0F, false))

這樣

charlesdong commented 7 years ago

关于硬编码,可以用符号标记代表ID,例如AIR为0,TNT为46。代码大概这样: public boolean canExplode(int id) { return id == TNT; } 或者通过名字: public boolean canExplode(int id) { return getNameById(id) == "TNT"; }

jacky8399 commented 7 years ago

我再重申一遍,我堅持不要硬編碼

Miigon commented 7 years ago

不要硬编码

harrynull commented 7 years ago

不要硬编码

taxerap commented 7 years ago

硬编码在有plugin系统下肯定不能要的啊……至少要让插件和config有修改数值的能力