void on_move( object src ) { ::on_move( src ); if( !src ) return; if( !solid && !environment()->query_container() ) { object old_targ; old_targ = query_target(); set_target(this_object()); if( this_player() ) this_player()->msg_local( "~CACT~Subt ~vertdissipate as ~name ~verbpour it out.~CDEF" ); set_target( old_targ ); destruct( this_object() ); } }
varargs int on_cast(mapping param) { object jack, ai; int bonus = param["caster"]->skill_check("magic.mana.fire",50,60,70,80,90,100); set_actor(param["caster"]); set_target(param["target"]); param["caster"]->msg_local("~[030~Subt ~verttake on a life of ~post own and ~vertbegin to float next to ~name.~CDEF"); destruct(param["target"]); jack = clone_object("/monsters/summon/jackolantern"); jack->move(environment(param["caster"])); jack->validate_position(); // heal pumpkin man jack->set_stat("con",jack->query_stat("con")+(bonus/2)); jack->set_stat("int",jack->query_stat("int")+(bonus/2)); jack->set_stat("spd",jack->query_stat("spd")+bonus); jack->set_stat("wil",jack->query_stat("wil")+bonus); jack->set_hp(jack->query_max_hp()); jack->set_mana(jack->query_max_mana()); jack->set_endurance(jack->query_max_endurance()); // unfortunately, on_hire is a bit flaky right now and only works if the caster is // set to this_player() ai = present_clone("/ai/worker",jack); ai->on_hire(); command("follow "+(param["caster"]->query_name()),jack); jack->set_time_to_live( max(20,param["caster"]->get_skill_roll("magic.faith.blessing")/2) ); return 1; }
main(string param) { object ob, *obs, i, n, env; string s; ADM_CHECK if(!param) { msg("==> [Format] nuke <objects>"); return 1; } ob = find_thing(param); if(!ob) { notify_fail("==> [Error] Unable to locate object "+param+"\n"); return 0; } obs = all_inventory( ob ); set_target(ob); this_player()->msg_local("~CBRT~Name ~verbclap ~poss hands. A heavy banging sound is heard, like a cannon-shot.~CDEF"); foreach( ob : obs ) { if( !ob->query_is_player() ) destruct(ob); } return 1; }
void Camera::init_camera (Actor *target) { m_frame.x = 0; m_frame.y = 0; if (target) { set_target (target); } m_frame.w = Constants::WINDOW_WIDTH; m_frame.h = Constants::WINDOW_HEIGHT; PRINT_TRACE (1, "Ouverture de la fenetre (de taille %d*%d)", m_frame.w, m_frame.h) if (!m_initialized) { if (Constants::FULL_SCREEN == 0) { m_window = new sf::RenderWindow (sf::VideoMode (m_frame.w, m_frame.h, 32), "SuperBadbar"); } else { m_window = new sf::RenderWindow (sf::VideoMode (m_frame.w, m_frame.h, 32), "SuperBadbar", sf::Style::Fullscreen); } EventKeyboard::initEventKeyboard(); } m_target = target; #ifdef DEBUG_COLL m_green_coll = new Surface (PIC_DEBUG_R + "green_col.png"); m_red_coll = new Surface (PIC_DEBUG_R + "red_col.png"); #endif m_initialized = true; }
void AATPoint::set_target(const fixed range, const fixed radial, const TaskProjection &proj) { fixed oldrange = fixed_zero; fixed oldradial = fixed_zero; get_target_range_radial(oldrange, oldradial); const FlatPoint fprev = proj.fproject(get_previous()->get_location_remaining()); const FlatPoint floc = proj.fproject(get_location()); const FlatLine flb (fprev,floc); const FlatLine fradius (floc,proj.fproject(get_location_min())); const fixed bearing = fixed_minus_one * flb.angle().value_degrees(); const fixed radius = fradius.d(); fixed swapquadrants = fixed_zero; if (positive(range) != positive(oldrange)) swapquadrants = fixed(180); const FlatPoint ftarget1 (fabs(range) * radius * cos((bearing + radial + swapquadrants) / fixed(360) * fixed_two_pi), fabs(range) * radius * sin( fixed_minus_one * (bearing + radial + swapquadrants) / fixed(360) * fixed_two_pi)); const FlatPoint ftarget2 = floc + ftarget1; const GeoPoint targetG = proj.funproject(ftarget2); set_target(targetG, true); }
int on_use( object target ) { object bldg; object ilock, idoor; if( target ) return 0; bldg = query_condemn_obj(); if( !bldg ) { msg( "The building has disappeared! This condemnation isn't valid anymore." ); destruct(this_object()); return 1; } if( condemn_time > time() ) { msg( "The warning time hasn't expired yet. You can't enforce the condemnation." ); return 1; } foreach( ilock : deep_inventory(bldg) ) { if( ilock->query_is_lock() ) destruct(ilock); } foreach( idoor: all_inventory(environment(bldg)) ) { if( idoor->query_host() == bldg ) foreach( ilock: all_inventory(idoor) ) if( ilock->query_is_lock() ) destruct(ilock); } set_target(bldg); this_player()->msg_local( "~CACT~Name ~verbenforce the condemnation on ~targ by uprooting the sign and whacking the building with it. Ka-boom!~CDEF" ); msg( "All locks have been removed from the building, and anyone can raze it now." ); bldg->set_owner( 0 ); destruct( this_object() ); return 1; }
void ProtoBufExport::Include(clang::FileEntry const *origin, clang::FileEntry const *target) { exportData([&](ct::proto::Envelope &env) { auto incl = env.mutable_include(); incl->set_origin(origin->getName()); incl->set_target(target->getName()); }); }
varargs int on_cast(mapping param) { object decoy; int hp; // debit hp first hp = to_int(param["caster"]->query_hp() * 0.95); param["caster"]->add_hp( -hp ); // check for existing decoys... backlash decoy = present_clone( "/monsters/summon/decoy", environment(param["caster"]) ); if( decoy ) { param["caster"]->msg_local( "~[030~Name ~verbstand completely still until ~pron ~verbis knocked down by a green blast.~CDEF" ); msg_object( param["caster"], "~CWRNThere is already a decoy spirit at this location. Your spell has backfired.~CDEF" ); param["caster"]->set_stance( ST_LYING ); return 1; } // actually create the pet now decoy = clone_object( "/monsters/summon/decoy" ); decoy->move(environment(param["caster"])); decoy->set_coord(WALK_DAEMON->query_random_adjacent(param["caster"])); decoy->validate_position(); decoy->setup( param["caster"]->query_name(), hp ); set_actor(param["caster"]); set_target(decoy); param["caster"]->msg_local( "~[030~Name ~verbstand completely still as ~targ ~vertfade into view beside ~obje.~CDEF" ); return 1; }
Messenger::Messenger(Handler* target_, Looper* looper_, status_t* result) : m_target(NULL), m_looper(NULL) { status_t sts = set_target(target_, looper_); if(result) *result = sts; }
static int parse_probe_event_argv(int argc, const char **argv) { int i, len, ret, found_target; char *buf; found_target = set_target(argv[0]); if (found_target < 0) return found_target; if (found_target && argc == 1) return 0; /* Bind up rest arguments */ len = 0; for (i = 0; i < argc; i++) { if (i == 0 && found_target) continue; len += strlen(argv[i]) + 1; } buf = zalloc(len + 1); if (buf == NULL) return -ENOMEM; len = 0; for (i = 0; i < argc; i++) { if (i == 0 && found_target) continue; len += sprintf(&buf[len], "%s ", argv[i]); } params.mod_events = true; ret = parse_probe_event(buf); free(buf); return ret; }
int main(string arg) { object who, victim; WIZ_CHECK if( !arg ) return notify_fail("==> [Format] frotz victim\n"); victim = find_player(arg); if( !victim ) return notify_fail("I can't find any such player '"+arg+"' to zap.\n"); AUDIO_DAEMON->sfx_mud("thunder.wav"); foreach( who : users() ) { set_actor( this_player() ); set_target( victim ); set_listener( who ); msg_object(who,"~CTITFROTZ! ~CBRT~Name ~verbstrike ~targ with lightning.~CDEF"); } victim->set_env_var( "cause_of_death", "was frotzed by "+capitalize(this_player()->query_name())+"." ); victim->add_hp( this_player()->query_level() / -4); return 1; }
varargs int remove_armour(int silent) { object owner = environment(this_object()), obj; if (!worn) return 0; if (!owner->query_is_living()) return 0; set_target(this_object()); // check if they're wearing anything over this item foreach ( obj : all_inventory(owner) ) { if( obj->query_is_apparel() && (obj->query_body_parts() & query_body_parts()) && obj->query_layer() > layer) { if( !silent ) msg("You can't remove ~targ, without first removing "+obj->query_name()+"."); return 0; } } // returns true if on_remove() has been defined, so false means we have // to do this our selves as well if (this_object()->on_remove() == 0) { if (this_object()->query_cursed()) { if (!silent) msg_object(owner,"You can't remove ~targ! It appears to be cursed!"); } else { if (!silent) owner->msg_local("~Name ~verbremove ~targ."); set_worn(0); owner->recalc(); return 1; } } }
bcf_srs(bcf_srs_helper::init &init) : bcf_srs() { if (!init.region.empty()) { if (init.useIndex) set_region(init.region); else set_target(init.region); } }
static gboolean kms_base_hub_link_src_pad (KmsBaseHub * mixer, const gchar * gp_name, const gchar * template_name, GstElement * internal_element, const gchar * pad_name, gboolean remove_on_unlink) { GstPad *gp, *target; gboolean ret; if (GST_OBJECT_PARENT (internal_element) != GST_OBJECT (mixer)) { GST_ERROR_OBJECT (mixer, "Cannot link %" GST_PTR_FORMAT " wrong hierarchy", internal_element); return FALSE; } target = gst_element_get_static_pad (internal_element, pad_name); if (target == NULL) { target = gst_element_get_request_pad (internal_element, pad_name); if (target != NULL && remove_on_unlink) { g_signal_connect (G_OBJECT (target), "unlinked", G_CALLBACK (remove_unlinked_pad), NULL); } } if (target == NULL) { GST_ERROR_OBJECT (mixer, "Cannot get target pad"); return FALSE; } gp = gst_element_get_static_pad (GST_ELEMENT (mixer), gp_name); if (gp == NULL) { GstPadTemplate *templ; templ = gst_element_class_get_pad_template (GST_ELEMENT_CLASS (G_OBJECT_GET_CLASS (mixer)), template_name); gp = gst_ghost_pad_new_from_template (gp_name, target, templ); if (GST_STATE (mixer) >= GST_STATE_PAUSED || GST_STATE_PENDING (mixer) >= GST_STATE_PAUSED || GST_STATE_TARGET (mixer) >= GST_STATE_PAUSED) { gst_pad_set_active (gp, TRUE); } ret = gst_element_add_pad (GST_ELEMENT (mixer), gp); if (!ret) { g_object_unref (gp); } } else { ret = set_target (gp, target); g_object_unref (gp); } g_object_unref (target); return ret; }
int main(string str) { string what, as_str; int quality, fail; object ob, as; if( !str ) { notify_fail("What do you want to sign?\n"); return 0; } /* forging commented out for now if (sscanf( str, "%s as %s", what, as_str ) < 2) { what = str; as = this_player(); } else { as = find_player(as_str); if (!as) as = present(as_str,environment(this_player())); if (!as || !as->query_is_living()) { notify_fail("I don't know who you mean by '"+str+"'."); return 0; } } */ what=str; as=this_player(); ob = single_present( what, this_player() ); if( !ob ) ob = single_present( str, environment(this_player()) ); if( !ob ) { notify_fail("I don't know what you mean by "+str+"\n"); return 0; } // quality is indication of how much it looks right // won't look right if you're tired if (as == this_player()) { quality = 100; if (this_player()->query_endurance() < this_player()->query_max_endurance()) quality = quality - this_player()->query_max_endurance() + this_player()->query_endurance(); } else { quality = 1; } if( (fail = ob->on_sign(as->query_name(), quality)) > 0) { set_target(ob); this_player()->msg_local("~CACT~Name ~verbsign ~targ.~CDEF"); this_player()->set_doing("signing ~targ", this_object()); return 1; } else { switch(fail) { case HAS_SIGNED: notify_fail("You've already signed it.\n"); break; case CANT_EDIT: //fall through default: notify_fail("You can't sign that.\n"); break; } return 0; } }
void CFeatureFmt_dlg::reset_custom(Format_style style) { m_custom_ctl.SetWindowText(""); UpdateData(TRUE); Feature_fmt tmp_tgt; set_target(tmp_tgt); tmp_tgt.set(data,style); m_custom_ctl.SetWindowText(Feature::format); }
varargs int on_cast(mapping param) { object apple = single_present(param["component"], param["caster"]); set_actor(param["caster"]); set_target(apple); param["caster"]->msg_local("~[030The turtle chomps ~targ, gulping it down before turning to carry ~npos message to its destination... eventually...~CDEF"); enqueue_delivery( param["option"], param["target"]->query_location("front") ); destruct(apple); return 1; }
/*** TimedCallback ***/ TimedCallback::TimedCallback(CallBack *t, void *d, uint32 wait_time, bool repeat) : TimedEvent(wait_time, TIMER_DELAYED, TIMER_REALTIME) { set_target(t); set_user_data(d); repeat_count = repeat ? -1 : 0; queue(); // start }
std::unique_ptr<link_label_type> create_link_label() { auto p_label =tetengo2::stdalt::make_unique<link_label_type>(m_base); p_label->set_text(string_type{ TETENGO2_TEXT("http://www.tetengo.org/") }); p_label->set_target(p_label->text()); return std::move(p_label); }
void Camera::init(glm::vec3 position, glm::vec3 target, glm::vec3 up, float speed) { set_up(up); set_speed(speed); set_target(target); set_position(position); resetMouseToCenter(); lookAt(); }
/* tries to take care of a redirection */ void handle_3xx(struct sockaddr_in *tadr) { char *uscheme, *uuser, *uhost, *contact; printf("** received redirect "); if (warning_ext == 1) { printf("from "); warning_extract(rec); printf("\n"); } else printf("\n"); /* we'll try to handle 301 and 302 here, other 3xx are to complex */ regcomp(&(regexps.redexp), "^SIP/[0-9]\\.[0-9] 30[125] ", REG_EXTENDED|REG_NOSUB|REG_ICASE); if (regexec(&(regexps.redexp), rec, 0, 0, 0) == REG_NOERROR) { /* try to find the contact in the redirect */ contact = uri_from_contact(rec); if (contact==NULL) { fprintf(stderr, "error: cannot find Contact in this " "redirect:\n%s\n", rec); exit_code(3, __PRETTY_FUNCTION__, "missing Contact header in reply"); } /* correct our request */ uri_replace(req, contact); new_transaction(req, rep); /* extract the needed information*/ rport = 0; address = 0; parse_uri(contact, &uscheme, &uuser, &uhost, &rport); if (!rport) address = getsrvadr(uhost, &rport, &transport); if (!address) address = getaddress(uhost); if (!address){ fprintf(stderr, "error: cannot determine host " "address from Contact of redirect:" "\n%s\n", rec); exit_code(2, __PRETTY_FUNCTION__, "missing host in Contact header"); } if (!rport) { rport = 5060; } free(contact); if (!outbound_proxy) cdata.connected = set_target(tadr, address, rport, cdata.csock, cdata.connected); } else { fprintf(stderr, "error: cannot handle this redirect:" "\n%s\n", rec); exit_code(2, __PRETTY_FUNCTION__, "unsupported redirect reply"); } }
/** Move the arm to a given position (trajectory point). * @param coord Array of 6 floats containing translation and rotation * @param fingers Array of 3 floats containing finger values */ void JacoArm::set_target_cart(float coord[], float fingers[]) { jaco_basic_traj_point_t traj; memcpy(&traj.target, coord, 24); memcpy(traj.target.finger_position, fingers, 12); traj.time_delay = 0; traj.hand_mode = MODE_POSITION; traj.pos_type = POSITION_CARTESIAN; set_target(traj); }
/** Move the arm to a given position (trajectory point). * @param joints Array of 6 floats containing angular values for each joint * @param fingers Array of 3 floats containing finger values */ void JacoArm::set_target_ang(float joints[], float fingers[]) { jaco_basic_traj_point_t traj; memcpy(&traj.target, joints, 24); memcpy(traj.target.finger_position, fingers, 12); traj.time_delay = 0; traj.hand_mode = MODE_POSITION; traj.pos_type = POSITION_ANGULAR; set_target(traj); }
int main(string str) { string what; string where = ""; // just so we can do covers, etc. more flexible object ob; int fail; if( !str ) { notify_fail("Usage: write [on (page <num>|<part>)] on|of <object>\n"); return 0; } if ( (sscanf( str, "%s of %s", where, what ) < 1) && (sscanf( str, "%s on %s", where, what ) < 1)) { what = str; } if (what[0..2] == "on ") what = what[3..]; if (where[0..2] == "on ") where = where[3..]; if (where[0..4] == "page ") where = where[5..]; ob = present( what, this_player() ); if( !ob ) ob = present( str, environment(this_player()) ); if( !ob ) { notify_fail("I don't know what you mean by "+str+"\n"); return 0; } if( ob->query_file_name() == "/items/paper" ) where = "front"; if( (fail = ob->on_write(where)) > 0 ) { set_target(ob); if (sscanf(where, "%!s%D%!s", str)) { this_player()->say_local("~CACT~Name ~verbbegin writing in ~targ.~CDEF"); this_player()->set_doing("writing in ~targ", ob); } else { this_player()->say_local("~CACT~Name ~verbbegin writing on ~targ.~CDEF"); this_player()->set_doing("writing on ~targ", ob); } return 1; } else { switch(fail){ case IS_SIGNED: notify_fail("You can't add to or edit something that's signed.\n"); break; case BAD_LOCATION: notify_fail("What part of " + ob->query_specific() + " would you like to write on?\n"); break; case BAD_PAGE: notify_fail("That page doesn't exist in " + ob->query_specific() + ".\n"); break; default: notify_fail("You can't write on that.\n"); } return 0; } }
varargs int on_cast(mapping param) { int amt, needed; needed = (param["max_cond"] * 2 / 3) - param["cond"]; amt = min(max( 20, param["caster"]->get_skill_roll("magic.concentration") * 2 ), needed); param["target"]->add_condition( needed ); set_actor(param["caster"]); set_target(param["target"]); param["caster"]->msg_local("~[030~Targ ~vertglow faintly in ~npos hands as it is mended slightly.~CDEF"); return 1; }
void as_environment::set_target ( as_value &target, character *original_target ) { if ( target.is_string() ) { tu_string path = target.to_tu_string(); IF_VERBOSE_ACTION ( log_msg ( "-------------- ActionSetTarget2: %s", path.c_str() ) ); if ( path.size() > 0 ) { character *tar = cast_to<character> ( find_target ( path.c_str() ) ); if ( tar ) { set_target ( tar ); return; } } else { set_target ( original_target ); return; } } else if ( target.is_object() ) { IF_VERBOSE_ACTION ( log_msg ( "-------------- ActionSetTarget2: %s", target.to_string() ) ); character *tar = cast_to<character> ( find_target ( target ) ); if ( tar ) { set_target ( tar ); return; } } IF_VERBOSE_ACTION ( log_msg ( "can't set target %s\n", target.to_string() ) ); }
void on_action(object ob, string as) { if ( environment( ob ) != this_player() ) { msg( "You must be holding the " + ob->query_name() + " to label it.\n" ); return; } if (!ob->on_label(as)) { msg("You can't label "+ob->query_specific()+".\n"); return; } set_target(ob); this_player()->msg_local("~CACT~Name ~verbmark a label on ~targ.~CDEF"); }
/************************************************************** * Take a good hard look at how much punishment we've taken, * * and get out if it's just too much to take! * **************************************************************/ int Pilot::damage_check() { if (flight->mods.battle_damage > 0) { if (flight->mods.battle_damage >= flight->specs->max_damage) { if (functioning) { broadcast("Ejecting!",6,getAffiliation(),NULL); sound_off("takingfire"); sound_off("takingflak"); sound_off("heavydamage"); sound_on("eject",getAffiliation()); dbg = "EJECT"; functioning = 0; set_target(NULL); SetDeath(1); } return (1); } else { if (flight->mods.battle_damage > new_damage) { new_damage = flight->mods.battle_damage; float d1 = ((float)new_damage) / ((float)flight->specs->max_damage); if (target_obj->who_got_me != NULL && target_obj->who_got_me->getType() == GROUND_UNIT_T) { brdcst(sbrPRIORITY_REGULAR,getAffiliation(),"Taking flak: %3.0f%%%%",d1 * 100.0); sound_on("takingflak",getAffiliation()); } else { if (d1 >= 0.75) { brdcst(sbrPRIORITY_REGULAR,getAffiliation(),"Heavy damage: %3.0f%%%%!",d1 * 100.0); sound_on("heavydamage",getAffiliation()); } else { brdcst(sbrPRIORITY_REGULAR,getAffiliation(),"Taking fire %3.0f%%%%",d1 * 100.0); sound_on("takingfire",getAffiliation()); } } } } } return (0); }
int on_close() { object remote; if( this_object()->query_closed() ) { msg(capitalize((string) this_object()->query_specific()) + " is already closed. Attempting to close it further would likely arouse undesired criticism."); return 1; } if( query_locked() ) { msg( capitalize(this_object()->query_specific()) + " is locked. You can't close it."); return 1; } set_target( MOBJ ); this_player()->msg_local( "~CACT~Name ~verbclose ~targ.~CDEF" ); this_object()->set_closed( 1 ); return 1; }
int on_open() { object remote; if( !this_object()->query_closed() ) { msg(capitalize((string) this_object()->query_specific()) + " is already open. Attempting to open it again would just look strange."); return 1; } if( query_locked() ) { msg( capitalize(this_object()->query_specific()) + " is locked. You can't open it."); return 1; } set_target( MOBJ ); this_player()->msg_local( "~CACT~Name ~verbopen ~targ.~CDEF" ); this_object()->set_closed( 0 ); return 1; }