From: Christian Heller <c.heller@plomlompom.de>
Date: Wed, 16 Dec 2015 00:14:19 +0000 (+0100)
Subject: New client: Add drop command.
X-Git-Tag: tce~232
X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/static/%7B%7B%20web_path%20%7D%7D/decks/todos?a=commitdiff_plain;h=dc4e467b06b736dcc830d6d66de8171402c13aac;p=plomrogue

New client: Add drop command.
---

diff --git a/client_prototype.py b/client_prototype.py
index 01bb74b..ea7af0e 100644
--- a/client_prototype.py
+++ b/client_prototype.py
@@ -447,9 +447,12 @@ def command_toggle_look_mode():
         query_mapcell()
 
 
-def command_sender(string):
+def command_sender(string, int_field=None):
     def command_send():
-        io["file_out"].write(string + "\n")
+        int_string = ""
+        if int_field:
+            int_string = " " + str(world_data[int_field])
+        io["file_out"].write(string + int_string + "\n")
         io["file_out"].flush()
     return command_send
 
@@ -513,6 +516,7 @@ io = {
     "path_worldstate": "server/worldstate"
 }
 commands = {
+    "D": (command_sender("drop", "inventory_selection"),),
     "P": (command_sender("pick_up"),),
     "Q": (command_quit,),
     "W": (command_sender("wait"),),