예제 #1
0
파일: move.py 프로젝트: ytaben/cyphesis
 def do_roaming(self, me):
     move_me_goal = self.subgoals[0]
     #We need to set a new direction if we've either haven't set one, or if we've arrived.
     if move_me_goal.location == None or move_me_goal.fulfilled(me) == True:
         waypointName = self.list[randint(0, self.count - 1  )]
         waypoint = me.get_knowledge("location",waypointName)
         
         loc = me.location.copy()
         loc.coordinates=Point3D(map(lambda c:c+uniform(-self.radius,self.radius),
                                      waypoint.coordinates))
         move_me_goal.location = loc
예제 #2
0
파일: Baking.py 프로젝트: cneira/cyphesis
    def craft_operation(self, op):
        """ Op handler for crafting op which activates this task """

        if len(op) < 1:
            sys.stderr.write("Baking task has no target in crafting op")

        # FIXME Use weak references, once we have them
        self.target = server.world.get_object_ref(op[0].id)
        self.tool = op.to

        self.pos = Point3D(op[0].pos)
예제 #3
0
    def walls_operation(self, op):
        """ Op handler for walls op which activates this task """

        if len(op) < 1:
            sys.stderr.write("Earthwall task has no target in walls op")

        # FIXME Use weak references, once we have them
        self.target = server.world.get_object(op[0].id)
        self.tool = op.to

        self.pos = Point3D(op[0].pos)
예제 #4
0
 def pick_it_up(self, me):
     for what in self.what:
         thing = get_focused_thing(me, what)
         if thing is None:
             continue
         if thing.parent.id != me.entity.id:
             print("Trying to pick up {}".format(str(thing)))
             return Operation(
                 "move",
                 Entity(thing.id,
                        location=Location(me.entity, Point3D(0, 0, 0))))
예제 #5
0
    def cut_operation(self, op):
        """ Op handler for cut op which activates this task """

        if len(op) < 1:
            sys.stderr.write("Sift task has no target in cut op")

        # FIXME Use weak references, once we have them
        self.target = op[0].id
        self.tool = op.to

        self.pos = Point3D(op[0].pos)
예제 #6
0
파일: move.py 프로젝트: MrBigDog/cyphesis
    def set_new_target(self, me, move_me_goal):
        #me.print_debug("setting new target")
        waypointName = self.list[randint(0, self.count - 1)]
        waypoint = me.get_knowledge("location", waypointName)

        loc = me.location.copy()
        loc.coordinates = Point3D([
            c + uniform(-self.radius, self.radius)
            for c in waypoint.coordinates
        ])
        move_me_goal.location = loc
예제 #7
0
    def aframe_operation(self, op):
        """ Op handler for Pioneeringconstruction op
        which activates this task """

        if len(op) < 1:
            sys.stderr.write("Pioneeringconstruction  task has no target "
                             " in op")

        self.target = server.world.get_object_ref(op[0].id)
        self.tool = op.to

        self.pos = Point3D(op[0].pos)
예제 #8
0
    def drag_operation(self, op):
        """ Op handler for cut op which activates this task """
        # print "Dragging.drag"

        if len(op) < 1:
            sys.stderr.write("Dragging task has no target in drag op")

        # FIXME Use weak references, once we have them
        self.target = server.world.get_object(op[0].id)
        self.tool = op.to

        self.pos = Point3D(op[0].pos)
예제 #9
0
    def set_new_target(self, me, move_me_goal):
        waypoint_name = self.list[randint(0, self.count - 1)]
        waypoint = me.get_knowledge("location", waypoint_name)

        if not waypoint:
            print("Could not find location with name '%s'." % waypoint_name)
            return

        loc = me.entity.location.copy()
        loc.pos = Point3D(
            [c + uniform(-self.radius, self.radius) for c in waypoint.pos])
        move_me_goal.location = loc
예제 #10
0
 def burn_operation(self, op):
     fire_status = op[0].status
     to_ = op[0].id
     ret = Oplist()
     if fire_status < 0.5:
         ret = ret + Operation(
             "nourish", Entity(op[0].id, mass=(0.5 - fire_status)), to=to_)
     fire_loc = Location(self, Point3D(0, 0, 0.75))
     fire_loc.bbox = BBox(0.05, 0.05, 0.5)
     ret = ret + Operation(
         "move", Entity(to_, location=fire_loc, mode='fixed'), to=to_)
     return ret
예제 #11
0
    def earthwork_bloomery_operation(self, op):
        """ Op handler for bloomery op which activates this task """

        if len(op) < 1:
            sys.stderr.write(
                "Bloomery_build task has no target in bloomery_build op")

        # FIXME Use weak references, once we have them
        self.target = server.world.get_object_ref(op[0].id)
        self.tool = op.to

        self.pos = Point3D(op[0].pos)
예제 #12
0
파일: move.py 프로젝트: MasterMann/cyphesis
 def pick_it_up(self, me):
     for what in self.what:
         id = me.get_knowledge('focus', what)
         if id == None: continue
         thing = me.map.get(id)
         if thing == None:
             me.remove_knowledge('focus', what)
             continue
         if thing.location.parent.id != me.entity.id:
             return Operation(
                 "move", Entity(id, location=Location(me, Point3D(0, 0,
                                                                  0))))
예제 #13
0
파일: move.py 프로젝트: MasterMann/cyphesis
 def is_it_at_loc(self, me):
     # CHEAT!: cludge
     if self.wait > 0:
         return 0
     if type(self.location) == str:
         self.location = me.get_knowledge("location", self.location)
     if not isLocation(self.location):
         self.location = Location(self.location, Point3D(0.0, 0.0, 0.0))
     if type(self.what) == str:
         if (self.what in me.things) == 0: return 1
         what = me.things[self.what][0]
     if what.location.parent.id != self.location.parent.id: return 0
     return what.location.pos.distance(self.location.pos) < 1.5
예제 #14
0
 def is_it_at_loc(self, me):
     #CHEAT!: cludge
     if self.wait>0:
         return 0
     if type(self.location)==StringType: 
         self.location=me.get_knowledge("location",self.location)
     if not isLocation(self.location):
         self.location=Location(self.location,Point3D(0.0,0.0,0.0))
     if type(self.what)==StringType:
         if me.things.has_key(self.what)==0: return 1
         what=me.things[self.what][0]
     if what.location.parent.id!=self.location.parent.id: return 0
     return what.location.coordinates.distance(self.location.coordinates)<1.5
예제 #15
0
    def setup_operation(self, op):
        ret = Oplist()
        # West wall  with door
	loc = Location(self, Point3D(0,0,-1))
        loc.bbox = Vector3D(0.1,2,4)
        ret.append(Operation("create",Entity(parents=['wall'],location=loc),to=self))
	loc = Location(self, Point3D(0,4,-1))
        loc.bbox = Vector3D(0.1,2,4)
        ret.append(Operation("create",Entity(parents=['wall'],location=loc),to=self))
        # South wall
	loc = Location(self, Point3D(0,0,-1))
        loc.bbox = Vector3D(9,0.1,4)
        ret.append(Operation("create",Entity(parents=['wall'],location=loc),to=self))
        # North wall
	loc = Location(self, Point3D(0,5.9,-1))
        loc.bbox = Vector3D(9,0.1,4)
        ret.append(Operation("create",Entity(parents=['wall'],location=loc),to=self))
        # East wall
	loc = Location(self, Point3D(8.9,0,-1))
        loc.bbox = Vector3D(0.1,6,4)
        ret.append(Operation("create",Entity(parents=['wall'],location=loc),to=self))
        return ret
예제 #16
0
 def transact(self, me):
     who = me.map.get(self.who)
     if (self.what in me.things) == 0:
         self.irrelevant = 1
         return Operation("talk", Entity(say="I don't have any " + self.what + " left."))
     if self.payed < self.cost:
         return Operation("talk", Entity(say=who.name + " you owe me " + str(self.cost - self.payed) + " coins."))
     thing = me.find_thing(self.what)[0]
     res = Oplist()
     me.remove_thing(thing)
     res.append(Operation("move", Entity(thing.id, location=Location(who, Point3D(0, 0, 0)))))
     res.append(Operation("talk", Entity(say="Thankyou for your custom.")))
     self.irrelevant = 1
     return res
예제 #17
0
 def ignite_operation(self, op):
     fire_child = None
     for child in self.contains:
         if child.type[0] == 'fire':
             fire_child = child
     if not fire_child:
         return
     to_ = op[0].id
     if not to_:
         return self.error(op, "To is undefined object")
     return Operation("create",
                      Entity(parent='fire',
                             status=fire_child.status,
                             location=Location(server.world.get_object(to_),
                                               Point3D(0.0, 0.0, 0.0))),
                      to=to_)
예제 #18
0
파일: House.py 프로젝트: cneira/cyphesis
 def tick_operation(self, op):
     """check if we should self-combust
        in any case send ourself next tick"""
     #print `self`,"Got tick operation:\n"
     opTick = Operation("tick", to=self)
     opTick.setFutureSeconds(const.basic_tick)
     if probability.does_it_happen(probability.fire_probability):
         fireEntity = Entity(name='fire',
                             type=['fire'],
                             status=0.0,
                             location=Location(self, Point3D(0.0, 0.0,
                                                             0.0)))
         opCreate = Operation("create", fireEntity, to=self)
         if const.debug_level >= 2:
             print "Fire! " * 30
         return Oplist(opCreate, opTick)
     return opTick
예제 #19
0
파일: Ram.py 프로젝트: MasterMann/cyphesis
    def tick_operation(self, op):
        """ Op handler for regular tick op """
        res = Oplist()

        if self.target() is None:
            # print "Target is no more"
            self.irrelevant()
            return

        if not self.target().location.parent:
            self.irrelevant()
            return

        if square_distance(self.character.location,
                           self.target().location) > self.target(
                           ).location.bbox.square_bounding_radius():
            return self.next_tick(1)

        target_location = Location(self.target().location.parent,
                                   self.target().location.position)
        target_location.velocity = Vector3D(0, -0.5, 0)
        target_entity_moving = Entity(self.target().id,
                                      location=target_location)

        target_location = Location(
            self.target().location.parent,
            Point3D(self.target().location.position.x,
                    self.target().location.position.y - 0.1,
                    self.target().location.position.z))
        target_location.velocity = Vector3D(0, 0, 0)
        target_entity = Entity(self.target().id, location=target_location)

        if not hasattr(self.target(),
                       'mode') or self.target().props.mode != 'fixed':
            target_entity.mode = 'fixed'

        move = Operation("move", target_entity, to=self.target())
        move.set_future_seconds(0.2)
        res.append(move)
        move = Operation("move", target_entity_moving, to=self.target())
        res.append(move)

        res.append(self.next_tick(1))

        return res
예제 #20
0
파일: Bow.py 프로젝트: zkactivity/cyphesis
 def shoot_operation(self, op):
     ammo = op[0].id
     to_ = op[1].id
     target = server.world.get_object(to_)
     vel = target.location.pos - self.location.parent.location.pos
     time = vel.mag() / 5
     vel = vel.unit_vector() * 5
     loc1 = Location(self.location.parent.location.parent,
                     self.location.parent.location.pos)
     loc1.velocity = vel
     loc2 = Location(target.location.parent, Point3D(0, 0, 0))
     loc2.velocity = Vector3D(0, 0, 0)
     m1 = Operation("move", Entity(ammo, location=loc1), to=ammo)
     m2 = Operation("move", Entity(ammo, location=loc2), to=ammo)
     m2.set_future_seconds(time)
     t = Operation("set", Entity(to_, status=-1), to=to_)
     t.set_future_seconds(time)
     return Oplist(m1, m2, t)
예제 #21
0
    def tick_operation(self, op):
        """ Op handler for regular tick op """
        res = Oplist()

        if self.target() is None:
            # print "Target is no more"
            self.irrelevant()
            return

        if not self.target().location.parent:
            self.irrelevant()
            return

        target_location = Location(self.target().location.parent,
                                   self.target().location.pos)
        target_location.velocity = Vector3D(0, -0.5, 0)
        new_loc = self.character.location.pos
        origin = self.points[0]
        # Get the diffrence in the location of user at current time to the time when he started the task
        diff = origin.x - new_loc.x
        target_entity_moving = Entity(self.target().id,
                                      location=target_location)

        # Replicate the diffrence in position to the corresponding change in height.
        target_location = Location(
            self.target().location.parent,
            Point3D(self.target().location.pos.x,
                    self.target().location.pos.y + diff,
                    self.target().location.pos.z))
        target_location.velocity = Vector3D(0, 0, 0)
        target_entity = Entity(self.target().id, location=target_location)

        # Make the mode fixed to remove the height constraint on entity.
        if not hasattr(self.target(),
                       'mode') or self.target().props.mode != 'fixed':
            target_entity.mode = 'fixed'

        move = Operation("move", target_entity, to=self.target())
        move.set_future_seconds(0.2)
        res.append(move)

        res.append(self.next_tick(1.5))

        return res
예제 #22
0
    def tick_operation(self, op):
        """ Op handler for regular tick op """
        res = Oplist()

        target = server.world.get_object(self.target)
        if not target:
            # print "Target is no more"
            self.irrelevant()
            return

        if not target.location.parent:
            self.irrelevant()
            return

        if square_distance(self.character.location, target.location
                           ) > target.location.bbox.square_bounding_radius():
            return self.next_tick(1)

        target_location = Location(target.location.parent,
                                   target.location.coordinates)
        target_location.velocity = Vector3D(0, 0, -0.5)
        target_entity_moving = Entity(self.target, location=target_location)

        target_location = Location(
            target.location.parent,
            Point3D(target.location.coordinates.x,
                    target.location.coordinates.y,
                    target.location.coordinates.z - 0.1))
        target_location.velocity = Vector3D(0, 0, 0)
        target_entity = Entity(self.target, location=target_location)

        if not hasattr(target, 'mode') or target.mode != 'fixed':
            target_entity.mode = 'fixed'

        move = Operation("move", target_entity, to=self.target)
        move.setFutureSeconds(0.2)
        res.append(move)
        move = Operation("move", target_entity_moving, to=self.target)
        res.append(move)

        res.append(self.next_tick(1))

        return res
예제 #23
0
 def event(self, me, op, say):
     object = say[1].word
     thing = me.map.get(object)
     who = me.map.get(op.to)
     if thing == None:
         if object != self.what:
             return Operation(
                 "talk",
                 Entity(say=who.name +
                        ", I am not interested in buying your " +
                        str(object) + "."))
         me.goals.insert(0, buy_from(self.what, self.cost, op.to))
         return Operation(
             "talk",
             Entity(say=who.name + " which " + object +
                    " would you like to sell?"))
     if not self.what in thing.type: return
     if thing in me.find_thing(self.what): return
     #price=me.get_knowledge("price", thing.type[0])
     price = self.cost * int(thing.mass)
     res = Oplist()
     coins = me.find_thing("coin")
     if len(coins) < int(price):
         print "Coins: " + len(coins) + " Cost: " + self.cost
         return Operation(
             "talk",
             Entity(say="I can't afford any " + self.what +
                    "s at the moment."))
     for i in range(0, int(price)):
         coin = coins[0]
         me.remove_thing(coin)
         res.append(
             Operation(
                 "move",
                 Entity(coin.id, location=Location(who, Point3D(0, 0, 0)))))
     res.append(
         Operation("talk",
                   Entity(say="Thankyou " + who.name + ", come again.")))
     me.add_thing(thing)
     return res
예제 #24
0
    def tick_operation(self, op):
        """ Op handler for regular tick op """
        res = Oplist()
        hook = 0
        if not self.bait() is None:
            if not hasattr(self, 'hook'):
                for item in self.bait().contains:
                    if item.type[0] == "hook":
                        self.hook = weakref.ref(item)
            if not hasattr(self, 'hook'):
                #something has gone wrong, there is bait, but no hook inside it
                self.irrelevant()
                return
            old_rate = self.rate

            self.rate = 0.1 / 17.5
            self.progress += 0.1

            if old_rate < 0.01:
                self.progress = 0
            else:
                self.progress += 0.1
            res.append(self.next_tick(0.75))
        else:
            #a fish has eaten the bait
            if self.hook() is None:
                self.irrelevant()
                return
            fish = self.hook().location.parent
            #TODO: add check to ensure that the fish's parent isn't world or something like that
            res.append(
                Operation("move",
                          Entity(fish.id,
                                 location=Location(self.character,
                                                   Point3D(0, 0, 0))),
                          to=fish))
            self.progress = 1
            self.irrelevant()
        return res
예제 #25
0
 def move_it_to_loc(self, me):
     if self.wait>0:
         self.wait=self.wait-1
         return
     if type(self.location)==StringType: 
         self.location=me.get_knowledge("location",self.location)
     elif not isLocation(self.location):
         self.location=Location(self.location,Point3D(0.0,0.0,0.0))
     if type(self.what)==StringType:
         if me.things.has_key(self.what)==0:
             return
         what=me.things[self.what][0]
     if self.speed==0 or what.location.parent.id!=self.location.parent.id:
         return Operation("move", Entity(what.id, location=self.location))
     iloc=what.location.copy()
     vel=what.location.coordinates.unit_vector_to(self.location.coordinates)
     iloc.velocity = vel * self.speed
     self.location.velocity=Vector3D(0.0,0.0,0.0)
     mOp1=Operation("move", Entity(what.id, location=iloc))
     mOp2=Operation("move", Entity(what.id, location=self.location))
     time=((self.location.coordinates-what.location.coordinates).mag() / self.speed)
     self.wait=(time/const.basic_tick)+1
     mOp2.setFutureSeconds(time)
     return Oplist(mOp1,mOp2)
예제 #26
0
    def info_operation(self, op):
        print("Gate info")
        gate = server.world.get_object(op[0].id)
        self.lcount = 0  # needs 1 lumber for basic gate
        self.acount = 0  # needs 2 a frames for basic gate
        raw_materials = []  # Holds construction
        raw_materials1 = []  # Holds lumber
        for item in self.character.contains:
            if item.type[0] == str("construction"):
                raw_materials.append(item)
                self.acount = self.acount + 1
            if item.type[0] == str("lumber"):
                raw_materials1.append(item)
                self.lcount = self.lcount + 1
            if self.acount == 2 and self.lcount == 1:
                break
            if self.lcount == 3:
                break
        else:
            print("No materials in inventory for Gate")
            self.irrelevant()
            return

        chunk_loc = Location(gate())
        chunk_loc.pos = Point3D([0, 0, 0])
        res = Oplist()

        if self.gname == "Basic_Gate":
            count1 = self.lcount
            while (count1 > 0):
                tar = raw_materials1.pop()
                self.lumber_length = tar.location.bbox.high_corner[2] - \
                                     tar.location.bbox.low_corner[2]
                offset = Vector3D(self.lumber_length / 7,
                                  self.lumber_length * .63,
                                  -self.lumber_length / 3.5)
                chunk_loc.orientation = Quaternion([.707, 0, 0, .707])
                # Same as an Euler of (0,90 Degrees,0)
                chunk_loc.pos = chunk_loc.pos + offset
                move1 = Operation("move",
                                  Entity(tar.id,
                                         location=chunk_loc,
                                         mode="fixed"),
                                  to=tar)
                res.append(move1)
                count1 = count1 - 1

            count = self.acount
            chunk_loc = Location(gate())
            chunk_loc.pos = Point3D([0, 0, 0])
            # Resets
            # loops through raw_materials and places 3 lumber
            # in inventory infront of user
            offset = Vector3D(0, 0, 0)
            while (count > 0):
                tar = raw_materials.pop()

                if count == 2:
                    # left component of gate
                    chunk_loc.pos = Point3D([0, 0, 0])
                    offset = Vector3D(0, self.lumber_length * .7, 0)
                    chunk_loc.orientation = Quaternion([.707, 0, 0, .707])
                    chunk_loc.pos = chunk_loc.pos + offset

                if count == 1:
                    # right component of gate
                    chunk_loc.pos = Point3D([0, 0, 0])
                    offset = Vector3D(0, self.lumber_length * .7,
                                      (self.lumber_length / 2))
                    chunk_loc.orientation = Quaternion([.707, 0, 0, .707])
                    chunk_loc.pos = chunk_loc.pos + offset

                move = Operation("move",
                                 Entity(tar.id,
                                        location=chunk_loc,
                                        mode="fixed"),
                                 to=tar)
                res.append(move)
                count = count - 1

        if self.gname == "House_Gate":
            # Left leg of the house frame
            tar = raw_materials1.pop()
            chunk_loc.pos = Point3D([0, 0, 0])
            self.lumber_length = tar.location.bbox.high_corner[2] - \
                                 tar.location.bbox.low_corner[2]
            offset = Vector3D(0, self.lumber_length * .8,
                              -self.lumber_length / 4)
            chunk_loc.orientation = Quaternion([.707, .707, 0, 0])
            chunk_loc.pos = chunk_loc.pos + offset
            move1 = Operation("move",
                              Entity(tar.id, location=chunk_loc, mode="fixed"),
                              to=tar)
            res.append(move1)
            # Right Leg of the house frame
            tar = raw_materials1.pop()
            chunk_loc.pos = Point3D([0, 0, 0])
            self.lumber_length = tar.location.bbox.high_corner[2] - \
                                 tar.location.bbox.low_corner[2]
            offset = Vector3D(0, self.lumber_length * .8,
                              -self.lumber_length * (3.0 / 4.0))
            chunk_loc.orientation = Quaternion([.707, .707, 0, 0])
            chunk_loc.pos = chunk_loc.pos + offset
            move1 = Operation("move",
                              Entity(tar.id, location=chunk_loc, mode="fixed"),
                              to=tar)
            res.append(move1)
            # Top of the house frame
            tar = raw_materials1.pop()
            chunk_loc.pos = Point3D([0, 0, 0])
            self.lumber_length = tar.location.bbox.high_corner[2] - \
                                 tar.location.bbox.low_corner[2]
            offset = Vector3D(0,
                              self.lumber_length * (.7, -self.lumber_length))
            chunk_loc.orientation = Quaternion([.5, .5, -.5, .5])
            # Same as (90 Degrees, 0, 90 Degrees)
            chunk_loc.pos = chunk_loc.pos + offset
            move1 = Operation("move",
                              Entity(tar.id, location=chunk_loc, mode="fixed"),
                              to=tar)
            res.append(move1)

        self.progress = 1
        self.irrelevant()
        return res
예제 #27
0
 def pick_it_up(self, me):
     what=self.what
     if type(what)==StringType:
         if me.things.has_key(self.what)==0: return 0
         what=me.things[self.what][0]
     return Operation("move", Entity(id, location=Location(me, Point3D(0,0,0))))
예제 #28
0
 def do_wandering(self, me):
     loc = me.entity.location.copy()
     loc.pos = Point3D([c + uniform(-5, 5) for c in loc.pos])
     self.sub_goals[0].location = loc
예제 #29
0
파일: move.py 프로젝트: demarii/cyphesis
 def do_wandering(self, me):
     loc = me.location.copy()
     loc.coordinates=Point3D(map(lambda c:c+uniform(-5,5),
                                  loc.coordinates))
     self.subgoals[0].location = loc
예제 #30
0
    def info_operation(self, op):
        print("Furnishings info")
        item = server.world.get_object(op[0].id)
        chunk_loc = Location(item())
        chunk_loc.pos = Point3D([0, 0, 0])
        res = Oplist()
        target = self.target()
        raw_materials = []
        raw_materials1 = []  # holders campfire
        raw_materials2 = []  # temp holder for aframes to be moved
        acount = 0  # A frame count
        lcount = 0  # Lumber count
        wcount = 0  # Wood count
        bcount = 0  # Boulder count
        ccount = 0  # Campfire count
        for item in self.character.contains:
            if item.type[0] == "lumber":
                raw_materials.append(item)
                lcount = lcount + 1
            if item.type[0] == "wood":
                raw_materials.append(item)
                wcount = wcount + 1
            if item.type[0] == "campfire":
                raw_materials1.append(item)
                ccount = ccount + 1
            if item.type[0] == "boulder":
                raw_materials.append(item)
                bcount = bcount + 1
            if item.type[0] == "construction":
                raw_materials2.append(item)
                acount = acount + 1

        count = lcount + wcount + bcount
        if self.fname == "Table":
            # Making table
            while (count > 0):
                tar = raw_materials.pop()
                set = Operation("set", Entity(tar.id, status=-1), to=tar)
                res.append(set)
                count = count - 1
            # create the table
            # Table base
            lbbox = [-.2, -.2, -.5, .2, .2, .5]  # local bbox
            create = Operation("create",
                               Entity(name="lumber",
                                      type="lumber",
                                      location=chunk_loc,
                                      bbox=lbbox,
                                      mode="fixed"),
                               to=target)
            res.append(create)
            # create the table top
            offset = Vector3D(0, 1, 0)
            chunk_loc.pos = chunk_loc.pos + offset
            lbbox = [-.7, -.7, -.1, .7, .7, .1]
            create = Operation("create",
                               Entity(name="wood",
                                      type="wood",
                                      location=chunk_loc,
                                      bbox=lbbox,
                                      mode="fixed"),
                               to=target)
            res.append(create)
        if self.fname == "Chair":
            # Making chair
            while (count > 0):
                tar = raw_materials.pop()
                set = Operation("set", Entity(tar.id, status=-1), to=tar)
                res.append(set)
                count = count - 1
            # create the legs
            # leg 1
            chunk_loc.pos = Point3D([0, 0, 0])
            offset = Vector3D(.2, 0, -.2)
            chunk_loc.pos = chunk_loc.pos + offset
            create = Operation("create",
                               Entity(name="lumber",
                                      type="lumber",
                                      location=chunk_loc,
                                      mode="fixed"),
                               to=target)
            res.append(create)

            # leg 2
            chunk_loc.pos = Point3D([0, 0, 0])
            offset = Vector3D(-.2, 0, -.2)
            chunk_loc.pos = chunk_loc.pos + offset
            create = Operation("create",
                               Entity(name="lumber",
                                      type="lumber",
                                      location=chunk_loc,
                                      mode="fixed"),
                               to=target)
            res.append(create)

            # leg 3
            chunk_loc.pos = Point3D([0, 0, 0])
            offset = Vector3D(-.2, 0, .2)
            chunk_loc.pos = chunk_loc.pos + offset
            create = Operation("create",
                               Entity(name="lumber",
                                      type="lumber",
                                      location=chunk_loc,
                                      mode="fixed"),
                               to=target)
            res.append(create)

            # leg 4
            chunk_loc.pos = Point3D([0, 0, 0])
            offset = Vector3D(.2, 0, .2)
            chunk_loc.pos = chunk_loc.pos + offset
            create = Operation("create",
                               Entity(name="lumber",
                                      type="lumber",
                                      location=chunk_loc,
                                      mode="fixed"),
                               to=target)
            res.append(create)

            # create the seat
            chunk_loc.pos = Point3D([0, 0, 0])
            offset = Vector3D(0, .5, 0)
            lbbox = [-.3, -.3, -.1, .3, .3, .1]  # Local bbox
            chunk_loc.pos = chunk_loc.pos + offset
            create = Operation("create",
                               Entity(name="wood",
                                      type="wood",
                                      location=chunk_loc,
                                      bbox=lbbox,
                                      mode="fixed"),
                               to=target)
            res.append(create)

            # create the back of the seat
            chunk_loc.pos = Point3D([0, 0, 0])
            offset = Vector3D(-.3, .75, 0)
            lbbox = [-.1, -.3, -.4, .1, .3, .4]  # local bbox
            chunk_loc.pos = chunk_loc.pos + offset
            create = Operation("create",
                               Entity(name="wood",
                                      type="wood",
                                      location=chunk_loc,
                                      bbox=lbbox,
                                      mode="fixed"),
                               to=target)
            res.append(create)

        if self.fname == "Floor":
            # Making Floor
            while (count > 0):
                tar = raw_materials.pop()
                set = Operation("set", Entity(tar.id, status=-1), to=tar)
                res.append(set)
                count = count - 1
            # create the Floor, it is one large wood
            lbbox = [-2, -2, -.1, 2, 2, .1]  # local bbox
            create = Operation("create",
                               Entity(name="wood",
                                      type="wood",
                                      location=chunk_loc,
                                      bbox=lbbox,
                                      mode="fixed"),
                               to=target)
            res.append(create)
        if self.fname == "Siding":
            # Making wooden siding with window
            while (count > 0):
                tar = raw_materials.pop()
                set = Operation("set", Entity(tar.id, status=-1), to=tar)
                res.append(set)
                count = count - 1
            # Siding is made of 4 components so it looks like we have a window
            # Bottom part
            lbbox = [-3, -.1, -1, 3, .1, 2]
            create = Operation("create",
                               Entity(name="wood",
                                      type="wood",
                                      location=chunk_loc,
                                      bbox=lbbox,
                                      mode="fixed"),
                               to=target)
            res.append(create)
            # Top part
            chunk_loc.pos = Point3D([0, 0, 0])
            offset = Vector3D(0, 4, 0)
            chunk_loc.pos = chunk_loc.pos + offset
            lbbox = [-3, -.1, -1, 3, .1, 2]
            create = Operation("create",
                               Entity(name="wood",
                                      type="wood",
                                      location=chunk_loc,
                                      bbox=lbbox,
                                      mode="fixed"),
                               to=target)
            res.append(create)
            # left part
            chunk_loc.pos = Point3D([0, 0, 0])
            offset = Vector3D(-2, 2, 0)
            chunk_loc.pos = chunk_loc.pos + offset
            lbbox = [-1, -.1, -.5, 1, .1, .5]
            create = Operation("create",
                               Entity(name="wood",
                                      type="wood",
                                      location=chunk_loc,
                                      bbox=lbbox,
                                      mode="fixed"),
                               to=target)
            res.append(create)
            # Right part
            chunk_loc.pos = Point3D([0, 0, 0])
            offset = Vector3D(2, 2, 0)
            chunk_loc.pos = chunk_loc.pos + offset
            lbbox = [-1, -.1, -.5, 1, .1, .5]
            create = Operation("create",
                               Entity(name="wood",
                                      type="wood",
                                      location=chunk_loc,
                                      bbox=lbbox,
                                      mode="fixed"),
                               to=target)
            res.append(create)
        if self.fname == "Fireplace":
            # Making Fireplace
            while (count > 0):
                tar = raw_materials.pop()
                set = Operation("set", Entity(tar.id, status=-1), to=tar)
                res.append(set)
                count = count - 1
            # Move campfire
            tar = raw_materials1.pop()
            create = Operation("move",
                               Entity(tar.id, location=chunk_loc,
                                      mode="fixed"),
                               to=tar)
            res.append(create)
            # make floor of fireplace
            lbbox = [-2, -1, -.1, 2, 1, .1]  # local bbox
            create = Operation("create",
                               Entity(name="boulder",
                                      type="boulder",
                                      location=chunk_loc,
                                      bbox=lbbox,
                                      mode="fixed"),
                               to=target)
            res.append(create)
            # make wall 1 of fireplace
            chunk_loc.pos = Point3D([0, 0, 0])
            offset = Vector3D(-1.6, 0, 0)
            lbbox = [-.1, -1, -.1, .1, 1, 1.5]
            chunk_loc.pos = chunk_loc.pos + offset
            create = Operation("create",
                               Entity(name="boulder",
                                      type="boulder",
                                      location=chunk_loc,
                                      bbox=lbbox,
                                      mode="fixed"),
                               to=target)
            res.append(create)
            # make wall 2 of fireplace
            chunk_loc.pos = Point3D([0, 0, 0])
            offset = Vector3D(1.6, 0, 0)
            lbbox = [-.1, -1, -.1, .1, 1, 1.5]
            chunk_loc.pos = chunk_loc.pos + offset
            create = Operation("create",
                               Entity(name="boulder",
                                      type="boulder",
                                      location=chunk_loc,
                                      bbox=lbbox,
                                      mode="fixed"),
                               to=target)
            res.append(create)
            # make back of fireplace
            chunk_loc.pos = Point3D([0, 0, 0])
            offset = Vector3D(0, 0, .6)
            lbbox = [-2, -.1, -.1, 2, .1, 1.5]
            chunk_loc.pos = chunk_loc.pos + offset
            create = Operation("create",
                               Entity(name="boulder",
                                      type="boulder",
                                      location=chunk_loc,
                                      bbox=lbbox,
                                      mode="fixed"),
                               to=target)
            res.append(create)
        if self.fname == "Wallframe":
            # Bottom part of wall frame
            chunk_loc.pos = Point3D([0, 0, 0])
            tar = raw_materials.pop()
            lumberlength = tar.location.bbox.high_corner[
                2] - tar.location.bbox.low_corner[2]
            chunk_loc.orientation = Quaternion([.5, .5, .5, .5])
            offset = Vector3D(-lumberlength / 2, 0, 0)
            chunk_loc.pos = chunk_loc.pos + offset
            create = Operation("move",
                               Entity(tar.id, location=chunk_loc,
                                      mode="fixed"),
                               to=tar)
            res.append(create)
            # Top part of wall frame
            chunk_loc.pos = Point3D([0, 0, 0])
            tar = raw_materials.pop()
            offset = Vector3D(-lumberlength / 2, 0, lumberlength * .8)
            chunk_loc.pos = chunk_loc.pos + offset
            chunk_loc.orientation = Quaternion([.5, .5, .5, .5])
            create = Operation("move",
                               Entity(tar.id, location=chunk_loc,
                                      mode="fixed"),
                               to=tar)
            res.append(create)
            # Left part of wall frame
            chunk_loc.pos = Point3D([0, 0, 0])
            tar = raw_materials.pop()
            offset = Vector3D((lumberlength / 2.0) * -.8, lumberlength * .8, 0)
            chunk_loc.pos = chunk_loc.pos + offset
            chunk_loc.orientation = Quaternion([.707, .707, 0, 0])
            create = Operation("move",
                               Entity(tar.id, location=chunk_loc,
                                      mode="fixed"),
                               to=tar)
            res.append(create)
            # Right part of wall frame
            chunk_loc.pos = Point3D([0, 0, 0])
            tar = raw_materials.pop()
            offset = Vector3D((lumberlength / 2.0) * .8, lumberlength * .8, 0)
            chunk_loc.pos = chunk_loc.pos + offset
            chunk_loc.orientation = Quaternion([.707, .707, 0, 0])
            create = Operation("move",
                               Entity(tar.id, location=chunk_loc,
                                      mode="fixed"),
                               to=tar)
            res.append(create)
            # Center part of wall frame
            chunk_loc.pos = Point3D([0, 0, 0])
            tar = raw_materials.pop()
            offset = Vector3D((lumberlength / 2.0) * -.8, lumberlength * .1, 0)
            chunk_loc.pos = chunk_loc.pos + offset
            chunk_loc.orientation = Quaternion([.27, .27, .65, .65])
            create = Operation("move",
                               Entity(tar.id, location=chunk_loc,
                                      mode="fixed"),
                               to=tar)
            res.append(create)
        if self.fname == "Roof":
            # Making the roof, roof is 1 lumber and a large wooden covering
            while (count > 0):
                tar = raw_materials.pop()
                set = Operation("set", Entity(tar.id, status=-1), to=tar)
                res.append(set)
                count = count - 1
            # create the top, it is one large wood
            lbbox = [-4, -4, -.1, 4, 4, .3]  # local bbox
            offset = Vector3D(0, 5, 0)
            chunk_loc.pos = chunk_loc.pos + offset
            create = Operation("create",
                               Entity(name="wood",
                                      type="wood",
                                      location=chunk_loc,
                                      bbox=lbbox,
                                      mode="fixed"),
                               to=target)
            res.append(create)
            # create column
            chunk_loc.pos = Point3D([0, 0, 0])
            lbbox = [-.5, -.5, -.1, .5, .5, 6]  # local bbox
            offset = Vector3D(0, 0, 0)
            chunk_loc.pos = chunk_loc.pos + offset
            create = Operation("create",
                               Entity(name="lumber",
                                      type="lumber",
                                      location=chunk_loc,
                                      bbox=lbbox,
                                      mode="fixed"),
                               to=target)
            res.append(create)

        self.progress = 1
        self.irrelevant()
        return res