Skip to content

Commit

Permalink
refreshed
Browse files Browse the repository at this point in the history
  • Loading branch information
TeamSPoon committed Oct 2, 2021
1 parent ad50e5f commit c3e9e8f
Show file tree
Hide file tree
Showing 50 changed files with 669 additions and 581 deletions.
2 changes: 1 addition & 1 deletion .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
[submodule "hMUD"]
path = hMUD
url = https://github.com/TeamSPoon/hMUD
url = https://github.com/logicmoo/hMUD
332 changes: 166 additions & 166 deletions README.md

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions pack.pl
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
keywords([game,ai]).

author('Douglas R. Miles','[email protected]').
packager('TeamSPoon', 'https://github.com/TeamSPoon/').
maintainer('TeamSPoon', 'https://github.com/TeamSPoon/').
home('https://github.com/TeamSPoon/prologmud.git').
download( 'https://github.com/TeamSPoon/prologmud/release/*.zip').
packager('logicmoo', 'https://github.com/logicmoo/').
maintainer('logicmoo', 'https://github.com/logicmoo/').
home('https://github.com/logicmoo/prologmud.git').
download( 'https://github.com/logicmoo/prologmud/release/*.zip').
requires(logicmoo_base).

49 changes: 49 additions & 0 deletions prolog/logicmoo_mud.pl
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
/* LogicMOO User Modules Setup
%
%
% Dec 13, 2035
% Douglas Miles
*/
:- module(logicmoo_mud, [ ]).

% ==============================================
% [Required] Load the Logicmoo User System
% ==============================================
:- ensure_loaded(library(logicmoo_lib)).

%:- if( \+ exists_source(library(prologmud/mud_startup))).
%:- add_pack_path(packs_sys).
%:- endif.

set_prologmud_home_dir:- exists_source(prologmud(mud_loader)),!.
set_prologmud_home_dir:-
must((absolute_file_name(library('prologmud/'),Dir,[file_type(directory),access(read)]),
nonvar(Dir), asserta(user:file_search_path(prologmud,Dir)))).

:- if(\+ exists_source(prologmud(mud_loader))).
:- set_prologmud_home_dir,!.
:- assertion(exists_source(prologmud(mud_loader))).
:- endif.

% start_runtime_mud:-!.
% start_runtime_mud:- baseKB:lst, listing(mudAtLoc).

% ensure_mud_startup:- !.
ensure_mud_startup:-
set_prologmud_home_dir,
baseKB:ensure_loaded(prologmud(mud_loader)),
current_prolog_flag(access_level,WAS),!,
set_prolog_flag(access_level,user),
baseKB:ensure_loaded(prologmud(mud_startup)),
set_prolog_flag(access_level,WAS).

:- fixup_exports.


:- if( \+ app_argv('--nomud')).
:- ensure_mud_startup.
:- endif.



2 changes: 1 addition & 1 deletion prolog/prologmud/actions/any.pfc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@


% Use something
agent_call_command(Agent,ACT) :-
baseKB:agent_call_command(Agent,ACT) :-
call((action_rules(Agent,VERB,SENT,_StateRules),safe_univ(ACT,[VERB|SENT]))),

action_requires_states(Agent,[VERB|SENT],REQS),
Expand Down
4 changes: 2 additions & 2 deletions prolog/prologmud/actions/as_agent.pfc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

% :- register_module_type (mtCommand).

action_info('actAs'(tAgent,ftVerbAction), "actAs <agent> <command>").
agent_call_command(_Agent,'actAs'(OtherAgent,Command)):- do_agent_action(OtherAgent,Command).
baseKB:action_info('actAs'(tAgent,ftVerbAction), "actAs <agent> <command>").
baseKB:agent_call_command(_Agent,'actAs'(OtherAgent,Command)):- do_agent_action(OtherAgent,Command).

:- include(prologmud(mud_footer)).
2 changes: 1 addition & 1 deletion prolog/prologmud/actions/attack.pfc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@



agent_call_command(Agent,actAttack(Dir)):- once(actAttack(Agent,Dir)).
baseKB:agent_call_command(Agent,actAttack(Dir)):- once(actAttack(Agent,Dir)).

% Attack
% Successful Attack
Expand Down
4 changes: 2 additions & 2 deletions prolog/prologmud/actions/chat.pfc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@

vtSocialVerb(SocialVerb):-member(SocialVerb,[actSay,actWhisper,actEmote,actTell,actAsk,actShout,actGossup]).

action_info(Say,ftText("invokes",Does)):- socialCommand(Say,_SocialVerb,Does).
baseKB:action_info(Say,ftText("invokes",Does)):- socialCommand(Say,_SocialVerb,Does).

agent_text_command(Agent,[Say|What],Agent,CMD):-
baseKB:agent_text_command(Agent,[Say|What],Agent,CMD):-
agent_text_command_chat(Agent,[Say|What],Agent,CMD).

agent_text_command_chat(Agent,[Say|What],Agent,CMD):- nonvar(Say),nonvar(What),!,
Expand Down
2 changes: 1 addition & 1 deletion prolog/prologmud/actions/climb.pfc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
%:-stop_rtrace.


agent_call_command(Agent,actClimb(Dir)):- once(actClimb(Agent,Dir)).
baseKB:agent_call_command(Agent,actClimb(Dir)):- once(actClimb(Agent,Dir)).

% Climb - If there is nothing there to climb, move to location plus take some damage and loose charge
actClimb(Agent,Dir) :-
Expand Down
10 changes: 5 additions & 5 deletions prolog/prologmud/actions/create.pfc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -34,18 +34,18 @@
call_u(mudPossess(Agent,NewObj))))).


action_info(actRez(isOneOf([tCol,ftID,ftTerm])),"Rezes a new subclass of 'item' or clone of tObj of some NameOrType into mudStowing inventory").
baseKB:action_info(actRez(isOneOf([tCol,ftID,ftTerm])),"Rezes a new subclass of 'item' or clone of tObj of some NameOrType into mudStowing inventory").

agent_call_command(Agent,actRez(NameOrType)):- nonvar(NameOrType),
baseKB:agent_call_command(Agent,actRez(NameOrType)):- nonvar(NameOrType),
must(find_and_call(rez_to_inventory(Agent,NameOrType,NewObj))),
fmt([rezed,NameOrType,NewObj]).

% ====================================================
% object/col creation
% ====================================================
action_info(actCreate(ftListFn(ftTerm)), "Rezes a new 'tSpatialThing' or creates a new 'col' of some NameOrType and if it's an 'item' it will put in mudStowing inventory").
baseKB:action_info(actCreate(ftListFn(ftTerm)), "Rezes a new 'tSpatialThing' or creates a new 'col' of some NameOrType and if it's an 'item' it will put in mudStowing inventory").

agent_call_command(Agent,actCreate(SWhat)):- with_all_dmsg(must_det(create_new_object(Agent,SWhat))).
baseKB:agent_call_command(Agent,actCreate(SWhat)):- with_all_dmsg(must_det(create_new_object(Agent,SWhat))).

==> prologHybrid(authorWas(ftTerm,ftTerm)).
:- dynamic(current_pronoun/3).
Expand All @@ -68,7 +68,7 @@

:-export(create_new_type/2).
create_new_type(Agent,[NewObj|DefaultParams]):-
call_u((decl_type(NewObj),
call_u((ain(tCol(NewObj)),
padd(NewObj,authorWas(create_new_type(Agent,[NewObj|DefaultParams]))),
padd(Agent,current_pronoun("it",NewObj)),
getPropInfo(Agent,NewObj,DefaultParams,2,PropList),!,
Expand Down
4 changes: 2 additions & 2 deletions prolog/prologmud/actions/drink.pfc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -12,12 +12,12 @@

% :- register_module_type (mtCommand).

action_info(actDrink(tDrinkAble),"Drink a Drinkable Item").
baseKB:action_info(actDrink(tDrinkAble),"Drink a Drinkable Item").

% Drink something held
% Check to make sure it's in the agents possession...
% if it is, process it's worth, then destroy it
agent_call_command(Agent,actDrink(Obj)) :-
baseKB:agent_call_command(Agent,actDrink(Obj)) :-
mudPossess(Agent,Obj),
do_act_affect(Agent,actDrink,Obj),
clr(mudPossess(Agent,Obj)),
Expand Down
6 changes: 3 additions & 3 deletions prolog/prologmud/actions/drop.pfc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@

% orderedBy(tDropAble,tNearestReachableItem).

action_info(actDrop(isOneOf([tDropAble,tNearestReachableItem,tObj,ftID])),"Drop an item").
baseKB:action_info(actDrop(isOneOf([tDropAble,tNearestReachableItem,tObj,ftID])),"Drop an item").

agent_call_command(Agent,actDrop(Obj)):- once(actDrop(Agent,Obj)).
baseKB:agent_call_command(Agent,actDrop(Obj)):- once(actDrop(Agent,Obj)).

% Drop something
actDrop(Agent,Obj) :-
Expand All @@ -38,7 +38,7 @@
% Record keeping
update_charge(Agent,actDrop) :- ain(mudEnergy(Agent, + -1)).

agent_text_command(Agent,["drop",X],Agent,actDrop(parseForFn(tDroppable,X))).
baseKB:agent_text_command(Agent,["drop",X],Agent,actDrop(parseForFn(tDroppable,X))).

%:-must_det(show_call(get_agent_text_command(agent1,[drop,item1],_R,_CMD))).

Expand Down
8 changes: 4 additions & 4 deletions prolog/prologmud/actions/eat.pfc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
% :- register_module_type (mtCommand).

genls(tFood,tEatAble).
action_info(actEat(tEatAble),"nourish oneself").
baseKB:action_info(actEat(tEatAble),"nourish oneself").


agent_coerce_for(Pred,_TC,Agent,String,Obj):-
Expand All @@ -33,13 +33,13 @@


% Eat something held
agent_call_command(Agent,actEat(String)) :-
baseKB:agent_call_command(Agent,actEat(String)) :-
agent_coerce_for(mudPossess,tEatAble,Agent,String,Obj),!,
agent_call_command(Agent,actEat(Obj)).
baseKB:agent_call_command(Agent,actEat(Obj)).

% Check to make sure it's in the agents possession...
% if it is, process it's worth, then destroy it
agent_call_command(Agent,actEat(Obj)) :-
baseKB:agent_call_command(Agent,actEat(Obj)) :-
((must_det((
mudPossess(Agent,Obj),
must((do_act_affect(Agent,actEat,Obj))),
Expand Down
20 changes: 10 additions & 10 deletions prolog/prologmud/actions/get_set.pfc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -8,19 +8,19 @@

% :- register_module_type (mtCommand).

action_info(actGet(isOptional(ftTerm,isSelfAgent),tPred),ftText("@get term to a property")).
action_info(actSet(isOptional(ftTerm,isSelfAgent),tPred,ftTerm),ftText("@sets term to a property")).
baseKB:action_info(actGet(isOptional(ftTerm,isSelfAgent),tPred),ftText("@get term to a property")).
baseKB:action_info(actSet(isOptional(ftTerm,isSelfAgent),tPred,ftTerm),ftText("@sets term to a property")).

agent_text_command(Agent,["@set",Prop0,Value0],Agent,actSet(Agent,Prop0,Value0)).
agent_text_command(Agent,["@get",Prop0],Agent,actGet(Agent,Prop0)).
agent_text_command(Agent,["@","set",Prop0,Value0],Agent,actSet(Agent,Prop0,Value0)).
agent_text_command(Agent,["@","get",Prop0],Agent,actGet(Agent,Prop0)).
agent_text_command(Agent,["@_set",Prop0,Value0],Agent,actSet(Agent,Prop0,Value0)).
agent_text_command(Agent,["@_get",Prop0],Agent,actGet(Agent,Prop0)).
baseKB:agent_text_command(Agent,["@set",Prop0,Value0],Agent,actSet(Agent,Prop0,Value0)).
baseKB:agent_text_command(Agent,["@get",Prop0],Agent,actGet(Agent,Prop0)).
baseKB:agent_text_command(Agent,["@","set",Prop0,Value0],Agent,actSet(Agent,Prop0,Value0)).
baseKB:agent_text_command(Agent,["@","get",Prop0],Agent,actGet(Agent,Prop0)).
baseKB:agent_text_command(Agent,["@_set",Prop0,Value0],Agent,actSet(Agent,Prop0,Value0)).
baseKB:agent_text_command(Agent,["@_get",Prop0],Agent,actGet(Agent,Prop0)).

agent_call_command(Agent,actSet(Obj0,Prop0,Value0)) :- coerce(Prop0,tPred,Prop,Prop0),subst(ain(t(Prop,Obj0,Value0)),isSelfAgent,Agent,K),dmsg(K),on_x_debug(K).
baseKB:agent_call_command(Agent,actSet(Obj0,Prop0,Value0)) :- coerce(Prop0,tPred,Prop,Prop0),subst(ain(t(Prop,Obj0,Value0)),isSelfAgent,Agent,K),dmsg(K),on_x_debug(K).

agent_call_command(Agent,actGet(Obj0,Prop0)) :- subst(t(Prop0,Obj0,Value),isSelfAgent,Agent,K),
baseKB:agent_call_command(Agent,actGet(Obj0,Prop0)) :- subst(t(Prop0,Obj0,Value),isSelfAgent,Agent,K),
catch((findall(Value,(req1(K),fmt(K)),L),
(L==[_|_]->true;fmt(wasMissing(K)))),E,fmt('@get Error ~q',[E:K])).

Expand Down
36 changes: 18 additions & 18 deletions prolog/prologmud/actions/help.pfc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

:- kb_global(baseKB:type_action_info/3).

type_action_info(tHumanControlled,actHelp(isOptional(ftString,"")), "shows this help").
baseKB:type_action_info(tHumanControlled,actHelp(isOptional(ftString,"")), "shows this help").


:-export(get_all_templates/1).
Expand All @@ -27,24 +27,24 @@
get_all_templates0(Templ):-get_bad_templates(Templ),not(get_good_templates(Templ)).

get_good_templates(Templ):- isa(Templ,vtActionTemplate),good_template(Templ).
% get_good_templates(Templ):- no_repeats_old((action_info(Templ,_),good_template(Templ))).
% get_good_templates(Templ):- no_repeats_old((baseKB:action_info(Templ,_),good_template(Templ))).


get_bad_templates(Templ):- no_repeats_old((action_info(Templ,_),not(good_template(Templ)))).
get_bad_templates(Templ):- no_repeats_old((baseKB:action_info(Templ,_),not(good_template(Templ)))).


:- sanity((fully_expand_real(foo,action_info(TEMPL, txtConcatFn(_Text,"does: ",do(_A2,TEMPL))),O),dmsg(O))).
:- sanity((fully_expand_real(foo,baseKB:action_info(TEMPL, txtConcatFn(_Text,"does: ",do(_A2,TEMPL))),O),dmsg(O))).

% :- mpred_core:import(baseKB:get_agent_text_command_0/4).

/*
==> ((({between(1,5,L),length(Text,L),
get_agent_text_command(_A,Text,A2,Goal),(ground(Goal)->TEMPL=Goal;TEMPL=Text)}==>
action_info(TEMPL, txtConcatFn(Text,"does: ",do(A2,TEMPL)))))).
baseKB:action_info(TEMPL, txtConcatFn(Text,"does: ",do(A2,TEMPL)))))).
*/

(action_rules(_Agent,Verb,[Obj|Objs],List),{atomic(Verb),safe_univ(Syntax,[Verb,Obj|Objs])} ==>
action_info(Syntax, txtConcatFn(["makes","happen"|List]))).
baseKB:action_info(Syntax, txtConcatFn(["makes","happen"|List]))).


to_param_doc(TEMPL,["Prolog", "looks", "like", ":",TEMPL]):-!.
Expand All @@ -57,15 +57,15 @@

:- kb_shared(action_info_db/3).

action_info_db(TEMPL,INFO,WAS):- (PRED=agent_call_command(_,WAS);PRED=agent_text_command(_,_,_,WAS)) ,
action_info_db(TEMPL,INFO,WAS):- (PRED=baseKB:agent_call_command(_,WAS);PRED=baseKB:agent_text_command(_,_,_,WAS)) ,
clause(PRED,BODY,REF),clause_property(REF,file(S)),
(ground(WAS)->true;once(( ignore((nop(S=S),first_pl(BODY,PL),ignore(catch(((true;quietly(PL)),!),_,true)))),ground(WAS)))),

(TEMPL=@=WAS -> ((clause_property(REF,line_count(LC)),INFO=line(LC:S))) ; (not(not(TEMPL=WAS)) -> INFO=file(S) ; fail)).

% :-trace.
action_info_db(TEMPL,S,WAS) ==> if_missing(action_info(TEMPL,_Help), action_info(TEMPL,txtConcatFn(S,contains,WAS))).
% action_info(TEMPL,txtConcatFn(S,contains,WAS)) <= action_info_db(TEMPL,S,WAS),{not_asserted(action_info(TEMPL,_Help))}.
action_info_db(TEMPL,S,WAS) ==> if_missing(baseKB:action_info(TEMPL,_Help), baseKB:action_info(TEMPL,txtConcatFn(S,contains,WAS))).
% baseKB:action_info(TEMPL,txtConcatFn(S,contains,WAS)) <= action_info_db(TEMPL,S,WAS),{not_asserted(baseKB:action_info(TEMPL,_Help))}.


commands_list(ListS):- findall(Templ,get_all_templates(Templ),List),predsort(alpha_shorter_1,List,ListS).
Expand All @@ -78,17 +78,17 @@
(compare(OrderA,A1,A2), (OrderA \== '=' -> OrderO=OrderA ; compare(OrderO,P1,P2)))).


show_templ_doc(TEMPL):-findall(DOC,action_info(TEMPL,DOC),DOCL),nvfmt(TEMPL=DOCL).
show_templ_doc_all(TEMPL):-findall(DOC,action_info(TEMPL,DOC),DOCL),nvfmt(TEMPL=DOCL).
show_templ_doc(TEMPL):-findall(DOC,baseKB:action_info(TEMPL,DOC),DOCL),nvfmt(TEMPL=DOCL).
show_templ_doc_all(TEMPL):-findall(DOC,baseKB:action_info(TEMPL,DOC),DOCL),nvfmt(TEMPL=DOCL).

nvfmt([XX]):-!,nvfmt(XX).
nvfmt(XX=[YY]):-!,nvfmt(XX=YY).
nvfmt(XX):-copy_term(XX,X),numbervars(X,0,_,[attvar(bind),singletons(true)]),fmt(X).

% Help - A command to tell an agent all the possible commands
actHelp:- commands_list(ListS),forall(member(E,ListS),show_templ_doc(E)).
agent_call_command(_Agent,actHelp) :- actHelp.
agent_call_command(_Agent,actHelp(Str)) :-actHelp(Str).
baseKB:agent_call_command(_Agent,actHelp) :- actHelp.
baseKB:agent_call_command(_Agent,actHelp(Str)) :-actHelp(Str).

actHelp(Str):-commands_list(ListS),forall(member(E,ListS),write_doc_if_contains(Str,E)).

Expand All @@ -102,20 +102,20 @@

impl_coerce_hook(Text,vtVerb,Inst):- isa(Inst,vtVerb),name_text(Inst,Text).

%agent_text_command(Agent,[Who],Agent,Cmd):- nonvar(Who), get_all_templates(Syntax),Syntax=..[Who,isOptional(_,Default)],Cmd=..[Who,Default].
%agent_text_command(Agent,[Who,Type],Agent,Cmd):- get_all_templates(Syntax),nonvar(Who),Syntax=..[Who,isOptional(Type,_)],Cmd=..[Who,Type].
%baseKB:agent_text_command(Agent,[Who],Agent,Cmd):- nonvar(Who), get_all_templates(Syntax),Syntax=..[Who,isOptional(_,Default)],Cmd=..[Who,Default].
%baseKB:agent_text_command(Agent,[Who,Type],Agent,Cmd):- get_all_templates(Syntax),nonvar(Who),Syntax=..[Who,isOptional(Type,_)],Cmd=..[Who,Type].

:- include(prologmud(mud_footer)).

% :-ain((({get_all_templates(Templ)})==>vtActionTemplate(Templ))).

:- kb_shared(baseKB:actParse/2).

(type_action_info(_,TEMPL,Help) ==> action_info(TEMPL,Help)).
(baseKB:type_action_info(_,TEMPL,Help) ==> baseKB:action_info(TEMPL,Help)).

(action_info(TEMPL,_Help) ==> vtActionTemplate(TEMPL)).
(baseKB:action_info(TEMPL,_Help) ==> vtActionTemplate(TEMPL)).

vtActionTemplate(TEMPL), \+ action_info(TEMPL,_) ==> ({to_param_doc(TEMPL,S)},action_info(TEMPL,S)).
vtActionTemplate(TEMPL), \+ baseKB:action_info(TEMPL,_) ==> ({to_param_doc(TEMPL,S)},baseKB:action_info(TEMPL,S)).



Expand Down
6 changes: 3 additions & 3 deletions prolog/prologmud/actions/inventory.pfc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@
destroy_clause(Obj,H,B,R):- wdmsg(misssed_destroy_clause(Obj,H,B,R)).


action_info(actInventory(isOptional(tAgent,isSelfAgent)), "Examine an inventory").
baseKB:action_info(actInventory(isOptional(tAgent,isSelfAgent)), "Examine an inventory").

agent_call_command(Agent,actInventory(Who)):- show_inventory(Agent,Who).
agent_call_command(Agent,actInventory):- show_inventory(Agent,Agent).
baseKB:agent_call_command(Agent,actInventory(Who)):- show_inventory(Agent,Who).
baseKB:agent_call_command(Agent,actInventory):- show_inventory(Agent,Agent).

show_inventory(Agent,Who):-
show_kb_preds(Agent,[
Expand Down
4 changes: 2 additions & 2 deletions prolog/prologmud/actions/kiss.pfc.pl
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@

vtFrotVerb(FrotVerb):-member(FrotVerb,[actKiss,actHug,actRub,actFrottage]).

action_info(Kiss,ftText("invokes",Does)):- frotCommand(Kiss,_FrotVerb,Does).
baseKB:action_info(Kiss,ftText("invokes",Does)):- frotCommand(Kiss,_FrotVerb,Does).

agent_text_command(Agent,[Kiss|What],Agent,CMD):-
baseKB:agent_text_command(Agent,[Kiss|What],Agent,CMD):-
agent_text_command_frot(Agent,[Kiss|What],Agent,CMD).

agent_text_command_frot(Agent,[Kiss|What],Agent,CMD):- nonvar(Kiss),nonvar(What),!,
Expand Down
Loading

0 comments on commit c3e9e8f

Please sign in to comment.