示例#1
0
def set_target(ent_id, target_id):
    ent = entity.GetEntity(ent_id)
    if ent is None:
        return lambda: None
    old_target_id = ent.SetTargetId(target_id)

    def Undo():
        same_ent = entity.GetEntity(ent_id)
        if same_ent:
            same_ent.SetTargetId(old_target_id)

    return Undo
示例#2
0
def set_pos(ent_id, pos):
    ent = entity.GetEntity(ent_id)
    if ent is None:
        return lambda: None
    old_pos = ent.SetPos(pos)

    def Undo():
        same_ent = entity.GetEntity(ent_id)
        if same_ent:
            same_ent.SetPos(old_pos)

    return Undo
示例#3
0
def set_path(ent_id, path):
    ent = entity.GetEntity(ent_id)
    if ent is None:
        return lambda: None

    ent.PushPath(path)

    def Undo():
        same_ent = entity.GetEntity(ent_id)
        if same_ent:
            same_ent.PopPath()

    return Undo
示例#4
0
def add_force(ent_id, direction, magnitude, catalog):
    ent = entity.GetEntity(ent_id)
    if ent is None:
        return lambda: None

    force_id = ent.AddForce(direction, magnitude, catalog, None)

    def Undo():
        same_ent = entity.GetEntity(ent_id)
        if same_ent:
            same_ent.DelForce(force_id)

    return Undo
示例#5
0
 def Undo():
     same_ent = entity.GetEntity(ent_id)
     if same_ent:
         same_ent.SetPos(old_pos)
示例#6
0
 def Undo():
     same_ent = entity.GetEntity(ent_id)
     if same_ent:
         same_ent.SetTargetId(old_target_id)
示例#7
0
 def Undo():
     same_ent = entity.GetEntity(ent_id)
     if same_ent:
         same_ent.PopPath()
示例#8
0
 def Undo():
     same_ent = entity.GetEntity(ent_id)
     if same_ent:
         same_ent.DelForce(force_id)