Re: Build and Shoot News Letter #3
Posted: Fri Mar 15, 2013 6:30 pm
Strozzi wrote:EEK! A blue sympatist! Kill it with fire!!!
Ace of Spades / OpenSpades
http://www.buildandshoot.com/forums/
http://www.buildandshoot.com/forums/viewtopic.php?f=2&t=2691
Strozzi wrote:EEK! A blue sympatist! Kill it with fire!!!
from commands import *
from pyspades.world import *
from pyspades.constants import *
from pyspades.server import *
from pyspades.common import *
MAX_BLOOD = 250
BLOOD_COLOR = (175, 20, 20)
def apply_script(protocol, connection, config):
class BloodConnection(connection):
def on_hit(hitter, hit_amount, hittee, type, grenade):
#hitter.protocol.send_chat("on hit: " + hitter.name + ", " + str(hit_amount) + ", " + hittee.name + ", " + str(type) + ", " + str(grenade))
result = connection.on_hit(hitter, hit_amount, hittee, type, grenade)
if result == False or result <= 0 or MAX_BLOOD <= 0:
return result
if result is not None:
hit_amount = result
#hitter.protocol.send_chat("hit not cancelled, new damage " + str(hit_amount))
pos = hittee.world_object.position
pos2 = hitter.world_object.position
for i in range(min(10, int(hit_amount / 10) + 1)):
#hitter.protocol.send_chat("trace")
dir = pos - pos2
dir.normalize()
dir.x = dir.x + random.random() * 0.4 - 0.2
dir.y = dir.y + random.random() * 0.4 - 0.2
dir.z = dir.z + random.random() - 0.2
dir.normalize()
c = Character(hittee.world_object.world, pos, dir)
loc = c.cast_ray()
if loc:
#if cast_ray(hittee.world_object.world.map.map, pos.x, pos.y, pos.z, dir.x, dir.y, dir.z, 8, x, y, z):
x, y, z = loc
#hitter.protocol.send_chat(str(x) + ", " + str(y) + ", " + str(z) + ", ray found")
if x < 0 or y < 0 or z < 0 or x >= 512 or y >= 512 or z >= 63:
continue
#hitter.protocol.send_chat("painting")
if hitter.protocol.map.get_color(x, y, z) == BLOOD_COLOR:
continue
if hitter.protocol.index >= MAX_BLOOD:
solid = hitter.protocol.map.get_point(hitter.protocol.blood[hitter.protocol.index % MAX_BLOOD][0], hitter.protocol.blood[hitter.protocol.index % MAX_BLOOD][1], hit
ter.protocol.blood[hitter.protocol.index % MAX_BLOOD][2])
if solid and hitter.protocol.blood[hitter.protocol.index % MAX_BLOOD][3] is not None:
hitter.protocol.map.set_point(hitter.protocol.blood[hitter.protocol.index % MAX_BLOOD][0], hitter.protocol.blood[hitter.protocol.index % MAX_BLOOD][1], hit
ter.protocol.blood[hitter.protocol.index % MAX_BLOOD][2], hitter.protocol.blood[hitter.protocol.index % MAX_BLOOD][3])
set_color.value = make_color(*hitter.protocol.blood[hitter.protocol.index % MAX_BLOOD][3])
set_color.player_id = 32
hitter.protocol.send_contained(set_color)
block_action.x = hitter.protocol.blood[hitter.protocol.index % MAX_BLOOD][0]
block_action.y = hitter.protocol.blood[hitter.protocol.index % MAX_BLOOD][1]
block_action.z = hitter.protocol.blood[hitter.protocol.index % MAX_BLOOD][2]
block_action.player_id = 32
block_action.value = DESTROY_BLOCK
hitter.protocol.send_contained(block_action, save = True)
block_action.value = BUILD_BLOCK
hitter.protocol.send_contained(block_action, save = True)
hitter.protocol.blood[hitter.protocol.index % MAX_BLOOD] = (x, y, z, hitter.protocol.map.get_color(x, y, z))
hitter.protocol.index = hitter.protocol.index + 1
#hitter.protocol.send_chat(str(hitter.protocol.index))
hitter.protocol.map.set_point(x, y, z, BLOOD_COLOR)
set_color.value = make_color(*BLOOD_COLOR)
set_color.player_id = 32
hitter.protocol.send_contained(set_color)
block_action.x = x
block_action.y = y
block_action.z = z
block_action.player_id = 32
block_action.value = DESTROY_BLOCK
hitter.protocol.send_contained(block_action, save = True)
block_action.value = BUILD_BLOCK
hitter.protocol.send_contained(block_action, save = True)
#hitter.protocol.send_chat("end")
return hit_amount
class BloodProtocol(protocol):
blood = {}
index = 0
return BloodProtocol, BloodConnection
Revolet wrote:I have a question about the launcher. Will the same security(votekick process, moderation) for 0.75 and 0.76 be added to the version that didn't have moderation at all?There will be limited support for older versions. For the most part it will come down to the individuals hosting the server(s) in regards to stuff like moderation.