Code: Select all
help me!!!! please make the roket launcher code partfrom pyspades.server import orientation_data, grenade_packet
from pyspades.common import coordinates, Vertex3
from pyspades.constants import *
from pyspades.world import Grenade
def apply_script(protocol, connection, config):
class RocketlauncherConnection(connection):
def on_hit(self, hit_amount, hit_player, type):
if type != GRENADE_KILL and self.weapon == SHOTGUN_WEAPON:
return False
return connection.on_hit(self, hit_amount, hit_player, type)
def on_shoot_set(self, fire):
if self.weapon == SHOTGUN_WEAPON and self.tool == WEAPON_TOOL and fire == True:
else:
return connection.on_shoot_set(self, fire)
if fire == True:
value = 0.5
else:
return connection.on_shoot_set(self, fire)
x, y, z = self.world_object.orientation.x, self.world_object.orientation.y, self.world_object.orientation.z
mod = 8.0
grenade_packet.value = value
grenade_packet.player_id = self.player_id
grenade_packet.position = (self.world_object.position.x, self.world_object.position.y, self.world_object.position.z)
grenade_packet.velocity = (x * mod, y * mod, z * mod)
self.protocol.send_contained(grenade_packet)
position = Vertex3(self.world_object.position.x, self.world_object.position.y, self.world_object.position.z)
velocity = Vertex3(x * mod, y * mod, z * mod)
airstrike = self.protocol.world.create_object(Grenade, value,
position, None,
velocity, self.grenade_exploded)
connection.on_shoot_set(self, fire)
return protocol, RocketlauncherConnection