cyphesis/rulesets/deeds/world/objects/tools/Torch.py
Erik Ogenvik 2dca4949ed Created "deeds" ruleset and made it default.
It's currently a copy of the Mason ruleset.
Where Mason focuses on letting the users create the world themselves,
Deeds instead focuses on allowing world authors to set up enticing
worlds with gameplay and stories. In contrast to Mason there are more
features available to the world authors which allow for automatic
creation of entities and so on.
2013-11-15 21:14:47 +01:00

33 lines
1.2 KiB
Python

#This file is distributed under the terms of the GNU General Public license.
#Copyright (C) 2005 Al Riddoch (See the file COPYING for details).
from atlas import *
from physics import Point3D
from physics import BBox
import server
class Torch(server.Thing):
"""This is base class for axes, this one just ordinary axe"""
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(parents=['fire'],status=fire_child.status, location=Location(server.world.get_object(to_),Point3D(0.0,0.0,0.0))),to=to_)
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