Files
NGECore2/scripts/commands/giveitem.py
2014-08-11 08:28:38 +02:00

32 lines
645 B
Python

import sys
def setup():
return
def run(core, actor, target, commandString):
commandArgs = commandString.split(' ')
arg1 = commandArgs[0]
if len(commandArgs) > 1:
arg2 = commandArgs[1]
if not commandString.startswith('object/tangible') and not commandString.startswith('object/weapon'):
return
if len(commandArgs) == 2:
object = core.objectService.createObject((arg1), actor.getPlanet(), (arg2))
if len(commandArgs) == 1:
object = core.objectService.createObject((arg1), actor.getPlanet())
if not object:
return
inventory = actor.getSlottedObject('inventory')
if inventory:
inventory.add(object)
return