Skip to content

Commit 9e0d3d0

Browse files
committed
docs: update docs about Entity::hurt
1 parent 1176f2e commit 9e0d3d0

File tree

4 files changed

+86
-18
lines changed

4 files changed

+86
-18
lines changed

docs/apis/GameAPI/Entity.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -161,13 +161,15 @@ Each entity object contains some member functions (member methods) that can be e
161161

162162
#### Inflict Damage to Entities
163163

164-
`en.hurt(damage,type)`
164+
`en.hurt(damage,type,source)`
165165

166166
- Parameters:
167167
- damage : `Float`
168168
The amount of damage to deal to the entity.
169-
- type : `Integer`
169+
- type : `Integer`
170170
Actor Damage Cause
171+
- source: `Entity`
172+
Source of damage
171173
- Return value: Whether the damage was dealt.
172174
- Return value type: `Boolean`
173175

@@ -206,8 +208,6 @@ Note that the damage dealt here is real damage and cannot be reduced by protecti
206208
| `ActorDamageCause.Stalactite` |
207209
| `ActorDamageCause.Stalagmite` |
208210

209-
210-
211211
#### Heal the Entity
212212

213213
`en.heal(health)`

docs/apis/GameAPI/Entity.zh.md

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -163,19 +163,20 @@
163163

164164
#### 对实体造成伤害
165165

166-
`en.hurt(damage,type)`
166+
`en.hurt(damage,type,source)`
167167

168168
- 参数:
169169
- damage : `Float`
170170
对实体造成的伤害数值
171171
- type : `Integer`
172172
伤害类型
173+
- source : `Entity`
174+
伤害来源
173175
- 返回值:是否造成伤害
174176
- 返回值类型:`Boolean`
175177

176178
注意,此处造成的伤害为真实伤害,无法被盔甲等保护装备减免
177179

178-
179180
| 伤害类型枚举 |
180181
| ---------------------------------- |
181182
| `ActorDamageCause.Override` |
@@ -210,8 +211,6 @@
210211
| `ActorDamageCause.Stalagmite` |
211212
| `ActorDamageCause.All` |
212213

213-
214-
215214
#### 治疗实体
216215

217216
`en.heal(health)`

docs/apis/GameAPI/Player.md

Lines changed: 40 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -370,17 +370,50 @@ pl.kill();
370370

371371
#### Damage the Player
372372

373-
`pl.hurt(damage)`
374-
375373
- Parameters:
376-
- damage : `Integer`
377-
The amount of damage dealt to the player .
378-
- Return value: Whether damage was dealt.
379-
- Return value type: `Boolean`
374+
- damage : `Float`
375+
The amount of damage to deal to the player.
376+
- type : `Integer`
377+
Actor Damage Cause
378+
- source: `Entity`
379+
Source of damage
380+
- Return value: Whether the damage was dealt.
381+
- Return value type: `Boolean`
380382

381383
Note that the damage dealt here is real damage and cannot be reduced by protective equipment such as armor.
382384

383-
385+
| ActorDamageCause ENUM |
386+
| ---------------------------------- |
387+
| `ActorDamageCause.Override` |
388+
| `ActorDamageCause.Contact ` |
389+
| `ActorDamageCause.EntityAttack` |
390+
| `ActorDamageCause.Projectile` |
391+
| `ActorDamageCause.Suffocation` |
392+
| `ActorDamageCause.All` |
393+
| `ActorDamageCause.Fire` |
394+
| `ActorDamageCause.FireTick` |
395+
| `ActorDamageCause.Lava` |
396+
| `ActorDamageCause.Drowning ` |
397+
| `ActorDamageCause.BlockExplosion` |
398+
| `ActorDamageCause.EntityExplosion` |
399+
| `ActorDamageCause.Void` |
400+
| `ActorDamageCause.Suicide` |
401+
| `ActorDamageCause.Magic` |
402+
| `ActorDamageCause.Wither` |
403+
| `ActorDamageCause.Starve` |
404+
| `ActorDamageCause.Anvil` |
405+
| `ActorDamageCause.Thorns` |
406+
| `ActorDamageCause.FallingBlock` |
407+
| `ActorDamageCause.Piston` |
408+
| `ActorDamageCause.FlyIntoWall` |
409+
| `ActorDamageCause.Magma` |
410+
| `ActorDamageCause.Fireworks` |
411+
| `ActorDamageCause.Lightning` |
412+
| `ActorDamageCause.Charging` |
413+
| `ActorDamageCause.Temperature` |
414+
| `ActorDamageCause.Freezing` |
415+
| `ActorDamageCause.Stalactite` |
416+
| `ActorDamageCause.Stalagmite` |
384417

385418
#### Heal the Player
386419

docs/apis/GameAPI/Player.zh.md

Lines changed: 39 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -432,16 +432,52 @@
432432

433433
#### 对玩家造成伤害
434434

435-
`pl.hurt(damage)`
436-
437435
- 参数:
438-
- damage : `Integer`
436+
- damage : `Float`
439437
对玩家造成的伤害数值
438+
- type : `Integer`
439+
伤害类型
440+
- source : `Entity`
441+
伤害来源
440442
- 返回值:是否造成伤害
441443
- 返回值类型:`Boolean`
442444

443445
注意,此处造成的伤害为真实伤害,无法被盔甲等保护装备减免
444446

447+
| 伤害类型枚举 |
448+
| ---------------------------------- |
449+
| `ActorDamageCause.Override` |
450+
| `ActorDamageCause.Contact ` |
451+
| `ActorDamageCause.EntityAttack` |
452+
| `ActorDamageCause.Projectile` |
453+
| `ActorDamageCause.Suffocation` |
454+
| `ActorDamageCause.All` |
455+
| `ActorDamageCause.Fire` |
456+
| `ActorDamageCause.FireTick` |
457+
| `ActorDamageCause.Lava` |
458+
| `ActorDamageCause.Drowning ` |
459+
| `ActorDamageCause.BlockExplosion` |
460+
| `ActorDamageCause.EntityExplosion` |
461+
| `ActorDamageCause.Void` |
462+
| `ActorDamageCause.Suicide` |
463+
| `ActorDamageCause.Magic` |
464+
| `ActorDamageCause.Wither` |
465+
| `ActorDamageCause.Starve` |
466+
| `ActorDamageCause.Anvil` |
467+
| `ActorDamageCause.Thorns` |
468+
| `ActorDamageCause.FallingBlock` |
469+
| `ActorDamageCause.Piston` |
470+
| `ActorDamageCause.FlyIntoWall` |
471+
| `ActorDamageCause.Magma` |
472+
| `ActorDamageCause.Fireworks` |
473+
| `ActorDamageCause.Lightning` |
474+
| `ActorDamageCause.Charging` |
475+
| `ActorDamageCause.Temperature` |
476+
| `ActorDamageCause.Freezing` |
477+
| `ActorDamageCause.Stalactite` |
478+
| `ActorDamageCause.Stalagmite` |
479+
| `ActorDamageCause.All` |
480+
445481
- 示例:
446482
- JavaScript
447483
```js

0 commit comments

Comments
 (0)