Here is a snippet of what my code looks like:
Syntax: Select all
class SavedNade:
def __init__(self, entity):
self.classname = entity.classname
self.origin = entity.origin
self.angles = entity.angles
self.velocity = Vector(
entity.velocity.x,
entity.velocity.y,
entity.velocity.z
)
self.owner = entity.owner
def spawn(self):
entity = Entity.create(self.classname)
entity.spawn()
if 'hegrenade' in self.classname or 'molotov' in self.classname:
entity.call_input('InitializeSpawnFromWorld')
# Teleport entity
entity.teleport(self.origin, self.angles, self.velocity)
if 'smoke' in self.classname:
entity.gravity = 0.4
entity.friction = 0.2
entity.elasticity = 0.45
entity.delay(1.0, self.detonate, (entity.index,))
def detonate(self, entity_index):
entity = Entity(entity_index)
if entity.velocity.length > 0.1:
entity.delay(1.0, self.detonate, (entity.index,))
return
SayText2("detonate").send()
Is there any input i can call to make the smoke working as intended? Or even if there was a way to manually detonate it, that would work too.