mirror of
https://github.com/RYDE-WORK/ballistica.git
synced 2026-02-08 08:45:43 +08:00
Bomb logic cleanup
This commit is contained in:
parent
db76b650e1
commit
19e7859042
@ -718,10 +718,16 @@ class Bomb(ba.Actor):
|
|||||||
|
|
||||||
# By default our hit type/subtype is our own, but we pick up types of
|
# By default our hit type/subtype is our own, but we pick up types of
|
||||||
# whoever sets us off so we know what caused a chain reaction.
|
# whoever sets us off so we know what caused a chain reaction.
|
||||||
|
# UPDATE (July 2020): not inheriting hit-types anymore; this causes
|
||||||
|
# weird effects such as land-mines inheriting 'punch' hit types and
|
||||||
|
# then not being able to destroy certain things they normally could,
|
||||||
|
# etc. Inheriting owner/source-node from things that set us off
|
||||||
|
# should be all we need I think...
|
||||||
self.hit_type = 'explosion'
|
self.hit_type = 'explosion'
|
||||||
self.hit_subtype = self.bomb_type
|
self.hit_subtype = self.bomb_type
|
||||||
|
|
||||||
# The node this came from.
|
# The node this came from.
|
||||||
|
# FIXME: can we unify this and source_player?
|
||||||
self.owner = owner
|
self.owner = owner
|
||||||
|
|
||||||
# Adding footing-materials to things can screw up jumping and flying
|
# Adding footing-materials to things can screw up jumping and flying
|
||||||
@ -1009,11 +1015,8 @@ class Bomb(ba.Actor):
|
|||||||
|
|
||||||
# Normal bombs are triggered by non-punch impacts;
|
# Normal bombs are triggered by non-punch impacts;
|
||||||
# impact-bombs by all impacts.
|
# impact-bombs by all impacts.
|
||||||
if not ispunched and (not self._exploded
|
if (not self._exploded and
|
||||||
or self.bomb_type in ['impact', 'land_mine']):
|
(not ispunched or self.bomb_type in ['impact', 'land_mine'])):
|
||||||
# We don't want to give the credit and points to player,
|
|
||||||
# who punched the bomb of other player in a chain reaction.
|
|
||||||
# And this will protect the bomb from getting hit_type 'punch'.
|
|
||||||
|
|
||||||
# Also lets change the owner of the bomb to whoever is setting
|
# Also lets change the owner of the bomb to whoever is setting
|
||||||
# us off. (this way points for big chain reactions go to the
|
# us off. (this way points for big chain reactions go to the
|
||||||
@ -1025,13 +1028,15 @@ class Bomb(ba.Actor):
|
|||||||
# Also inherit the hit type (if a landmine sets off by a bomb,
|
# Also inherit the hit type (if a landmine sets off by a bomb,
|
||||||
# the credit should go to the mine)
|
# the credit should go to the mine)
|
||||||
# the exception is TNT. TNT always gets credit.
|
# the exception is TNT. TNT always gets credit.
|
||||||
if self.bomb_type != 'tnt':
|
# UPDATE (July 2020): not doing this anymore. Causes too much
|
||||||
self.hit_type = msg.hit_type
|
# weird logic such as bombs acting like punches. Holler if
|
||||||
self.hit_subtype = msg.hit_subtype
|
# anything is noticeably broken due to this.
|
||||||
|
# if self.bomb_type != 'tnt':
|
||||||
|
# self.hit_type = msg.hit_type
|
||||||
|
# self.hit_subtype = msg.hit_subtype
|
||||||
|
|
||||||
ba.timer(100 + int(random.random() * 100),
|
ba.timer(0.1 + random.random() * 0.1,
|
||||||
ba.WeakCall(self.handlemessage, ExplodeMessage()),
|
ba.WeakCall(self.handlemessage, ExplodeMessage()))
|
||||||
timeformat=ba.TimeFormat.MILLISECONDS)
|
|
||||||
assert self.node
|
assert self.node
|
||||||
self.node.handlemessage('impulse', msg.pos[0], msg.pos[1], msg.pos[2],
|
self.node.handlemessage('impulse', msg.pos[0], msg.pos[1], msg.pos[2],
|
||||||
msg.velocity[0], msg.velocity[1],
|
msg.velocity[0], msg.velocity[1],
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user