Add 'dip' command
Dipping allows players to fill empty bottles from fountains. git-svn-id: svn://svn.code.sf.net/p/crossfire/code/maps/trunk@21185 282e977c-c81d-0410-88c4-b93c2d0d6712master
parent
f6d994c35d
commit
10da0ef45b
|
@ -0,0 +1,32 @@
|
|||
import Crossfire
|
||||
|
||||
def find_fountain(pl):
|
||||
below = pl.Below
|
||||
while below is not None:
|
||||
if below.ArchName == "fountain":
|
||||
return below
|
||||
below = below.Below
|
||||
return None
|
||||
|
||||
def dip(pl):
|
||||
f = find_fountain(pl)
|
||||
if f is None:
|
||||
pl.Message("You must be at a fountain to dip an object into one.")
|
||||
return False
|
||||
|
||||
ob = pl.MarkedItem
|
||||
if ob is None:
|
||||
pl.Message("Mark the item that you would like to dip.")
|
||||
return False
|
||||
|
||||
name_before = ob.Name
|
||||
|
||||
if ob.ArchName == "wbottle_empty":
|
||||
ob.Quantity -= 1
|
||||
w = Crossfire.CreateObjectByName("water")
|
||||
w.InsertInto(pl)
|
||||
pl.Message("You fill the %s with water from the %s." % (name_before, f.Name))
|
||||
else:
|
||||
pl.Message("You dip the %s into the %s. Nothing happens." % (name_before, f.Name))
|
||||
|
||||
dip(Crossfire.WhoAmI())
|
|
@ -0,0 +1,2 @@
|
|||
import Crossfire
|
||||
Crossfire.RegisterCommand("dip", "/python/commands/dip", 0)
|
Loading…
Reference in New Issue