- Made a beta version of the new DblClick() proc. As per my testing it is far more efficient than the old one. The click-proc is ready for ingame testing. To initiate a test, use the "Toggle NewClickProc" verb if you're a game admin or game master.

- The following procs have been added: ismetroid() ispAI()
- Using the new click proc adds support for the following new procs: attack_robot(), attack_ghost(), attack_admin(), hanr_r(), hand_m()

Proc description:
- attack_robot() is the proc that gets called when a cyborg clicks on any atom without having a module selected. It defaults to attack_ai() and for the moment always calls the default as there is no separation.
- attack_ghost() is the proc that gets called when a ghost clicks on any atom. It defaults to examine()
- attack_admin() is the proc that gets called when a ghost with admin status clicks on any atom. It defaults to attack_ghost()
- hand_r() is the proc that gets called when a restrained cyborg clicks on any atom. It defaults to hand_a(), which is the the proc for a restrained AI, whatever that means.
- hand_m() is for when a restrained metroid clicks on an item.

Please note that the new click proc drops support for the HEAL mutation. Let me know if this mutation is important. All I can tell you is that it doesn't belong in this proc.

- Moved the mob/Delete() proc to mob.dm. Doubleclicking /mob in the object tree will now throw you to mob.dm instead of some random datumvars.dm.

git-svn-id: http://tgstation13.googlecode.com/svn/trunk@2256 316c924e-a436-60f5-8080-3fe189b3f50e
This commit is contained in:
baloh.matevz
2011-09-23 19:48:06 +00:00
parent 18990b04e1
commit 517dd55abe
6 changed files with 175 additions and 42 deletions

View File

@@ -458,11 +458,4 @@ client
return
if(!istype(DAT,/datum))
return
src.debug_variables(DAT)
/mob/proc/Delete(atom/A in view())
set category = "Debug"
switch (alert("Are you sure you wish to delete \the [A.name] at ([A.x],[A.y],[A.z]) ?", "Admin Delete Object","Yes","No"))
if("Yes")
log_admin("[usr.key] deleted [A.name] at ([A.x],[A.y],[A.z])")
src.debug_variables(DAT)

View File

@@ -224,3 +224,10 @@ the mob is also allowed to move without any sort of restriction. For instance, i
var/UI = 'screen1_old.dmi' // For changing the UI from preferences
var/obj/organstructure/organStructure = null //for dem organs
/mob/proc/Delete(atom/A in view())
set category = "Debug"
switch (alert("Are you sure you wish to delete \the [A.name] at ([A.x],[A.y],[A.z]) ?", "Admin Delete Object","Yes","No"))
if("Yes")
log_admin("[usr.key] deleted [A.name] at ([A.x],[A.y],[A.z])")

View File

@@ -12,12 +12,22 @@
/atom/proc/attack_ai(mob/user as mob)
return
/atom/proc/attack_robot(mob/user as mob)
attack_ai(user)
return
/atom/proc/attack_animal(mob/user as mob)
return
/atom/proc/attack_ghost(mob/user as mob)
src.examine()
return
/atom/proc/attack_admin(mob/user as mob)
if(!user || !user.client || !user.client.holder)
return
attack_hand(user)
//for aliens, it works the same as monkeys except for alien-> mob interactions which will be defined in the
//appropiate mob files
/atom/proc/attack_alien(mob/user as mob)
@@ -31,19 +41,26 @@
/atom/proc/hand_h(mob/user as mob)
/atom/proc/hand_h(mob/user as mob) //human (hand) - restrained
return
/atom/proc/hand_p(mob/user as mob)
/atom/proc/hand_p(mob/user as mob) //monkey (paw) - restrained
return
/atom/proc/hand_a(mob/user as mob)
/atom/proc/hand_a(mob/user as mob) //AI - restrained
return
/atom/proc/hand_al(mob/user as mob)
/atom/proc/hand_r(mob/user as mob) //Cyborg (robot) - restrained
src.hand_a(user)
return
/atom/proc/hand_al(mob/user as mob) //alien - restrained
src.hand_p(user)
return
/atom/proc/hand_m(mob/user as mob) //metroid - restrained
return
/atom/proc/hitby(atom/movable/AM as mob|obj)
return
@@ -219,9 +236,12 @@
if(usr.client.buildmode)
build_click(usr, usr.client.buildmode, location, control, params, src)
return
if(using_new_click_proc) //TODO ERRORAGE (see message below)
return DblClickNew()
return DblClick()
var/using_new_click_proc = 0 //TODO ERRORAGE (This is temporary, while the DblClickNew() proc is being tested)
/atom/proc/DblClickNew()
//Spamclick server-overloading prevention delay... THING
@@ -247,13 +267,13 @@
src.attack_ai(usr)
else if(isrobot(usr))
src.attack_ai(usr)
else if(istype(usr,/mob/dead/observer))
else if(isobserver(usr))
src.attack_ghost(usr)
else if(ismonkey(usr))
src.attack_paw(usr)
else if(isalienadult(usr))
src.attack_alien(usr)
else if(istype(usr,/mob/living/carbon/metroid))
else if(ismetroid(usr))
src.attack_metroid(usr)
else if(isanimal(usr))
src.attack_animal(usr)
@@ -266,13 +286,13 @@
src.hand_a(usr, usr.hand)
else if(isrobot(usr))
src.hand_a(usr, usr.hand)
else if(istype(usr,/mob/dead/observer))
else if(isobserver(usr))
return
else if(ismonkey(usr))
src.hand_p(usr, usr.hand)
else if(isalienadult(usr))
src.hand_al(usr, usr.hand)
else if(istype(usr,/mob/living/carbon/metroid))
else if(ismetroid(usr))
return
else if(isanimal(usr))
return
@@ -296,7 +316,6 @@
else
return //An item with the USEDELAY flag's already been used this tick
//Is the object in a valid place?
var/valid_place = 0
if ( isturf(src) || ( src.loc && isturf(src.loc) ) || ( src.loc.loc && isturf(src.loc.loc) ) )
@@ -309,92 +328,186 @@
//User has the object on them (in their inventory) and it is thus valid
valid_place = 1
if(!valid_place)
//Afterattack gets performed every time you click, no matter if it's in range or not. It's used when
//clicking targets for guns and such. If you are clicking on a target that's not in range
//with an item in your hands only afterattack() needs to be performed.
//If the range is valid, afterattack() will be handled in the separate mob-type
//sections below, just after attackby(). Attack_hand and simmilar procs are handled
//in the mob-type sections below, as some require you to be in range to work (human, monkey..) while others don't (ai, cyborg)
//Also note that afterattack does not differentiate between mob-types.
if( W && !valid_place)
W.afterattack(src, usr, (valid_place ? 1 : 0))
return
if(ishuman(usr))
var/mob/living/carbon/human/human = usr
//-human stuff-
if(human.stat)
return
if(human.in_throw_mode)
return human.throw_item(src)
var/in_range = in_range(src, human) || src.loc == human
if(in_range)
usr << "this is just to stop warnings in WIP code TODO ERRORAGE"
if (in_range)
if ( !human.restrained() )
if (W)
attackby(W,human)
if (W)
W.afterattack(src, human)
else
attack_hand(human)
else
hand_h(human, human.hand)
else
if ( (W) && !human.restrained() )
W.afterattack(src, human)
else if(istype(usr,/mob/living/silicon/ai))
else if(isAI(usr))
var/mob/living/silicon/ai/ai = usr
//-ai stuff-
if(ai.stat)
return
if (ai.control_disabled)
return
if( !ai.restrained() )
attack_ai(ai)
else
hand_a(ai, ai.hand)
else if(isrobot(usr))
var/mob/living/silicon/robot/robot = usr
//-cyborg stuff-
if(robot.stat)
return
if (robot.lockcharge)
return
var/in_range = in_range(src, robot) || src.loc == robot
if(in_range)
usr << "this is just to stop warnings in WIP code TODO ERRORAGE"
else if(istype(usr,/mob/dead/observer))
if(W)
var/in_range = in_range(src, robot) || src.loc == robot
if(in_range)
attackby(W,robot)
if (W)
W.afterattack(src, robot)
else
if( !robot.restrained() )
attack_robot(robot)
else
hand_r(robot, robot.hand)
else if(isobserver(usr))
var/mob/dead/observer/ghost = usr
//-chost stuff-
//-ghost stuff-
if(ghost)
usr << "this is just to stop warnings in WIP code TODO ERRORAGE"
if(W)
if(usr.client && usr.client.holder)
src.attackby(W, ghost) //This is so admins can interact with things ingame.
else
src.attack_ghost(ghost) //Something's gone wrong, non-admin ghosts shouldn't be able to hold things.
else
if(usr.client && usr.client.holder)
src.attack_admin(ghost) //This is so admins can interact with things ingame.
else
src.attack_ghost(ghost) //Standard click as ghost
else if(ismonkey(usr))
var/mob/living/carbon/monkey/monkey = usr
//-monkey stuff-
if(monkey.stat)
return
if(monkey.in_throw_mode)
return monkey.throw_item(src)
var/in_range = in_range(src, monkey) || src.loc == monkey
if(in_range)
usr << "this is just to stop warnings in WIP code TODO ERRORAGE"
if (in_range)
if ( !monkey.restrained() )
if (W)
attackby(W,monkey)
if (W)
W.afterattack(src, monkey)
else
attack_paw(monkey)
else
hand_p(monkey, monkey.hand)
else
if ( (W) && !monkey.restrained() )
W.afterattack(src, monkey)
else if(isalienadult(usr))
var/mob/living/carbon/alien/humanoid/alien = usr
//-alien stuff-
if(alien.stat)
return
var/in_range = in_range(src, alien) || src.loc == alien
if(in_range)
usr << "this is just to stop warnings in WIP code TODO ERRORAGE"
if (in_range)
if ( !alien.restrained() )
if (W)
attackby(W,alien)
if (W)
W.afterattack(src, alien)
else
attack_alien(alien)
else
hand_al(alien, alien.hand)
else
if ( (W) && !alien.restrained() )
W.afterattack(src, alien)
else if(istype(usr,/mob/living/carbon/metroid))
else if(ismetroid(usr))
var/mob/living/carbon/metroid/metroid = usr
//-metroid stuff-
if(metroid.stat)
return
var/in_range = in_range(src, metroid) || src.loc == metroid
if(in_range)
usr << "this is just to stop warnings in WIP code TODO ERRORAGE"
if (in_range)
if ( !metroid.restrained() )
if (W)
attackby(W,metroid)
if (W)
W.afterattack(src, metroid)
else
attack_metroid(metroid)
else
hand_m(metroid, metroid.hand)
else
if ( (W) && !metroid.restrained() )
W.afterattack(src, metroid)
else if(isanimal(usr))
var/mob/living/simple_animal/animal = usr
//-simple animal stuff-
if(animal.stat)
return
var/in_range = in_range(src, animal) || src.loc == animal
if(in_range)
usr << "this is just to stop warnings in WIP code TODO ERRORAGE"
if (in_range)
if ( !animal.restrained() )
attack_animal(animal)
/atom/DblClick() //TODO: DEFERRED: REWRITE
// world << "checking if this shit gets called at all"

View File

@@ -101,7 +101,8 @@
else
if ((usr.mutations & CLOWN) && prob(50)) t = "funny-looking"
usr << text("This is a []\icon[][]. It is a [] item.", !src.blood_DNA ? "" : "bloody ",src, src.name, t)
usr << src.desc
if(src.desc)
usr << src.desc
return
/obj/item/attack_hand(mob/user as mob)

View File

@@ -165,6 +165,7 @@
verbs += /client/proc/send_space_ninja
verbs += /client/proc/restartcontroller //Can call via aproccall --I_hate_easy_things.jpg, Mport --Agouri
verbs += /client/proc/Blobize//I need to remember to move/remove this later
verbs += /client/proc/toggle_clickproc //TODO ERRORAGE (Temporary proc while the enw clickproc is being tested)
if (holder.level >= 4)//Badmin********************************************************************
verbs += /obj/admins/proc/adrev //toggle admin revives
@@ -606,6 +607,14 @@
update_admins(holder.rank)
deadchat = temp
/client/proc/toggle_clickproc() //TODO ERRORAGE (This is a temporary verb here while I test the new clicking proc)
set name = "Toggle NewClickProc"
set category = "Admin"
if(!holder) return
using_new_click_proc = !using_new_click_proc
world << "Testing of new click proc [using_new_click_proc ? "enabled" : "disabled"]"
/client/proc/hide_most_verbs()//Allows you to keep some functionality while hiding some verbs
set name = "Toggle most admin verb visibility"
set category = "Admin"

View File

@@ -52,6 +52,11 @@
return 1
return 0
/proc/ismetroid(A)
if(istype(A, /mob/living/carbon/metroid))
return 1
return 0
/proc/isrobot(A)
if(istype(A, /mob/living/silicon/robot))
return 1
@@ -82,6 +87,11 @@
return 1
return 0
/proc/ispAI(A)
if(istype(A, /mob/living/silicon/pai))
return 1
return 0
/proc/iscarbon(A)
if(istype(A, /mob/living/carbon))
return 1