[SCRIPT] returnme

Intended for use on live public servers.
5 posts Page 1 of 1 First unread post
thepolm3
Scripter
Scripter
Posts: 424
Joined: Sat Feb 16, 2013 10:49 pm


based on tracks.py this allows players to return thier own intel to thier own base
Code: Select all
"""
thepolm3
makes the intel returnable by its own team
"""

from pyspades.collision import vector_collision
from twisted.internet.task import LoopingCall

#the default looks quite smooth
SPEED=200#th |  difference of the base and the intel moved in one "tick" (1/10 second)

def apply_script(protocol, connection, config):
    class TracksProtocol(protocol):

        def advance_intel(self,team):
            base,flag = team.base,team.flag
            a,b,c = base.x,base.y,base.z
            x,y,z = flag.x,flag.y,flag.z
            q,w = round(x+(a-x)/SPEED,4),round(y+(b-y)/SPEED,4)
            flag.set(q,w,self.map.get_z(q,w))
            flag.update()
            
    class TracksConnection(connection):
        cartcheck=None
        
        def on_spawn(self,pos):
            if self.cartcheck:
                self.cartcheck.stop()
            self.cartcheck=LoopingCall(self.check_cart)
            self.cartcheck.start(0.1)
            self.team.flag.update()
            return connection.on_spawn(self,pos)

        def check_cart(self):
            if self.world_object and self.team.flag:
                if vector_collision(self.world_object.position, self.team.flag):
                    self.protocol.advance_intel(self.team)
                self.team.flag.update()
        
    
    return TracksProtocol, TracksConnection

Attachments
returnme.py
(1.36 KiB) Downloaded 181 times
Faker
League Participant
League Participant
Posts: 127
Joined: Thu May 23, 2013 10:11 am


Isn't it like the script "flagreturn"?
learn_more
Coder
Coder
Posts: 891
Joined: Sun Mar 24, 2013 9:59 pm


yeah.

i posted a fix for that because it doesnt work properly after switching maps:
http://www.buildandshoot.com/viewtopic.php?f=19&t=9180
thepolm3
Scripter
Scripter
Posts: 424
Joined: Sat Feb 16, 2013 10:49 pm


It's quite different
learn_more
Coder
Coder
Posts: 891
Joined: Sun Mar 24, 2013 9:59 pm


thepolm3 wrote:
It's quite different
ah, i should base my comments more on own judgement, less on comments from random people.
5 posts Page 1 of 1 First unread post
Return to “Completed Releases”

Who is online

Users browsing this forum: No registered users and 27 guests